Cluster management project (alpha)

CAUTION: Warning: This is an alpha feature, and it is subject to change at any time without prior notice.

Introduced in GitLab 12.5

A project can be designated as the management project for a cluster. A management project can be used to run deployment jobs with Kubernetes cluster-admin privileges.

This can be useful for:

Permissions

Only the management project will receive cluster-admin privileges. All other projects will continue to receive namespace scoped edit level privileges.

Management projects are restricted to the following:

Usage

To use a cluster management project for a cluster:

  1. Select the project.
  2. Configure your pipelines.
  3. Set an environment scope.

Selecting a cluster management project

To select a cluster management project to use:

  1. Navigate to the appropriate configuration page. For a:
  2. Project-level cluster, navigate to your project's Operations > Kubernetes page.
  3. Group-level cluster, navigate to your group's Kubernetes page.
  4. Select the project using Cluster management project field in the Advanced settings section.

Selecting a cluster management project under Advanced settings

Configuring your pipeline

After designating a project as the management project for the cluster, write a .gitlab-ci.yml in that project. For example:

configure cluster:
  stage: deploy
  script: kubectl get namespaces
  environment:
    name: production

Setting the environment scope (PREMIUM)

Environment scopes are usable when associating multiple clusters to the same management project.

Each scope can only be used by a single cluster for a management project.

For example, let's say the following Kubernetes clusters are associated to a management project:

Cluster Environment scope
Development *
Staging staging
Production production

The following environments set in .gitlab-ci.yml will deploy to the Development, Staging, and Production cluster respectively.

stages:
- deploy

configure development cluster:
  stage: deploy
  script: kubectl get namespaces
  environment:
    name: development

configure staging cluster:
  stage: deploy
  script: kubectl get namespaces
  environment:
    name: staging

configure production cluster:
  stage: deploy
  script: kubectl get namespaces
  environment:
    name: production