NOTICE: werf supports building images with the Docker server or with Buildah. This page contains information applicable only to the mode with Buildah. Buildah supports building either Dockerfile images or stapel images.

1. Configure GitLab rinner for Kubernetes

Make sure you meet all system requirements and select one of the available operating modes (depending on the capabilities of your GitLab runner) and navigate to it.

Linux kernel with rootless OverlayFS

Basic runner configuration:

[[runners]]
  name = "docker-runner-for-werf"
  executor = "docker"
  ...
  [runners.docker]
    security_opt = ["seccomp:unconfined", "apparmor:unconfined"]
    ...

Linux kernel without rootless OverlayFS and privileged container

Basic runner configuration:

[[runners]]
  name = "docker-runner-for-werf"
  executor = "docker"
  ...
  [runners.docker]
    privileged = true
    ...

Linux kernel without rootless OverlayFS and non-privileged container

Basic runner configuration:

[[runners]]
  name = "docker-runner-for-werf"
  executor = "docker"
  ...
  [runners.docker]
    security_opt = ["seccomp:unconfined", "apparmor:unconfined"]
    devices = ["/dev/fuse"]
    ...

2. Configure access to the Kubernetes cluster

Assign the WERF_KUBECONFIG_BASE64 environment variable in the GitLab project a base64-encoded value from ~/.kube/config. werf will automatically use this configuration to connect to the Kubernetes cluster.

3. Configure gitlab-ci.yml of the project

Below is a basic build and deploy job for a project:

stages:
  - build-and-deploy

Build and deploy application:
  stage: build-and-deploy
  image: registry.werf.io/werf/werf
  script:
    - source $(werf ci-env gitlab --as-file)
    - werf converge
  tags: ["docker-runner-for-werf"]

Troubleshooting

In case of problems, refer to the Troubleshooting section