4.4 KiB
stage | group | info |
---|---|---|
Configure | Configure | To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments |
Migrate to the GitLab Agent for Kubernetes (FREE)
The first integration between GitLab and Kubernetes used cluster certificates to connect the cluster to GitLab. This method was deprecated in GitLab 14.5 in favor of the GitLab Agent for Kubernetes.
To make sure your clusters connected to GitLab do not break in the future, we recommend you migrate to the GitLab Agent as soon as possible by following the processes described in this document.
The certificate-based integration was used for some popular GitLab features such as, GitLab Managed Apps, GitLab-managed clusters, and Auto DevOps.
As a general rule, migrating clusters that rely on GitLab CI/CD can be achieved using the CI/CD Tunnel provided by the Agent.
NOTE: The GitLab Agent for Kubernetes does not intend to provide feature parity with the certificate-based cluster integrations. As a result, the Agent doesn't support all the features available to clusters connected through certificates.
Migrate cluster application deployments
Migrate from GitLab-managed clusters
With GitLab-managed clusters, GitLab creates separate service accounts and namespaces for every branch and deploys using these resources.
To achieve a similar result with the GitLab Agent, you can use impersonation strategies to deploy to your cluster with restricted account access. To do so:
- Choose the impersonation strategy that suits your needs.
- Use Kubernetes RBAC rules to manage impersonated account permissions in Kubernetes.
- Use the
access_as
attribute in your Agent’s configuration file to define the impersonation.
Migrate from Auto DevOps
To configure your Auto DevOps project to use the GitLab Agent:
- Follow the steps to install an agent on your cluster.
- Go to the project in which you use Auto DevOps.
- From the sidebar, select Settings > CI/CD and expand Variables.
- Select Add new variable.
- Add
KUBE_CONTEXT
as the key,path/to/agent/project:agent-name
as the value, and select the environment scope of your choice. - Select Add variable.
- Repeat the process to add another variable,
KUBE_NAMESPACE
, setting the value for the Kubernetes namespace you want your deployments to target, and set the same environment scope from the previous step. - From the sidebar, select Infrastructure > Kubernetes clusters.
- From the certificate-based clusters section, open the cluster that serves the same environment scope.
- Select the Details tab and disable the cluster.
- To activate the changes, from the project's sidebar, select CI/CD > Variables > Run pipeline.
Migrate generic deployments
When you use Kubernetes contexts to reach the cluster from GitLab, you can use the CI/CD Tunnel directly. It injects the available contexts into your CI environment automatically:
-
Follow the steps to install an agent on your cluster.
-
Go to the project in which you use Auto DevOps.
-
From the sidebar, select Settings > CI/CD and expand Variables.
-
Select Add new variable.
-
Add
KUBE_CONTEXT
as the key,path/to/agent-configuration-project:your-agent-name
as the value, and select the environment scope of your choice. -
Edit your
.gitlab-ci.yml
file and set the Kubernetes context to theKUBE_CONTEXT
you defined in the previous step:<your job name>: script: - kubectl config use-context $KUBE_CONTEXT
Migrate from GitLab Managed Applications
Follow the process to migrate from GitLab Managed Apps to the Cluster Management Project.
Migrating a Cluster Management project
See how to use a cluster management project with the GitLab Agent.
Migrate cluster monitoring features
Cluster monitoring features are not supported by the GitLab Agent for Kubernetes yet.