woodpecker/docs/versioned_docs/version-1.0/30-administration/22-backends/40-kubernetes.md
6543 a83b0fcfd3
Drop deprecated built-in environment variables (#2048)
Drop:
 - `CI_BUILD_*`
 - `CI_PREV_BUILD_*`
 - `CI_JOB_*`
 - `*_LINK`
 - `CI_SYSTEM_ARCH`
 - `CI_REPO_REMOTE`
2023-07-28 14:58:20 +02:00

2.9 KiB

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