<p>I am writing a spark job which uses kubernetes instead of yarn.</p>

<pre><code>val spark = SparkSession.builder().appName("Demo").master(????).getOrCreate() 
</code></pre>

<p>So what should be my master, is it kubernetes or something else</p>

<p>Thanks</p>

<p>I should be in the format of <code>k8s://https://&lt;k8s-apiserver-host&gt;:&lt;k8s-apiserver-port&gt;</code></p>

<p><strong>From the Doc <a href="https://spark.apache.org/docs/latest/running-on-kubernetes.html" rel="nofollow noreferrer">here</a></strong></p>

<blockquote>
  <p>URL with the format k8s://. Prefixing the master
  string with k8s:// will cause the Spark application to launch on the
  Kubernetes cluster, with the API server being contacted at
  api_server_url. If no HTTP protocol is specified in the URL, it
  defaults to https. For example, setting the master to
  k8s://example.com:443 is equivalent to setting it to
  k8s://<a href="https://example.com:443" rel="nofollow noreferrer">https://example.com:443</a>, but to connect without TLS on a
  different port, the master would be set to
  k8s://<a href="http://example.com:8080" rel="nofollow noreferrer">http://example.com:8080</a>.</p>
</blockquote>
