Kubernetes Driver
Selecting the kubernetes driver adds the following options to the providers section of the configuration.
-
providers.[kubernetes]
Type: list A Kubernetes provider’s resources are partitioned into groups called pools (see providers.[kubernetes].pools for details), and within a pool, the node types which are to be made available are listed (see providers.[kubernetes].pools.labels for details).
Note
For documentation purposes the option names are prefixed
providers.[kubernetes]
to disambiguate from other drivers, but[kubernetes]
is not required in the configuration (e.g. belowproviders.[kubernetes].pools
refers to thepools
key in theproviders
section when thekubernetes
driver is selected).Example:
providers: - name: kubespray driver: kubernetes context: admin-cluster.local pools: - name: main labels: - name: kubernetes-namespace type: namespace - name: pod-fedora type: pod image: docker.io/fedora:28
-
providers.[kubernetes].context
Name of the context configured in
kube/config
.Before using the driver, Nodepool either needs a
kube/config
file installed with a cluster admin context, in which case this setting is required, or if Nodepool is running inside Kubernetes, this setting and thekube/config
file may be omitted and Nodepool will use a service account loaded from the in-cluster configuration path.
-
providers.[kubernetes].launch-retries
Default:3
The number of times to retry launching a node before considering the job failed.
-
providers.[kubernetes].max-cores
Default:unlimited
Type: int Maximum number of cores usable from this provider’s pools by default. This can be used to limit usage of the kubernetes backend. If not defined nodepool can use all cores up to the limit of the backend.
-
providers.[kubernetes].max-servers
Default:unlimited
Type: int Maximum number of pods spawnable from this provider’s pools by default. This can be used to limit the number of pods. If not defined nodepool can create as many servers the kubernetes backend allows.
-
providers.[kubernetes].max-ram
Default:unlimited
Type: int Maximum ram usable from this provider’s pools by default. This can be used to limit the amount of ram allocated by nodepool. If not defined nodepool can use as much ram as the kubernetes backend allows.
-
providers.[kubernetes].max-resources
Default:unlimited
Type: dict A dictionary of other quota resource limits applicable to this provider’s pools by default. Arbitrary limits may be supplied with the providers.[kubernetes].pools.labels.extra-resources attribute.
-
providers.[kubernetes].pools
Type: list A pool defines a group of resources from a Kubernetes provider.
-
providers.[kubernetes].pools.name (required)
Namespaces are prefixed with the pool’s name.
-
providers.[kubernetes].pools.priority
Default:100
Type: int The priority of this provider pool (a lesser number is a higher priority). Nodepool launchers will yield requests to other provider pools with a higher priority as long as they are not paused. This means that in general, higher priority pools will reach quota first before lower priority pools begin to be used.
This setting may be specified at the provider level in order to apply to all pools within that provider, or it can be overridden here for a specific pool.
-
providers.[kubernetes].pools.node-attributes
Type: dict A dictionary of key-value pairs that will be stored with the node data in ZooKeeper. The keys and values can be any arbitrary string.
-
providers.[kubernetes].pools.max-cores
Type: int Maximum number of cores usable from this pool. This can be used to limit usage of the kubernetes backend. If not defined nodepool can use all cores up to the limit of the backend.
-
providers.[kubernetes].pools.max-servers
Type: int Maximum number of pods spawnable from this pool. This can be used to limit the number of pods. If not defined nodepool can create as many servers the kubernetes backend allows.
-
providers.[kubernetes].pools.max-ram
Type: int Maximum ram usable from this pool. This can be used to limit the amount of ram allocated by nodepool. If not defined nodepool can use as much ram as the kubernetes backend allows.
-
providers.[kubernetes].pools.max-resources
Default:unlimited
Type: dict A dictionary of other quota resource limits applicable to this pool. Arbitrary limits may be supplied with the providers.[kubernetes].pools.labels.extra-resources attribute.
-
providers.[kubernetes].pools.default-label-cpu
Type: int Only used by the pod label type; specifies specifies a default value for providers.[kubernetes].pools.labels.cpu for all labels of this pool that do not set their own value.
-
providers.[kubernetes].pools.default-label-memory
Type: int Only used by the pod label type; specifies a default value in MiB for providers.[kubernetes].pools.labels.memory for all labels of this pool that do not set their own value.
-
providers.[kubernetes].pools.default-label-storage
Type: int Only used by the pod label type; specifies a default value in MB for providers.[kubernetes].pools.labels.storage for all labels of this pool that do not set their own value.
-
providers.[kubernetes].pools.default-label-extra-resources
Type: dict Only used by the pod label type; specifies default values for providers.[kubernetes].pools.labels.extra-resources for all labels of this pool that do not set their own value.
-
providers.[kubernetes].pools.default-label-cpu-limit
Type: int Only used by the pod label type; specifies specifies a default value for providers.[kubernetes].pools.labels.cpu-limit for all labels of this pool that do not set their own value.
-
providers.[kubernetes].pools.default-label-memory-limit
Type: int Only used by the pod label type; specifies a default value in MiB for providers.[kubernetes].pools.labels.memory-limit for all labels of this pool that do not set their own value.
-
providers.[kubernetes].pools.default-label-storage-limit
Type: int Only used by the pod label type; specifies a default value in MB for providers.[kubernetes].pools.labels.storage-limit for all labels of this pool that do not set their own value.
-
providers.[kubernetes].pools.labels
Type: list Each entry in a pool`s labels section indicates that the corresponding label is available for use in this pool.
Each entry is a dictionary with the following keys
-
providers.[kubernetes].pools.labels.name (required)
Identifier for this label; references an entry in the labels section.
-
providers.[kubernetes].pools.labels.type
The Kubernetes provider supports two types of labels:
- namespace
Namespace labels provide an empty namespace configured with a service account that can create pods, services, configmaps, etc.
- pod
Pod labels provide a dedicated namespace with a single pod created using the providers.[kubernetes].pools.labels.image parameter and it is configured with a service account that can exec and get the logs of the pod.
-
providers.[kubernetes].pools.labels.image
Only used by the pod label type; specifies the image name used by the pod.
-
providers.[kubernetes].pools.labels.image-pull
Default:IfNotPresent
Type: str The ImagePullPolicy, can be IfNotPresent, Always or Never.
-
providers.[kubernetes].pools.labels.labels
Type: dict A dictionary of additional values to be added to the namespace or pod metadata. The value of this field is added to the metadata.labels field in Kubernetes. Note that this field contains arbitrary key/value pairs and is unrelated to the concept of labels in Nodepool.
-
providers.[kubernetes].pools.labels.dynamic-labels
Default:None
Type: dict Similar to providers.[kubernetes].pools.labels.labels, but is interpreted as a format string with the following values available:
request: Information about the request which prompted the creation of this node (note that the node may ultimately be used for a different request and in that case this information will not be updated).
id: The request ID.
labels: The list of labels in the request.
requestor: The name of the requestor.
requestor_data: Key/value information from the requestor.
relative_priority: The relative priority of the request.
event_id: The external event ID of the request.
created_time: The creation time of the request.
tenant_name: The name of the tenant associated with the request.
For example:
labels: - name: pod-fedora dynamic-labels: request_info: "{request.id}"
-
providers.[kubernetes].pools.labels.annotations
Type: dict A dictionary of additional values to be added to the pod metadata. The value of this field is added to the metadata.annotations field in Kubernetes. This field contains arbitrary key/value pairs that can be accessed by tools and libraries. E.g custom schedulers can make use of this metadata.
-
providers.[kubernetes].pools.labels.python-path
Default:auto
Type: str The path of the default python interpreter. Used by Zuul to set
ansible_python_interpreter
. The special valueauto
will direct Zuul to use inbuilt Ansible logic to select the interpreter on Ansible >=2.8, and default to/usr/bin/python2
for earlier versions.
-
providers.[kubernetes].pools.labels.shell-type
Default:sh
Type: str The shell type of the node’s default shell executable. Used by Zuul to set
ansible_shell_type
. This setting should only be usedFor a windows pod with the experimental connection-type
ssh
, in which casecmd
orpowershell
should be set and reflect the node’sDefaultShell
configuration.If the default shell is not Bourne compatible (sh), but instead e.g.
csh
orfish
, and the user is aware that there is a long-standing issue withansible_shell_type
in combination withbecome
-
providers.[kubernetes].pools.labels.cpu
Type: int Only used by the pod label type; specifies the number of cpu to request for the pod. If no limit is specified, this will also be used as the limit.
-
providers.[kubernetes].pools.labels.memory
Type: int Only used by the pod label type; specifies the amount of memory in MiB to request for the pod. If no limit is specified, this will also be used as the limit.
-
providers.[kubernetes].pools.labels.storage
Type: int Only used by the pod label type; specifies the amount of ephemeral-storage in MB to request for the pod. If no limit is specified, this will also be used as the limit.
-
providers.[kubernetes].pools.labels.extra-resources
Type: dict Only used by the pod label type; specifies any extra resources that Nodepool should consider in its quota calculation other than the resources described above (cpu, memory, storage).
-
providers.[kubernetes].pools.labels.cpu-limit
Type: int Only used by the pod label type; specifies the cpu limit for the pod.
-
providers.[kubernetes].pools.labels.memory-limit
Type: int Only used by the pod label type; specifies the memory limit in MiB for the pod.
-
providers.[kubernetes].pools.labels.storage-limit
Type: int Only used by the pod label type; specifies the ephemeral-storage limit in MB for the pod.
-
providers.[kubernetes].pools.labels.gpu
Type: float Only used by the pod label type; specifies the amount of gpu allocated to the pod. This will be used to set both requests and limits to the same value, based on how kubernetes assigns gpu resources: https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/.
-
providers.[kubernetes].pools.labels.gpu-resource
Type: str Only used by the pod label type; specifies the custom schedulable resource associated with the installed gpu that is available in the cluster.
-
providers.[kubernetes].pools.labels.env
Default:[]
Type: list Only used by the pod label type; A list of environment variables to pass to the Pod.
-
providers.[kubernetes].pools.labels.env.name (required)
Type: str The name of the environment variable passed to the Pod.
-
providers.[kubernetes].pools.labels.env.value (required)
Type: str The value of the environment variable passed to the Pod.
-
providers.[kubernetes].pools.labels.env.name (required)
-
providers.[kubernetes].pools.labels.node-selector
Type: dict Only used by the pod label type; A map of key-value pairs to ensure the Kubernetes scheduler places the Pod on a node with specific node labels.
-
providers.[kubernetes].pools.labels.scheduler-name
Type: str Only used by the pod label type. Sets the schedulerName field on the container. Normally left unset for the Kubernetes default.
-
providers.[kubernetes].pools.labels.privileged
Type: bool Only used by the pod label type. Sets the securityContext.privileged flag on the container. Normally left unset for the Kubernetes default.
-
providers.[kubernetes].pools.labels.name (required)
-
providers.[kubernetes].pools.name (required)
-
providers.[kubernetes].context