How to manually update kubeconfig/cluster configuration
search cancel

How to manually update kubeconfig/cluster configuration

book

Article ID: 345733

calendar_today

Updated On:

Products

VMware Telco Cloud Automation

Issue/Introduction

  • K8S VIMs are disconnected in TCA-M, or the status of a cluster is disconnected (indicated with a red dot) in TCA-CP Appliance Management portal (9443).
  • In TCA UI under partner system, Harbor is registered and connected Kubernetes cluster as VIM. In cluster Harbor add-on gets added successfully. But in partner system still it shows "Initiated", it should show "Enable".
  • CNF installations fail.
  • Attempts to create a new cluster results in the message: "Token has expired. Please login again."

Environment

2.x
3.x

Cause

  • The cluster config stored inside TCA-DB for the clusters has expired
  • The cluster certificates are renewed, but not synced with the TCA appliances.

Resolution

Manually update the kube-config/cluster configuration

  1. SSH to the management cluster with endpoint IP as the capv user.

  2. Get the kubeconfig secret content for the disconnected k8s cluster.

kubectl get secret <cluster name>-kubeconfig -n <cluster name> -ojsonpath="{.data.value}" | base64 -d

        3.Copy the above kubeconfig content

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: [base64 CA data]
    server: https://<cluster VIP>:6443
  name: <cluster name>
contexts:
- context:
    cluster: <cluster name>
    user: <cluster name>-admin
  name: <cluster name>-admin@<cluster name>
current-context: <cluster name>-admin@<cluster name>
kind: Config
preferences: {}
users:
- name: <cluster name>-admin
  user:
    client-certificate-data: [base64 client cert data]
    client-key-data: [base64 client key data]

        4. Copy the content of the output

       5.Go to the TCA-UI -> Virtual Infrastructure -> cluster.

       6.Click on the 'Edit' button.

       7.Update the Kubernetes Config with the secret content obtained from step 3.

       8.Click on 'Update'

    • This will set the VIM status to pending for about 30-40 seconds. It should return to the 'connected' status.

      9.Navigate to https://<TCA-CP_IP>:9443 in a browser

      10.Locate the cluster, edit and update the kube config file with the secret content obtained from step 3.

      11.Repeat steps 1 through 10 for any other affected clusters.

      12.Restart the TCA Manager appliance

      13.Restart the TCA CP Appliance

     14.Verify the K8S VIMs status in TCA-M, or the status of the Workload Cluster in the TCA-CP Appliance Management portal (9443). They should be in a connected state.