The chapter 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.
echo "export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY export AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION export ZONES=$ZONES export NAME=$NAME export KOPS_STATE_STORE=$KOPS_STATE_STORE" \ >kops
We echoed the variables with the values into the kops file, and now we can delete the cluster:
kops delete cluster \ --name $NAME \ --yes
The output is as follows:
... Deleted kubectl config...