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 disconnected k8s cluster's VIP as the capv user.
  2. View the contents of the '/etc/kubernetes/admin.conf' file.

    cat /etc/kubernetes/admin.conf
     

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

  3. Copy the content of the 'admin.conf' file.
  4. Go to the TCA-UI -> Virtual Infrastructure -> cluster.
  5. Click on the 'Edit' button.
  6. Update the Kubernetes Config with the admin.conf content obtained from step 3.
  7. Click on 'Update'
    • This will set the VIM status to pending for about 30-40 seconds. It should return to the 'connected' status.
  8. Navigate to https://<TCA-CP_IP>:9443 in a browser
  9. Locate the cluster, edit and update the kube config file with the admin.conf content obtained from step 3.
  10. Repeat steps 1 through 9 for any other affected clusters.
  11. Restart the TCA Manager appliance
  12. Restart the TCA CP Appliance
  13. 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.