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

[k8s][docs] Add containers example to pod_config example #3119

Merged
merged 5 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions docs/source/reference/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,28 @@ Available fields and semantics:
# in the Kubernetes API:
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#pod-v1-core
#
# Example use cases: adding custom labels to SkyPilot pods, specifying
# imagePullSecrets for pulling images from private registries, overriding
# the default runtimeClassName etc.
# Some example use cases are shown below. All fields are optional.
pod_config:
metadata:
labels:
my-label: my-value
my-label: my-value # Custom labels to SkyPilot pods
spec:
runtimeClassName: nvidia
runtimeClassName: nvidia # Custom runtimeClassName for GPU pods. Required on K3s.
imagePullSecrets:
- name: my-secret
- name: my-secret # Pull images from a private registry using a secret
containers:
- env: # Custom environment variables for the pod, e.g., for proxy
- name: HTTP_PROXY
value: http://proxy-host:3128
volumeMounts: # Custom volume mounts for the pod
- mountPath: /foo
name: example-volume
readOnly: true
volumes:
- name: example-volume
hostPath:
path: /tmp
type: Directory

# Advanced OCI configurations (optional).
oci:
Expand Down
19 changes: 19 additions & 0 deletions docs/source/reference/kubernetes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,25 @@ FAQs

For isolation, you can create separate Kubernetes namespaces and set them in the kubeconfig distributed to users. SkyPilot will use the namespace set in the kubeconfig for running all tasks.

* **How can I specify custom configuration for the pods created by SkyPilot?**

You can override the pod configuration used by SkyPilot by setting the :code:`pod_config` key in :code:`~/.sky/config.yaml`.
The value of :code:`pod_config` should be a dictionary that follows the `Kubernetes Pod API <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#pod-v1-core>`_.

For example, to set custom environment variables in the pod, you can add the following to your :code:`~/.sky/config.yaml` file:

.. code-block:: yaml

kubernetes:
pod_config:
spec:
containers:
- env:
- name: MY_ENV_VAR
value: MY_ENV_VALUE

For more details refer to :ref:`config-yaml`.

Features and Roadmap
--------------------

Expand Down
Loading