Other Configuration Tasks
The base infrastructure and cluster configuration is managed by the docker-compose
tooling provided by CloudOps for Kubernetes. The following are some less-common tasks that can be completed using the docker-compose
tooling.
note
Perform the following steps on the operations workstation, ideally the workstation you used for the initial setup. For more information, see the Operations Workstation documentation.
Clean Up the Cluster
warning
This will destroy the Kubernetes cluster, Docker repositories and their images, DNS zones and other important infrastructure.
To clean up the CloudOps for Kubernetes cluster:
Checkout the version of CloudOps for Kubernetes currently in use.
Copy the
docker-compose.override.yml
file that you saved after completing the initial setup of the cluster or when last updating the cluster.Set the Docker Compose parameter
TF_VAR_bootstrap_mode
in thedocker-compose.override.yml
file tocleanup
.Run the following Docker Compose command to build the Docker image:
docker-compose build
Run the following Docker Compose command to clean up the cluster:
docker-compose up
Force Clean Up the Cluster
warning
The clean up action destroys the following assets:
- Kubernetes cluster
- Docker repositories
- Container images
- DNS zones
- Other important infrastructure
Force clean up will also attempt to destroy all existing Terraform workspaces.
warning
Do not use foce clean up mode if your AWS account contains other AWS infrastructure. Force clean up may impact or destroy AWS infrastructure not deployed or managed by CloudOps for Kubernetes.
Force clean up mode performs the following tasks:
- Empty all Simple Cloud Storage Service (S3) buckets in your account that follow the same bucket name.
- Empty all Dynamo Database (DynamoDB) tables in your account that follow the same table name.
- Delete non-attached Elastic Block Store (EBS) volumes in your account.
- Delete all Elastic Container Registry (ECR) repositories in your account.
- Delete all Domain Name Service (DNS) hosted zones in your account that match the domain name used in the
TF_VAR_domain variable
in yourdocker-compose.override.yaml
file. - Delete all Amazon Certificate Manager (ACM) certificates in your account that match the domain name that you use in the
TF_VAR_domain variable
in yourdocker-compose.override.yaml
file. - Delete all Ambassador-created AWS Application Load Balancers (ALB) and Ambassador-specific target groups and security groups.
- Delete all HAProxy AWS Network Load Balancers (NLB).
- Delete the Elastic File System (EFS) volume and related Security Groups for the
efs-provisioner
service.
This mode is especially useful when the cleanup bootstrap mode fails and there are Terraform state locks existing, and so on. :::
To clean up the CloudOps for Kubernetes cluster:
Checkout the version of CloudOps for Kubernetes currently in use.
Copy the
docker-compose.override.yml
file that you saved after completing the initial setup of the cluster or when you were last updating the cluster.Set the Docker Compose parameter
TF_VAR_bootstrap_mode
in thedocker-compose.override.yml
file toforce-cleanup
.Set the Docker Compose parameter
TF_VAR_approve_force_cleanup
in thedocker-compose.override.yml
file totrue
.Run the following Docker Compose command to build the Docker image and force-cleanup the existing cluster resources:
docker-compose up --build
Show the Current State of the Cluster
To show the current state of the CloudOps for Kubernetes cluster:
Checkout the version of CloudOps for Kubernetes currently in use.
Copy the
docker-compose.override.yml
file that you saved after completing the initial setup of the cluster or when you were last updating the cluster.Set the Docker Compose parameter
TF_VAR_bootstrap_mode
in thedocker-compose.override.yml
file toshow
.Run the following Docker Compose command to build the Docker image:
docker-compose build
Run the following Docker Compose command to show the current state of the cluster:
docker-compose up
Create Local Terraform Configuration
note
You may need to install dependencies before manipulating the CloudOps for Kubernetes Terraform state locally. You will also need to update the current context of Kubectl to the Kubernetes cluster created by the CloudOps for Kubernetes Docker image.
To create Terraform backend configuration files locally so you can locally manipulate the CloudOps for Kubernetes Terraform state:
Checkout the version of CloudOps for Kubernetes currently in use.
Copy the
docker-compose.override.yml
file that you saved after completing the initial setup of the cluster or when you were last updating the cluster.Set the Docker Compose parameter
TF_VAR_bootstrap_mode
in thedocker-compose.override.yml
file tocreate-terraform-files
.Update the volumes section of the Docker Compose configuration with the path to the CloudOps for Kubernetes code.
Run the following Docker Compose command to build the Docker image:
docker-compose build
Run the following Docker Compose command to create the Terraform backend configuration files locally:
docker-compose up
In the CloudOps for Kubernetes code, go to the
bootstrap/terraform/
folder:cd bootstrap/terraform
Initialize Terraform:
terraform init
note
If you have created Terraform configuration files previously for a different cluster, you may need to clean up any state left behind.
To manipulate the CloudOps for Kubernetes cluster, select the Terraform workspace bootstrap:
terraform workspace select bootstrap
Test your Terraform configuration by refreshing your Terraform state with the following command:
terraform refresh -var-file=bootstrap.tfvars