User is unable to connect to control-plane service with Error : "Error occurred during HTTP request: Get "https://<redacted>/wcp/loginbanner": tls: failed to verify certificate: x509: certificate is valid for <redacted>, not <redacted>"
[root@worker1:~# kubectl vsphere login --server=https://<redacted>ERRO[2025-04-08 14:11:41.262] Error occurred during HTTP request: Get "https://<redacted>/wcp/loginbanner": tls: failed to verify certificate: x509: certificate is valid for <redacted>, not <redacted>There was an error when trying to connect to the server.Please check the server URL and try again.
IP addresses for Supervisor Cluster kube-apiserver, vsphere-csi-controller and Guest Cluster control plane services have changed.
vSphere Supervisor v1.28 and lower
AVI-AKO
This is a known issue caused by the environment's AVI-AKO build version included with the vCenter and Supervisor cluster.
There are a couple of scenarios when the user can land into an issue leading to a change in IP address of the control-plane services.
Resolution
This issue is resolved in vCenter 8.0u3E and Supervisor cluster version 1.29.7.
Recovery Workaround
The IP addresses for the services will need to be reverted to the original IPs, and virtual services deleted to be recreated within AVI.
Steps to restore IP in both VDS and NSX WCP deployments:
kubectl get service -A | awk '/LoadBalancer/ {print $1,$2,$5}' > svcs.txt
Steps to Validate from AVI Web UI:
In the AVI web UI, navigate to Operations
The next CONFIG_CREATE event has the details of the current, incorrect IP address
In the Supervisor cluster context, use the below command to get a list of the Control Plane Endpoint IPs for each affected workload cluster:
kubectl get cluster -o yaml -A | egrep -i "cluster-name|endpoint" -A1
This endpoint is equivalent to the External IP address of each <cluster-name>-control-plane-service LoadBalancer service for the affected workload cluster(s).
kubectl get svcs -A | grep "control-plane"
kubectl get deployments -n vmware-system-netop
kubectl scale deployment vmware-system-netop-controller-manager -n vmware-system-netop --replicas=0
Navigate to the Applications tab in AVI web UI in a web browser
vi correct-svcs.sh
#!/usr/bin/bash
filename="$1"
while IFS=' ' read -r f1 f2 f3; do
kubectl get gateway "$f2" -n "$f1" -oyaml | sed 's/addresses: \[\]/addresses:\n - type: IPAddress\n value: '"$f3"'/1' | kubectl replace -f -
done < "$filename"
chmod 777 correct-svcs.sh
./correct-svcs.sh svcs.txt
kubectl rollout restart deploy -n vmware-system-ako
kubectl scale deployment vmware-system-netop-controller-manager -n vmware-system-netop --replicas=<count from Step 4>
kubectl get svc -n <virtual service namespace>