Skip to content

Latest commit

 

History

History
70 lines (43 loc) · 1.97 KB

destroy-provision-aks.md

File metadata and controls

70 lines (43 loc) · 1.97 KB

Destroy and provision Kubernetes cluster for development

To reduce development cost, every weekday night we destroy the kubernetes cluster and provision it again the next morning.

The following instructions are divided into:

Requirements

You should have installed the following tools

Setting up

Before either destroying or provisioning a kubernetes cluster, take these setup steps.

  1. Change to the relevant environment directory (e.g. infrastructure/environments/non-prod)

  2. Source the environment variables

      set -a && source .env && set +a
  3. Initialize terraform (ensure providers/modules are installed and backend is initialized)

      terraform init

Destroy cluster 💣

First, follow the setup steps above.

Destroying the cluster is now just one step:

  terraform destroy --target=module.cluster

This should give a nice message saying well done on a good destruction job: Destruction complete.

Provision cluster ⎈

First, follow the setup steps above.

  1. Provision cluster.

    terraform apply --target=module.cluster
  2. Update your ~/.kube/config with credentials for the new cluster, by running this script.

    ../../scripts/create-kubernetes-config.sh
  3. Install Istio, Sealed Secrets and ArgoCD (https://github.com/MHRA/deployments)

The cluster is now ready.

Deploying services

We are storing the configuration (manifests) for all the services in the cluster in the deployments repo (https://github.com/MHRA/deployments) so that they are provisioned using GitOps by ArgoCD.