Delete a Cluster
Last updated
Last updated
The Cluster Deletion process is a highly sensitive and irreversible operation that results in the complete removal of all resources associated with an Amazon EKS cluster. It is critical to fully understand the implications of this action, as it will permanently erase infrastructure and configurations within your AWS environment, and there is no way to recover these resources once the process is initiated.
This document outlines the steps involved, the permissions required, and the consequences of executing the cluster deletion. Please read this carefully before proceeding, as the consequences of an irreversible deletion are severe.
To prevent accidental deletion and ensure proper authorization, only certain individuals can trigger the cluster deletion process:
Workspace Owner: The primary individual responsible for the workspace. The workspace owner has full permissions, including the ability to delete clusters within their workspace.
Super Admin: The super admin holds the highest level of administrative privileges across the system and can delete clusters within any workspace, regardless of ownership.
Important Note: Users within the workspace (non-owner) do not have the permissions to delete clusters. Only the workspace owner and the super admin can perform this action.
IMPORTANT: Cluster deletion is irreversible.
Once you initiate the cluster deletion process, the following actions will take place, and they cannot be undone:
AWS Infrastructure Deletion:
All resources tied to the EKS cluster within your AWS account will be destroyed. This includes EC2 instances, VPCs, S3 buckets, IAM roles, and more.
Any associated cloud infrastructure that the cluster relies on will also be completely erased, including networking configurations and security groups.
Removal of Installed Add-ons:
All add-ons (e.g., monitoring, alerting, cost management, security add-ons) that were installed for the cluster will be removed.
This also includes any application-specific services or software that were deployed for the functioning of the cluster.
Terraform Files and State:
The GitHub repository that contains the Terraform configuration files used to create and manage the cluster will be deleted.
The Terraform state file (.tfstate), which tracks the state of the infrastructure, will also be permanently deleted from the S3 bucket.
The kubeconfig file, essential for interacting with the Kubernetes cluster, will be destroyed, rendering further access to the cluster impossible.
Namespace, CNAME, and Ingress:
All Kubernetes namespaces, CNAME records, and ingress configurations associated with the cluster will be deleted. This will prevent access to any applications deployed on the cluster.
Any custom ingress rules for routing traffic to applications will be permanently erased.
Resource and Application Data:
Any data or resources that are currently running in the cluster will be destroyed. This includes application logs, configurations, secrets, and other runtime data associated with your services.
Add-ons for Monitoring, Security, and Cost Management:
All add-on applications (used for monitoring, alerting, cost management, and security) will be removed, impacting visibility, security posture, and the ability to manage costs and resources effectively.
Once the deletion process begins, there is no way to reverse it. All infrastructure, configurations, and data tied to the EKS cluster will be permanently lost.
Backup Considerations: It is strongly recommended that you backup any critical data that may be required for future use or to re-create your cluster. This includes but is not limited to:
Terraform configurations.
Cluster-specific application data (such as databases or logs).
Kubernetes configurations that may need to be reused or redeployed.
Audit Logging: To maintain traceability and ensure compliance, it is essential that all actions taken during this process are logged for auditing purposes. This can help in the event of accidental deletions or misconfigurations.
The deletion process follows these crucial steps:
1. Cloning the Chart Repo
The first step is to clone the Terraform chart repository that defines the configuration of the cluster. This step ensures that any necessary information can be reviewed before proceeding with the deletion.
2. Fetching .tfstate File
The Terraform state file (.tfstate) is retrieved from the designated S3 bucket. This file tracks all the resources associated with the EKS cluster and is essential for Terraform’s ability to manage infrastructure.
3. Removing Ingress
Any ingress resources configured for the cluster are removed to ensure that no external access remains to any applications or services running on the cluster.
4. Initializing Terraform
Terraform is initialized by running terraform init
. This ensures that all the necessary provider configurations are set up for Terraform to carry out the destruction of resources.
5. Terraform Destroy
The terraform destroy
command is executed. This will terminate all the resources defined in the Terraform configuration files, including the entire EKS cluster and all associated services.
6. Delete TF State
After the destruction of resources, the .tfstate file is deleted from the S3 bucket, ensuring that no state is retained for the deleted cluster.
7. Delete Repository
The GitHub repository that contains the Terraform configuration and state files will be deleted. This action ensures that all references to the cluster’s infrastructure code are removed.
8. Cleaning Up Workflow Data
All associated workflow data and temporary runtime storage used during the deletion process are cleared, ensuring that no extraneous information is left behind.
Double-Check Before Deletion: Given the high impact of this action, we strongly advise that you double-check the resources that will be affected. Ensure that no important data is left unbacked up and that no critical services will be disrupted.
Involve Relevant Stakeholders: Notify all relevant stakeholders, such as DevOps teams, security teams, and application owners, about the impending deletion to ensure that all necessary precautions are taken.
The Cluster Deletion process is a powerful tool for managing your Kubernetes clusters, but it comes with significant risks. Please ensure that only authorized personnel proceed with this action, and that all relevant data and resources are backed up and reviewed beforehand. Deleting a cluster is an irreversible process that will permanently erase all associated resources, and it should only be done after careful consideration.