Component Upgrade Prechecks. Status: Failed: resources are not ok: wrong resource state [VCFMS-HEALTH-002]
search cancel

Component Upgrade Prechecks. Status: Failed: resources are not ok: wrong resource state [VCFMS-HEALTH-002]

book

Article ID: 461484

calendar_today

Updated On:

Products

VCF Operations

Issue/Introduction

  • When attempting to upgrade the VCF Services Runtime Management Component from version 9.1 to 9.1.1, the upgrade task fails at the "Component Stage Prechecks" step with the following error:
    Platform Health Check Error [platform-vmsp-platform-platform-machines-core : resources are not ok: wrong resource state] [VCFMS-HEALTH-002]
  • Checking status of vsphere-csi-controller pod by accessing control plane node as vmware-system-user using SSH Client and then switch to the root user via sudo -i we can notice that they are in "CrashLoopBackOff" state.
  • Checking Logs for vsphere-csi-controller by accessing control plane node as vmware-system-user using SSH Client and then switch to the root user via sudo -i we may notice the following entries:
    • kubectl logs -n kube-system -l app=vsphere-csi-controller -c vsphere-csi-controller --previous --timestamps | grep -Ei "Cannot complete|InvalidLogin|failed to"
      {"level":"error","time":"YYYY-MM-DDTHH:MM:SS.Z","caller":"vsphere/virtualcenter.go:212","msg":"failed to login to vc. err: ServerFaultCode: Cannot complete login due to an incorrect user name or password."
      {"level":"error","time":"YYYY-MM-DDTHH:MM:SS.Z","caller":"vsphere/virtualcenter.go:379","msg":"failed to create govmomi client with err: ServerFaultCode: Cannot complete login due to an incorrect user name or password."
      {"level":"error","time":"YYYY-MM-DDTHH:MM:SS.Z","caller":"vsphere/virtualcenter.go:381","msg":"failed to connect to vCenter using CA file: 
      {"level":"warn","time":"YYYY-MM-DDTHH:MM:SS.Z","caller":"vsphere/virtualcenter.go:319","msg":"Cannot connect to vCenter after all retry attempts with InvalidLogin 
      {"level":"error","time":"YYYY-MM-DDTHH:MM:SS.Z","caller":"vsphere/virtualcenter.go:765","msg":"failed to connect to VirtualCenter host: \"vCenter_Managing_VMSP_FQDN\". Err: failed to connect to vCenter: ServerFaultCode: Cannot complete login due to an incorrect user name or password."
      {"level":"error","time":"YYYY-MM-DDTHH:MM:SS.Z","caller":"vanilla/controller.go:226","msg":"failed to get vCenterInstance for vCenter \"vCenter_Managing_VMSP_FQDN\"err=failed to connect to vCenter: ServerFaultCode: Cannot complete login due to an incorrect user name or password.
      {"level":"error","time":"YYYY-MM-DDTHH:MM:SS.Z","caller":"service/driver.go:198","msg":"failed to init controller. Error: failed to get vCenterInstance for vCenter \"vCenter_Managing_VMSP_FQDN\"err=failed to connect to vCenter: ServerFaultCode: Cannot complete login due to an incorrect user name or password.
      {"level":"error","time":"YYYY-MM-DDTHH:MM:SS.Z","caller":"service/driver.go:212","msg":"failed to run the driver. Err: +failed to get vCenterInstance for vCenter \"vCenter_Managing_VMSP_FQDN\"err=failed to connect to vCenter: ServerFaultCode: Cannot complete login due to an incorrect user name or password."
  • Using Synthetic Checker by accessing control plane node as vmware-system-user using SSH Client and then switch to the root user via sudo -i we may notice Invalid Login or certificate trust issue:
    • SC="https://localhost:30006/status?selector=component=vsp,group%20in%20(vCenter,vsphere,snapshots)"
    • curl -ks "$SC" | jq 'to_entries[] | {check: .key, ok: .value.ok, error: .value.lastError}'
      {
        "check": "platform-vmsp-platform-platform-snapshots-snapshot",
        "ok": false,
        "error": "unable to create vSphere client: ServerFaultCode: Cannot complete login due to an incorrect user name or password."
      }
      {
        "check": "platform-vmsp-platform-platform-vc-serviceaccount-http",
        "ok": false,
        "error": "Unexpected status code: 401 expected: 200, response body: \"{\\\"type\\\":\\\"com.vmware.vapi.std.errors.unauthenticated\\\",\\\"value\\\":{\\\"error_type\\\":\\\"UNAUTHENTICATED\\\",\\\"challenge\\\":\\\"SIGN realm=\\\\\\\"71:57:68:##:C3:48:##:4B:D9:##:1C:1A:02:##:89:87:##:D0:##:06\\\\\\\",sts=\\\\\\\https://vCenter_Managing_VMSP_FQDN/sts/STSService/vsphere.local\\\\\\\, Basic realm=\\\\\\\"vCenter\\\\\\\"\\\",\\\"messages\\\":[]}}\""
      }
      {
        "check": "platform-vmsp-platform-validate-resources-vsphere-resources",
        "ok": false,
        "error": "unable to create vSphere client: ServerFaultCode: Cannot complete login due to an incorrect user name or password."
      }
      {
        "check": "platform-vmsp-platform-validate-template-vsphere-resources",
        "ok": false,
        "error": "unable to create vSphere client: ServerFaultCode: Cannot complete login due to an incorrect user name or password."
      }
  • Day N operations on VCF Management Services or VCF Automation deployment that require vCenter orchestration (e.g.,Volume Resize, Node Rollout, Scale up or Scale out of the component) fail with authentication errors).
  • When verifying the thumbprint stored in vmsp-platform from the VMSP Control Plane, we can identify it as a SHA-1 hash based on its character count (59 characters with colons, or 40 hex characters without):
    kubectl get pd -n vmsp-platform vmsp-platform -oyaml | grep thumbprint
  • While checking password rotation jobs from the Control Plane of VMSP we can notice recent jobs have all failed, command to check it:
    kubectl get jobs -A | grep -i rotation

Environment

  • VMware Cloud Foundation 9.1.1
  • VCF Services Runtime 9.1.1

Cause

The VMSP component automatically rotates its own vCenter service accounts (svc-vcfsp-vc-###). When rotation occurs, the old account is deleted and replaced with a new one, and the source secret (e.g., <cluster-name>-vcenter-main-secret) is updated with the new credentials.

The vCenter certificate thumbprint stored in the VCF Services Runtime 'PackageDeployment' ('spec.values.provider.vsphere.thumbprint') is a SHA-1 fingerprint (40 hex characters). The remediation and rotation code calculates the SHA-256 fingerprint (64 hex characters) of the certificate presented by vCenter and compares the two directly.

Prechecks run within the synthetic-checker pod, which caches the vCenter credentials in memory upon startup. When the secret changes, Kyverno's reload-on-secret-change policy is responsible for restarting this pod to fetch the new credentials and if there is a credentials mismatch the above issue will be reported

Resolution

To resolve this issue we have to follow a multi-step process and the details are mentioned below:

Note: These steps must be performed from the Control Plane node of the VCF Services Runtime cluster

  1. SSH to the Control Plane node of the VCF Services Runtime cluster and then switch to the root user via sudo -i 
  2. Download "convert_SHA256_reset_SVC_pwd.py" to your local workstation.
  3. Using the terminal command below or your preferred file transfer utility, securely copy the script downloaded in Step 2 to the VMSP Control Plane node's home directory (/home/vmware-system-user/). You will be prompted to enter the vmware-system-user password:
    scp convert_SHA256_reset_SVC_pwd.py mware-system-user@<node-ip>:update-vcenter-cert.sh
  4. Execute the remediation script following steps mentioned below:
    • Make the script executable using: chmod +x /home/vmware-system-user/convert_SHA256_reset_SVC_pwd.py
    • Execute the script using: /home/vmware-system-user/convert_SHA256_reset_SVC_pwd.py
  5. Validate if Synthetic Checker is reporting any further Invalid Login or certificate trust issue using:
    • SC="https://localhost:30006/status?selector=component=vsp,group%20in%20(vCenter,vsphere,snapshots)"
    • curl -ks "$SC" | jq 'to_entries[] | {check: .key, ok: .value.ok, error: .value.lastError}'

Additional Information

Synthetic Checker should report the following if there are no Credential or Thumbprint Related Issue noticed post executing the script mentioned in the KB:

SC="https://localhost:30006/status?selector=component=vsp,group%20in%20(vCenter,vsphere,snapshots)"
curl -ks "$SC" | jq 'to_entries[] | {check: .key, ok: .value.ok, error: .value.lastError}'
{
  "check": "platform-vmsp-platform-platform-snapshots-snapshot",
  "ok": true,
  "error": null
}
{
  "check": "platform-vmsp-platform-platform-vc-serviceaccount-http",
  "ok": true,
  "error": null
}
{
  "check": "platform-vmsp-platform-validate-resources-vsphere-resources",
  "ok": true,
  "error": null
}
{
  "check": "platform-vmsp-platform-validate-template-vsphere-resources",
  "ok": true,
  "error": null
}

Attachments

convert_SHA256_reset_SVC_pwd.py get_app