doc/user/project/clusters/add_remove_clusters.md
{{< details >}}
{{< /details >}}
{{< history >}}
{{< /history >}}
[!warning] This feature was deprecated in GitLab 14.0. To create and manage a new cluster use Infrastructure as Code.
When you successfully connect an existing cluster using cluster certificates, the cluster connection to GitLab becomes enabled. To disable it:
When you remove a cluster integration, you only remove the cluster relationship
to GitLab, not the cluster. To remove the cluster itself, go to your cluster's
GKE or EKS dashboard to do it from their UI or use kubectl.
You need at least Maintainer permissions to your project or group to remove the integration with GitLab.
When removing a cluster integration, you have two options:
To remove the Kubernetes cluster integration:
{{< details >}}
{{< /details >}}
Start a Rails console session.
To find a cluster:
cluster = Clusters::Cluster.find(1)
cluster = Clusters::Cluster.find_by(name: 'cluster_name')
To delete a cluster but not the associated resources:
# Find users who have administrator access
user = User.find_by(username: 'admin_user')
# Find the cluster with the ID
cluster = Clusters::Cluster.find(1)
# Delete the cluster
Clusters::DestroyService.new(user).execute(cluster)