Skip to main content
Version: 1.0.x ๐Ÿ’€

Kubernetes backend

caution

Kubernetes support is still experimental and not all pipeline features are fully supported yet.

Check the current state

The kubernetes backend executes each step inside a newly created pod. A PVC is also created for the lifetime of the pipeline, for transferring files between steps.

Configurationโ€‹

WOODPECKER_BACKEND_K8S_NAMESPACEโ€‹

Default: woodpecker

The namespace to create worker pods in.

WOODPECKER_BACKEND_K8S_VOLUME_SIZEโ€‹

Default: 10G

The volume size of the pipeline volume.

WOODPECKER_BACKEND_K8S_STORAGE_CLASSโ€‹

Default: empty

The storage class to use for the pipeline volume.

WOODPECKER_BACKEND_K8S_STORAGE_RWXโ€‹

Default: true

Determines if RWX should be used for the pipeline volume's access mode. If false, RWO is used instead.

WOODPECKER_BACKEND_K8S_POD_LABELSโ€‹

Default: empty

Additional labels to apply to worker pods. Must be a YAML object, e.g. {"example.com/test-label":"test-value"}.

WOODPECKER_BACKEND_K8S_POD_ANNOTATIONSโ€‹

Default: empty

Additional annotations to apply to worker pods. Must be a YAML object, e.g. {"example.com/test-annotation":"test-value"}.

Job specific configurationโ€‹

Resourcesโ€‹

The kubernetes backend also allows for specifying requests and limits on a per-step basic, most commonly for CPU and memory. See the kubernetes documentation for more information on using resources.

serviceAccountNameโ€‹

Specify the name of the ServiceAccount which the build pod will mount. This serviceAccount must be created externally. See the kubernetes documentation for more information on using serviceAccounts.

nodeSelectorโ€‹

Specify the label which is used to select the node where the job should be executed. Labels defined here will be appended to a list already containing "kubernetes.io/arch". By default the pod will use "kubernetes.io/arch" inferred from top-level "platform" setting which is deducted from the agents' environment variable CI_SYSTEM_PLATFORM. To overwrite this, you need to specify this label in the nodeSelector section. See the kubernetes documentation for more information on using nodeSelector.

Example pipeline configuration:

steps:
build:
image: golang
commands:
- go get
- go build
- go test
backend_options:
kubernetes:
serviceAccountName: 'my-service-account'
resources:
requests:
memory: 128Mi
cpu: 1000m
limits:
memory: 256Mi
nodeSelector:
beta.kubernetes.io/instance-type: p3.8xlarge