Debug NicoIdentity credential health
This page describes how to read the credential check that CAPNICo, the Cluster API (CAPI) infrastructure provider for NVIDIA Infra Controller (NICo), publishes on a NicoIdentity object, and what to do when the result is not healthy. Use it when you read NicoIdentity objects with kubectl instead of nvkectl get providers, or when the CREDENTIALS column of nvkectl get providers does not say enough.
CAPNICo checks the credentials Secret that each NicoIdentity names: it authenticates with the credentials and reads the current tenant of the organization in the Secret from the NICo API. It writes the result to the Ready condition and status.lastCheckedTime of the NicoIdentity. The check itself never changes which credentials provisioning uses; spec.credentialsRef does. nvkectl get providers reads the same status; Infrastructure providers lists its CREDENTIALS values.
Before you begin
- You have completed Configure an infrastructure provider: NICo.
- To have a result to read, the CAPNICo release on the management cluster must serve
NicoIdentity. The release the NVIDIA Kubernetes Engine (NVKE) install deploys,v0.1.0indeploy/nico/capnico/capnico.yaml, serves it. An earlier release, such asv0.0.45, does not, andnvkectl get providersreportsCREDENTIALSasUNSUPPORTEDwith it. kubectluses the management cluster’s admin kubeconfig, for example withexport KUBECONFIG=<CLUSTER_NAME>.kubeconfig. A narrower kubeconfig needsgetandlistonnicoidentities.infrastructure.cluster.x-k8s.ioto read results, and read access to thecontroller-managerDeployment, its pods and their logs incapnico-systemto read the manager log.- You have
jq, for the log commands.
Find the NicoIdentity
-
List every
NicoIdentity.The output has the columns
READY,LASTCHECKEDandAGE:READYis the status of theReadycondition,LASTCHECKEDis how long ago the last check finished, andAGEis how long ago theNicoIdentitywas created. If the command returns no rows or an error, go to No result at all. -
Find the
NicoIdentitythat names the Secret you want to check. By default, CAPNICo uses thenico-credentialsSecret incapnico-systemfor everyNicoClusterthat names no credentials of its own.Each line shows the namespace, the name and the Secret the
NicoIdentitynames. The Secret is always in the namespace of theNicoIdentity.
Check that the result is current
A result describes the NicoIdentity as it is now only when two things hold:
- The
Readycondition’sobservedGenerationequals the object’smetadata.generation. A lowerobservedGenerationis the result for an earlier spec, for example beforespec.credentialsRefchanged. status.lastCheckedTimeis recent. CAPNICo checks eachNicoIdentityagain four to five minutes after the last check finished, including a failed one, so a time older than two check intervals, 10 minutes, usually means nothing is checking it.nvkectl get providersreportsSTALEfrom that age.
The condition’s lastTransitionTime is not a freshness signal: it changes only when status changes, and a NicoIdentity that has failed the same way for a day keeps the time of its first failure.
-
Print the generation, the observed generation and the check time.
Replace
<NAME>and<NAMESPACE>with the values from Find the NicoIdentity. The first two numbers match, and the time is less than 10 minutes before the current time:For a few moments after a check,
lastCheckedTimecan still show the previous check, because CAPNICo writes the condition and the time in separate requests. -
If the numbers differ, wait a few seconds and run the command again. A spec change starts a check within seconds. If they still differ after 10 minutes, or the time is older than 10 minutes, go to The result is stale. If the object has no
status, go to No result at all.
kubectl wait --for=condition=Ready waits for the condition status only and does not check its age, so it can succeed on a result that is hours old.
Read the reason and fix it
-
Print the
Readycondition.The
statussection holds the result: -
Find the
reasonin the table and apply the fix.Falsemeans the check found a configuration, credential or permission failure.Unknownmeans the check could not decide.The
NicoIdentitycheck writes no NICo client error to its status or the log, because such an error can contain credentials. The message is the most detail a check reports. -
After you change the Secret, check the result again as in Check that the result is current. Creating, changing or deleting the Secret starts a check of the
NicoIdentityobjects that name it within seconds. A Secret change does not changemetadata.generation, so until that check finishes the previous result still looks current. Note the time of the change, and read the result only oncestatus.lastCheckedTimeis later than it.
The result is stale
A result is stale when no check has finished for more than 10 minutes. The NicoIdentity keeps its last result, which then ages; nothing marks it out of date. Check these causes in order:
-
The manager is running.
The Deployment shows all replicas ready. If it does not, read the pod’s state with
kubectl -n capnico-system get pods.A CAPNICo manager that serves
NicoIdentityexits at startup when theNicoIdentitycustom resource definition (CRD) is missing. Its log then showsunable to create controllerwith"controller":"NicoIdentity", and the pod restarts inCrashLoopBackOff; while it does, CAPNICo reconciles nothing. Install the CRD from the same CAPNICo release. On an NVKE management cluster, the CRDs come fromcapnico.yamlin the deploy path; with--release, the manager image comes from the release instead, so check that the two versions match. See step 3. The next restart succeeds, or restart the Deployment to skip the restart delay:A manager without
listandwatchon Secrets in its scope also fails to start its controllers and exits, so missing Secret access shows up as a restarting pod, not as aSecretReadFailedresult.A manager that starts checks every
NicoIdentityin its scope. -
The manager’s scope includes the
NicoIdentity. Print the manager’s arguments:-
With
--namespace=<WATCH_NAMESPACE>, the manager checks onlyNicoIdentityobjects in<WATCH_NAMESPACE>. ANicoIdentitychecks only a Secret in its own namespace, so creating one in<WATCH_NAMESPACE>does not check a Secret elsewhere. Keep theNicoIdentityand its Secret in<WATCH_NAMESPACE>, or widen the manager’s scope to include their namespace. -
With
--watch-filter=<VALUE>, the manager checks onlyNicoIdentityobjects with the labelcluster.x-k8s.io/watch-filter=<VALUE>. ANicoIdentitythat loses the label keeps its last result. Add the label:The label change starts a check within seconds.
-
-
The manager’s image serves
NicoIdentity. A manager from an earlier CAPNICo release, such asv0.0.45, has noNicoIdentitycontroller and never checks one, even when the CRD is installed. Upgrade CAPNICo as a whole, CRDs and manager from the same release. On an NVKE management cluster, CAPNICo comes fromdeploy/nico/capnico/capnico.yaml. Install from an NVKE checkout or release whosecapnico.yamlpins a CAPNICo release that servesNicoIdentity. Bumping it changescapnico.yaml, the image tag indeploy/nico/capnico/release.yamlandcontroller/go.modtogether, and keeps the manager’s--reboot-annotationand--repair-annotationarguments. The upstream release starts the manager without those arguments, and it then ignores every NVKE reboot and repair request. When you install with--release, the manager image comes from the release’scapnico-controllerartifact. Re-running the NVKE install applies whatever CAPNICo that build or release carries.
During a NICo outage a round of checks takes longer: CAPNICo checks one NicoIdentity at a time, and each check can run for the full validation timeout. With many NicoIdentity objects, a gap longer than 10 minutes can then mean slow checks rather than stopped ones; the checked NicoIdentity credentials lines in the manager log tell the two apart.
No result at all
kubectl get nicoidentities -A returns no rows, an error, or a NicoIdentity with no status:
-
No
NicoIdentitynames the Secret. Nothing checks a Secret that noNicoIdentitynames, and installing CAPNICo creates none. Create one in the namespace of the Secret, for example fornico-credentials:Save it as
nico-identity.yamland apply it withkubectl apply -f nico-identity.yaml. Creating theNicoIdentitystarts its first check. If the manager runs with--watch-filter, add the label described in The result is stale. -
The installed CAPNICo does not serve
NicoIdentity.kubectlprintsthe server doesn't have a resource type "nicoidentities". Confirm it:NotFoundmeans the CRD is not installed. The CAPNICo release the NVKE install deploys does not include it. -
Your kubeconfig may not list
NicoIdentityobjects.kubectlreturnsForbidden. Confirm it:CAPNICo releases that serve
NicoIdentityship the ClusterRolenicoidentity-viewer-role, in the release bundle and in the chart whilerbac.helpers.enabledistrue, its default. It grants reads ofNicoIdentityobjects and their status, and no access to Secrets. Bind it to the user that reads the results:Replace
<USER>with the user name your kubeconfig authenticates as. The RoleBinding grants reads incapnico-systemonly, so list with-n capnico-systeminstead of-A, or bind the ClusterRole with a ClusterRoleBinding to read every namespace. With the chart’srbac.namespaced=true, the role is a Role in the release namespace; use--role=nicoidentity-viewer-roleinstead of--clusterrole. -
The first check has not finished. A
NicoIdentityhas nostatusuntil its first check completes, and nostatusis not a successful check. The first check starts when theNicoIdentityis created. If there is still nostatusafter 10 minutes, see The result is stale.
Read the CAPNICo manager log
The NicoIdentity status and the manager log are the only places a check reports to. A failed check changes the status and raises no Kubernetes Event. No CAPNICo metric reports check results: capnico_api_requests_total and capnico_api_request_duration_seconds count the request a check sends to NICo under operation="get_current_tenant", together with the same request from cluster and machine reconciliation, and a check that fails before that request, on the Secret or at token acquisition, adds nothing to them.
-
Show the checks the manager finished in the last hour.
Each line names the
NicoIdentityinnamespaceandname, and carries the result inreadyandreason. If the log has no line for aNicoIdentityin the last 10 minutes, the manager is usually not checking it; see The result is stale, which also covers slow checks during a NICo outage. -
Show the Secret read errors.
The
errorkey holds the error the Kubernetes API returned for aSecretReadFailedresult, for example an API server error or a timeout.
Verify
Run kubectl get nicoidentities -A. The NicoIdentity that names your credentials Secret shows READY as True and LASTCHECKED under 10 minutes, and the jsonpath command in Check that the result is current prints the same number twice. If the Secret is the provider’s credentials Secret, nico-credentials in capnico-system by default, the CREDENTIALS column of nvkectl get providers reads HEALTHY; nvkectl reports on no other Secret.
Next steps
- Manage the NICo credentials to rotate the token.
- Troubleshoot a provider state other than
CONFIGURED. - The NicoIdentity API reference in the CAPNICo repository for every field and reason.