TKG Management Cluster addon upgrade fails with java.lang.ClassCastException in TCA 3.4
search cancel

TKG Management Cluster addon upgrade fails with java.lang.ClassCastException in TCA 3.4

book

Article ID: 436150

calendar_today

Updated On:

Products

VMware Telco Cloud Automation VMware vSphere ESXi VMware Telco Cloud Platform

Issue/Introduction

1. After upgrading TCA Manager and TCA Control Plane from version 3.2 to 3.4, the TKG Management Cluster (TKG-M) node upgrade to Kubernetes 1.29 succeeds, but the subsequent addon upgrade fails.

2. The UI displays the following error: Fail to upgrade cluster <REDACTED_HOSTNAME> to v1.29.15+vmware.1: Failed to update addon. Error: class java.lang.String cannot be cast to class java.util.Map

3. The TCA API pod logs show a java.lang.ClassCastException:

ERROR c.v.h.a.c.SelfCertificateProvider- Failed to create kubernetes api client to connect internal cluster
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Map
at com.vmware.nfv.vim.kubernetes.client.KubeClient.loadKubeConfig(KubeClient.java:122)

4. Verification of the kubeconfig-secret in the tca-cp-cn namespace reveals that the kubeconfig data field is empty ("").

Environment

TCA 3.4, TKG 2.5.x

Cause

The kubeconfig-secret within the TCA Control Plane namespace contains an empty or improperly formatted kubeconfig string, causing the Java-based KubeClient to fail during type casting while attempting to parse the cluster configuration.

Resolution

To resolve this issue, manually update the secret with a valid, base64-encoded kubeconfig:

  1. Log in to the TCA Control Plane (TCA-CP) node via SSH.

  2. Locate or generate a valid kubeconfig for the management cluster.

  3. Encode the kubeconfig file to base64 (one-line format): cat /home/admin/valid-kubeconfig | base64 -w 0

  4. Edit the existing secret in the TCA namespace: kubectl edit secret kubeconfig-secret -n tca-cp-cn

  5. Locate the data: section and update the kubeconfig: field with the base64 string generated in Step 3:

    data:
      kubeconfig: <BASE64_ENCODED_STRING>
    
  6. Save and exit the editor.

  7. Rerun the cluster upgrade from the TCA UI.