Cluster VIP is inaccessible due to TKGm cluster certificate expiration
3.2
TCA supports automatic certificate renewal for both Kubernetes management cluster and v2 workload clusters. However, in some cases, it may be required to manually renew the cluster certificates and/or kubeconfig stored in the TCA database.
Query the Kubernetes Cluster Control Plane node for the status and expiration date of the Kubernetes Cluster certificates:
SSH to the Control Plane node of the CaaS Cluster and switch to the sudo user:
ssh capv@K8S-CONTROL-PLANE-IP
sudo -i
Check if certificates are expired:
kubeadm certs check-expiration
Another verification point is to login to each TCA-CP Appliance Management UI and looking at the status of the Kubernetes Clusters registered within TCA-CP:
SSH into the TCA-CP as admin where corresponding management cluster is deployed.
Untar the cluster-cert-renew-TCA3.2.tar.gz tar ball:
tar -zxvf cluster-cert-renew-TCA3.2.tar.gz
Renew the workload cluster certificate:
cd /home/admin/cluster-cert-renewbash cert-renew -wc workload-cluster-name -mc mgmt-cluster-name -t workload
Note: Replace workload-cluster-name and mgmt-cluster-name with the actual values in the command provided.
Verify the new workload cluster certificate has been stored on management cluster:
kubectl config use-context mgmt-cluster-name-admin@mgmt-cluster-name
kubectl get secret workloadcluster-name-kubeconfig -n workloadcluster-name -ojsonpath='{.data.value}' | base64 -d
mgmt-cluster-name-admin, mgmt-cluster-name and workloadcluster-name with the actual values in the command provided.SSH into the TCA-CP as admin where corresponding management cluster is deployed.
Download the attached cluster-cert-renew-TCA3.2.tar.gz script file.
Untar the cluster-cert-renew-TCA3.2.tar.gz tar ball and change to the cluster-cert-renew directory:
tar -zxvf cluster-cert-renew-TCA3.2.tar.gz
cd /home/admin/cluster-cert-renew
Identify the management cluster control plane node where kube-vip pod is scheduled.
ssh to each control plane node
sudo -icrictl ps | grep -i vipFrom TCA CP renew the management cluster certificate using the control plane node ip identified above.
bash cert-renew -mc mgmt-cluster-name -t management -ip control-plane-node-ip
Note: This can take several minutes to complete.
Note: All (upgraded and non-upgraded) Clusters require the kubeconfig to be synchronized.
Note: Steps 1 through 4 should only be applied to TCA-M and not TCA-CP.
To generate an authentication token on TCA 3.2, you must POST the following API call from a seperate Linux VM that has access to the TCA-M:
curl -D - --location --insecure --request POST 'https://tca-m-url/hybridity/api/sessions' --header 'Accept: application/json' --header 'Content-Type: text/plain' --data-raw '{"username": "username","password": "plain_text_password"}'Note:
Replace tca-m-url, username and plain_text_password with the actual values in the command provided.
Take note of the x-hm-authorization UUID from the output of the previous step.
Update the TCA-M and TCA-CP database by synchronizing the kubeconfig:
curl --location --insecure --request POST 'https://tca-m-fqdn/telco/api/caas/v2/clusters/cluster_name/syncKubeconfig' --header 'Accept: application/json' --header 'Content-Type: application/json' --header 'x-hm-authorization: auth-token'
Note: Replace tca-m-fqdn, cluster_name and auth-token with the actual values in the command provided.
Note: The operation can take several minutes.
To ensure that the operation is succeeded, run the following API call:
curl --location --insecure --request GET 'https://tca-m-fqdn/hybridity/api/jobs/job_id_from_above_response' --header 'Accept: application/json' --header 'x-hm-authorization: auth-token'
Note: Replace tca-m-fqdn, auth-token and job_id_from_above_response with the actual values in the command provided.
Note: Take note of the isDone and didFail flags in the json. The isDone flag should return true and the didFail flag should return false.
SSH login to TCA-CP to restart the services:
ssh admin@tca-cp
Note: tca-cp where the cluster is configured
Restart tca-app service on tca-cp :
kubectl rollout restart deployment tca-app -n tca-cp-cn
Note: In case of multiple TCA-CPs (i.e one for mgmt cluster & one for workload cluster) the app service should be started from both.