<p>Following <a href="https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/blob/master/docs/quick-start-guide.md#installation" rel="nofollow noreferrer">this</a> guide, I have deployed a "spark-on-k8s" operator inside my Kubernetes cluster.</p>

<p>In the guide, it mentions how you can deploy Spark applications using kubectl commands. </p>

<p>My question is whether it is possible to deploy Spark applications from inside a different pod instead of kubectl commands?
Say, from some data pipeline applications such as Apache NiFi or Streamsets.</p>

toerq
<p>Yes, you can create pod from inside another pod.</p>

<p>All you need is to create a <em>ServiceAcount</em> with appropriate <em>Role</em> that will allow creating pods and assign it to the pod so then you can authenticate to kubernetes api server using rest api or one of k8s client libraries to create you pod.</p>

<p>Read more how to do it using <a href="https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/" rel="nofollow noreferrer">kubernetes api</a>
in kubernetes documentation.</p>

<p>Also read <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/" rel="nofollow noreferrer">here</a> on how to create roles.</p>

<p>And take a look <a href="https://kubernetes.io/docs/reference/using-api/client-libraries/" rel="nofollow noreferrer">here</a> for list of k8s client libraries.</p>

<p>Let me know if it was helpful.</p>
