Configure Kubernetes deployments (deprecated)

Version history
caution
This feature was deprecated in GitLab 14.5.

If you are deploying to a Kubernetes cluster associated with your project, you can configure these deployments from your .gitlab-ci.yml file.

note
Kubernetes configuration isn’t supported for Kubernetes clusters managed by GitLab.

The following configuration options are supported:

In the following example, the job deploys your application to the production Kubernetes namespace.

deploy:
  stage: deploy
  script:
    - echo "Deploy to production server"
  environment:
    name: production
    url: https://example.com
    kubernetes:
      namespace: production
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

When you use the GitLab Kubernetes integration to deploy to a Kubernetes cluster, you can view cluster and namespace information. On the deployment job page, it’s displayed above the job trace:

Deployment cluster information

Configure incremental rollouts

Learn how to release production changes to only a portion of your Kubernetes pods with incremental rollouts.