Reconcile fails because of uppercase typo in TKC cluster yaml
search cancel

Reconcile fails because of uppercase typo in TKC cluster yaml

book

Article ID: 393998

calendar_today

Updated On:

Products

VMware vSphere Kubernetes Service

Issue/Introduction

Customer used uppercase character for the name of a worker and now the guest cluster is in unhealthy state and will not reconcile

Message:   error reconciling the Cluster topology: failed to create MachineDeployment: failed to create VSphereMachineTemplate.vmware.infrastructure.cluster.x-k8s.io: FieldValueInvalid: metadata.name: Invalid value: "cluster-worker-xxxx-XXXX-xxxx": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Environment

vCenter Server 8.0

vSphere with Tanzu 

TKGS guest Cluster

Cause

Customer used uppercase character for the name of a Kubernetes object

As per the Kubernetes documentation:  Object Names and IDs

 Objects should use a name that can be used as a DNS subdomain name as defined in RFC 1123. This means the name must:

  • contain no more than 253 characters
  • contain only lowercase alphanumeric characters, '-' or '.'
  • start with an alphanumeric character
  • end with an alphanumeric character

Resolution

1. Ensure you have a good backup/recovery position.

2.  Edit the cluster and change uppercase name to lower case

kubectl edit cluster <cluster-name> -n <cluster-namespace>

3. Trigger a reconcile on the cluster

kubectl patch cluster <cluster-name> -n <cluster-namespace> --type merge -p '{"spec":{"paused": true}}'  

kubectl patch cluster <cluster-name> -n <cluster-namespace> --type merge -p '{"spec":{"paused": false}}'  

Additional Information

An error similar to below can be seen if there is an additional space in the volume name 'kubelet' in the TKC when deployed from TMC.

  * InfrastructureReady: failed to create or update VirtualMachine: failed to create volume namespace/tkgs-cluster-kubelet : Persiste
ntVolumeClaim "tkgs-cluster-kubelet " is invalid: metadata.name: Invalid value: "tkgs-cluster-kubelet ": a lowe
rcase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', r
egex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
  * NodeHealthy: Waiting for VSphereMachine to report spec.providerID

To fix the issue, edit the TKC from TMC and remove the additional space from the volume name.