Destroying the cluster

The appendix is almost finished, and we do not need the cluster anymore. We want to destroy it as soon as possible. There's no good reason to keep it running when we're not using it. But, before we proceed with the destructive actions, we'll create a file that will hold all the environment variables we used in this chapter. That will help us the next time we want to recreate the cluster.

 1  echo "export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
 2  export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
 3  export AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
 4  export ZONES=$ZONES
 5  export NAME=$NAME" 
 6      >kops

We echoed the variables with the values into the kops file, and now we can delete the cluster.

 1  kops delete cluster 
 2      --name $NAME 
 3      --yes

The output is as follows.

...
Deleted kubectl config for devops23.k8s.local
Deleted cluster: "devops23.k8s.local"

Kops removed references of the cluster from our kubectl configuration and proceeded to delete all the AWS resources it created. Our cluster is no more. We can proceed and delete the S3 bucket as well.

 1  aws s3api delete-bucket 
 2      --bucket $BUCKET_NAME
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.161.188