- Build the new Kubernetes control plane template:
- move to the
packer
directory - run packer:
packer build -var-file vars.hcl exoscale-kube-controlplane.pkr.hcl
- grab the template ID from the output:
--> exoscale.base: Kubernetes 1.24.1 control plane @ de-fra-1 (b8f9c7ea-054f-45d6-951e-c6d921dafb0c)
- Update the Kubernetes control plane instance-pool:
- Update the value for
platform_components.kubernetes.templates.control_plane
in yourlocals.tf
file with the template ID from step 1. Keep the older value for the cleanup step - move to the
terraform-kubernetes
directory - run
terraform apply
, this should update the instance-pool template ID
- With
exo
CLI, or by other means, get the list of current instances. These instances are using the old template:exo compute instance list |grep kube # 【output】 # | e7678152-d7a5-4b0e-9a5e-65665b9bebee | paas-staging-kubernetes-4976a-iznkw | de-fra-1 | standard.tiny | 89.145.161.16 | running | # | 0e30ea46-477c-4025-8044-e20c09c9caa6 | paas-staging-kubernetes-4976a-imfbp | de-fra-1 | standard.tiny | 89.145.161.6 | running |
- Stop the API-server service on an instance:
- Move to the
artifacts
directory - Connect to the instance (
ssh -i id_ed25519 [email protected]
) - Stop the nginx service (
sudo systemctl stop nginx
) - Disconnect (
exit
orlogout
)
- Move to the
- Ensure the apiserver traffic is now handled by another node:
- Move to the
artifacts
directory - Run
export KUBECONFIG=./admin.kubeconfig
- Run
kubectl get nodes
to ensure the api server is still available from the failover node
- Move to the
- With
exo
CLI, or by other means, delete the instance.exo compute instance delete paas-staging-kubernetes-4976a-iznkw # 【output】 # [+] Are you sure you want to delete instance "paas-staging-kubernetes-4976a-iznkw"? [yN]: y # ✔ Deleting instance "paas-staging-kubernetes-4976a-iznkw"... 12s
- A new instance will be automatically created to replace the one you just deleted:
- Wait for the new instance to be running and reachable through SSH.
- Copy this new instance's hostname for later
- Connect to the instance and ensure every services are running correctly, in particular:
kube-scheduler.service
exoscale-cloud-controller-manager.service
kube-apiserver.service
kube-controller-manager.service
kube-vault-agent.service
cluster-autoscaler.service
konnectivity.service
- Repeat operations from step 4 for other cluster members found in step 3.
- Delete the older template (value before the step 2 update) as it's not used anymore:
exo compute template delete -z de-fra-1 f229708b-ce5f-4cd4-a9fa-bd96c89c1a49 # 【output】 # [+] Are you sure you want to delete template f229708b-ce5f-4cd4-a9fa-bd96c89c1a49 ("Kubernetes 1.24.1 control plane")? [yN]: y # ✔ Deleting template f229708b-ce5f-4cd4-a9fa-bd96c89c1a49... 3s
At least one instance of Konnectivity agent needs to connect directly to a Konnectivity server which is hosted on each control-plane node.
This means once you remove a control plane node, Konnectivity agent cannot connect anymore to it.
To solve this issue, you have to go to the terraform-kubernete
directory and run terraform apply
again in order to update core deployments parameters (that include api-server direct ip addresses).