Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-22648][K8s] Add documentation covering init containers and secrets #20059

Closed
wants to merge 7 commits into from
Closed

[SPARK-22648][K8s] Add documentation covering init containers and secrets #20059

wants to merge 7 commits into from

Conversation

liyinan926
Copy link
Contributor

What changes were proposed in this pull request?

This PR updates the Kubernetes documentation corresponding to the following features/changes in #19954.

  • Ability to use remote dependencies through the init-container.
  • Ability to mount user-specified secrets into the driver and executor pods.

@vanzin @jiangxb1987 @foxish

Copy link
Contributor

@foxish foxish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @liyinan926. Left some comments, PTAL. Reviewers - the documentation is for the as-yet unmerged PR #19954. PTAL.

<td>
Add the secret named <code>SecretName</code> to the executor pod on the path specified in the value. For example,
<code>spark.kubernetes.executor.secrets.spark-secret=/etc/secrets</code>. Note that if an init-container is used,
the secret will also be add to the init-container in the executor pod.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/add/added/

<td><code>spark.kubernetes.mountDependencies.mountTimeout</code></td>
<td>5 minutes</td>
<td>
Timeout before aborting the attempt to download and unpack dependencies from remote locations when initializing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be more precise on what operation is happening.
"initializing" -> "when downloading and unpacking dependencies into"

<td><code>spark.kubernetes.driver.secrets.[SecretName]</code></td>
<td>(none)</td>
<td>
Add the secret named <code>SecretName</code> to the driver pod on the path specified in the value. For example,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

secret -> Kubernetes Secret
Please also link to the Kubernetes secrets docs page.

<td>
Add the secret named <code>SecretName</code> to the driver pod on the path specified in the value. For example,
<code>spark.kubernetes.driver.secrets.spark-secret=/etc/secrets</code>. Note that if an init-container is used,
the secret will also be add to the init-container in the driver pod.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/add/added/

<td><code>spark.kubernetes.initContainer.image</code></td>
<td>(none)</td>
<td>
Container image for the init-container of the driver and executors for downloading dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to init-container docs.

</td>
</tr>
<tr>
<td><code>spark.kubernetes.mountDependencies.mountTimeout</code></td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should rename this to mountDependencies.timeout to avoid reiterating "mount"

</td>
</tr>
<tr>
<td><code>spark.kubernetes.initContainer.maxThreadPoolSize</code></td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this option name needs fixing. Maybe spark.kubernetes.mountDependencies.maxThreadPoolSize?

@liyinan926
Copy link
Contributor Author

@foxish addressed your comments.

Copy link
Contributor

@foxish foxish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing those. Sorry, missed a couple of minor ones.

@@ -120,6 +120,23 @@ by their appropriate remote URIs. Also, application dependencies can be pre-moun
Those dependencies can be added to the classpath by referencing them with `local://` URIs and/or setting the
`SPARK_EXTRA_CLASSPATH` environment variable in your Dockerfiles.

### Using Remote Dependencies
When there are application dependencies hosted in remote locations like HDFS or HTTP servers, the driver and executor pods need a Kubernetes [init-container](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) for downloading the dependencies so the driver and executor containers can use them locally. This requires users to specify the container image for the init-container using the configuration property `spark.kubernetes.initContainer.image`. For example, users simply add the following option to the `spark-submit` command to specify the init-container image:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and below text should be broken up into multiple lines.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should include 2-3 examples of remote file usage - ideally, showing that one can use http, hdfs, gcs, s3 in dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to break them into lines? I thought this should be automatically wrapped when being viewed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding examples, I can add one spark-submit example showing how to use remote jars/files on http/https and hdfs. But gcs requires the connector in the init-container, which is non-trivial. I'm not sure about s3. I think we should avoid doing so.

Copy link
Contributor

@foxish foxish Dec 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HDFS or HTTP sound good. We can cover GCS elsewhere. Line breaks were for ease of reviewing by others (being able to comment on individual lines) and for consistency with the rest of the docs.

@liyinan926
Copy link
Contributor Author

Updated in fbb2112.

Copy link
Contributor

@vanzin vanzin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok. Can you use "k8s" to save space in the PR title? And also make it self-contained instead of referencing another PR?

e.g.

"Add documentation covering init containers and secrets."

```

## Secret Management
In some cases, a Spark application may need to use some credentials, e.g., for accessing data on a secured HDFS cluster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rewrite this.

"Kubernetes Secrets can be used to provide credentials for a Spark application to access secured services. To mount secrets into a driver container, ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

<td><code>spark.kubernetes.mountDependencies.maxThreadPoolSize</code></td>
<td>5</td>
<td>
Maximum size of the thread pool for downloading remote dependencies into the driver and executor pods.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd clarify this controls how many downloads happen simultaneously; could even change the name of the config to reflect that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@liyinan926 liyinan926 changed the title [SPARK-22648][Kubernetes] Update documentation to cover features in #19954 [SPARK-22648][K8s] Add documentation covering init containers and secrets Dec 23, 2017
@SparkQA
Copy link

SparkQA commented Dec 23, 2017

Test build #85321 has finished for PR 20059 at commit c0a659a.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Dec 23, 2017

Test build #85323 has finished for PR 20059 at commit a6a6660.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Dec 23, 2017

Test build #85325 has finished for PR 20059 at commit fbb2112.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Dec 23, 2017

Test build #85331 has finished for PR 20059 at commit f23bf0f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Dec 25, 2017

Test build #85385 has finished for PR 20059 at commit 818abaf.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Contributor

@jiangxb1987 jiangxb1987 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly LGTM

</tr>
<tr>
<td><code>spark.kubernetes.executor.secrets.[SecretName]</code></td>
<td>5</td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the meaning of 5 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, copy and paste error. Fixed.

@SparkQA
Copy link

SparkQA commented Dec 26, 2017

Test build #85411 has finished for PR 20059 at commit 08486e8.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

--files hdfs://host:port/path/to/file1,hdfs://host:port/path/to/file2
--conf spark.executor.instances=5 \
--conf spark.kubernetes.driver.docker.image=<driver-image> \
--conf spark.kubernetes.executor.docker.image=<executor-image> \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

container.image instead of docker.image. We need to modify line 79-80 as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

</tr>
<tr>
<td><code>spark.kubernetes.mountDependencies.timeout</code></td>
<td>300 seconds</td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

300s instead of 300 seconds, which should be the form we can specify to the config string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@SparkQA
Copy link

SparkQA commented Dec 27, 2017

Test build #85428 has finished for PR 20059 at commit f4b5c03.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jiangxb1987
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Dec 27, 2017

Test build #85431 has finished for PR 20059 at commit f4b5c03.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Dec 27, 2017

Test build #85440 has finished for PR 20059 at commit 453a3db.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@ueshin
Copy link
Member

ueshin commented Dec 28, 2017

Thanks! merging to master.

@asfgit asfgit closed this in ded6d27 Dec 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants