When decoded password value includes a single quote ( ' ) within the string value, issue might arise while unmarshaling the vSphere credentials stating an error as "Unable to get vSphere credentials from secret".
tanzu management-cluster upgrade
Upgrading management cluster 'tkg-mgmt' to TKG version 'v1.4.0' with Kubernetes version 'v1.21.2+vmware.1'. Are you sure? [y/N]: y
cluster specific secret is not present, fallback on bootstrap credential secret
Error: unable to configure variables for provider installation: failed to configure
Vsphere credentials: unable to get vsphere credentials from secret: unable to retrieve vSphere credentials: yaml: line 1: did not find expected key
apiVersion: v1
kind: Secret
metadata:
labels:
cluster.x-k8s.io/provider: infrastructure-vsphere
name: vSphere-credentials
namespace: capv-system
stringData:
credentials.yaml: |-
username: '${VSPHERE_USERNAME}'
password: '${VSPHERE_PASSWORD}'
type: Opaque
Since the password has single quote (eg: pass'word) the password supplied to the secret will be as
password : 'pass'word'
tanzu mc credentials update --cascading
? Enter vSphere username
? Enter vSphere password