Troubleshooting
This documents the in-development version. Switch to v2.3 for the latest stable release.
Start from the symptom you see. Each section says where to look, what it means, and how to fix it.
Where to look
Section titled “Where to look”kuik reports what it does in 5 places. Start with the first one that matches your question.
| Question | Look at | Command |
|---|---|---|
| What did kuik decide for this pod? | The pod annotations | kubectl get pod <pod> -o jsonpath='{.metadata.annotations}' |
| Is this resource working? | Its Ready condition and anomaly conditions | kubectl get imagealternatives,imagemirrors,imagemonitors |
| Which images fail, and why? | The lists of the resource’s status | kubectl get <kind> <name> -o yaml, with <kind> one of imagealternative, imagemirror, imagemonitor |
| What just happened? | Events, on the pod and on the resource | kubectl describe pod <pod>, kubectl describe <kind> <name> |
| What did a process do, step by step? | Logs, at debug level | kubectl logs -n kuik-system -l app.kubernetes.io/component=webhook --tail=-1 |
The annotations are described in What the webhook records on a pod, the events, metrics and logs in Events, metrics and logs. To see every candidate the webhook tried, raise its verbosity:
helm upgrade kube-image-keeper oci://quay.io/enix/charts/kube-image-keeper:$VERSION \ --namespace kuik-system --reuse-values --set webhook.verbosity=debug$VERSION is the installed version, shown by helm list -n kuik-system.
A pod was not rewritten
Section titled “A pod was not rewritten”Read the pod’s annotations first:
kuik.enix.io/no-alternatives: kuik tried every candidate, and none answered. The value names the resources that offered one. Go to No candidate answers.kuik.enix.io/conceded-rewrites: kuik rewrote the image, then another mutating webhook replaced it, and kuik stood down. Narrow the scope of one of the two.- No kuik annotation at all: the original image answered first, or kuik never looked at the pod. Go through the list below.
When kuik never looked at the pod:
- The pod existed before the resource. kuik only rewrites pods when they are created. Restart the workload (
kubectl rollout restart deployment/<name>, orstatefulset/<name>,daemonset/<name>), or delete the pod so that its controller creates it again. - The selectors do not match. Compare the pod’s labels and its namespace’s labels with
podSelectorandnamespaceSelector. An empty selector matches everything. See Selecting workloads. - The image does not match any entry. Entries match whole path segments:
quay.io/acme/foonever matchesquay.io/acme/foo-bar, and arepositoryentry never matches a deeper path. See Matching. - The container is never rewritten: it has
imagePullPolicy: Never, it belongs to a static pod, or its image is already one kuik produced. - The webhook was not ready. The webhook admits pods unchanged when it is down or not ready: kuik never blocks a pod. It stays not ready until the reconciler has created the ConfigMap
kuik-cluster-id, see Cluster ID. A stopping webhook pod keeps answering forwebhook.shutdownDelaySeconds(10 by default), so that it leaves the Service before it stops listening: raise the chart value when pods created during a rollout of the webhook come out unrouted. Check that every kuik pod runs:kubectl get pods -n kuik-system. - The chart restricts the webhook to some namespaces, with the
webhook.namespaceSelectorvalue.
When the original image answered first, the resource put its candidates after the original: that is rewritePolicy: OnFailure, the default. Use Always to put them first, see rewritePolicy. Two more cases put a candidate after the original:
- An
ImageMirrorunderAlways, for a container withimagePullPolicy: Always: seewebhook.demoteMirrorWithPullPolicyAlways. - A candidate that an
ImageMonitoror anImageMirrorreports failing: seedemoteKnownFailures.
No candidate answers
Section titled “No candidate answers”The webhook checks each candidate with a single manifest HEAD, never retried, and gives up on one after 2 seconds (webhook.availabilityCheck.timeout): a candidate that answers an error, a 503 included, is unavailable at once. That answer, a failure included, stays in the replica’s cache for webhook.availabilityCheck.activeCheckCache.ttl, 10 seconds by default: a pod that replica admits within it gets the same verdict without a new check, unless the candidate is checked with other credentials (other pull Secrets, or a new version of them). The debug logs of the webhook name each candidate and why it failed. The usual causes:
- The candidate does not hold that tag. Check it with
crane manifest <candidate>ordocker manifest inspect <candidate>. - The candidate needs a credential. The webhook checks with the candidate’s
auth, then the pod’simagePullSecrets, as the node would. Add anauthto the entry. With the chart valuesecretAccess.mode: restricted, the webhook cannot read the pod’s pull secrets outsidesecretAccess.namespaces, and checks anonymously: it never usesfallbackAuth. List the pod’s namespace insecretAccess.namespaces. - The candidate is an
ImageMirrorcopy not made yet. The first pods of a new image fall back to the original until the copy exists. See A copy fails. - The registry is slow, a proxy cache fetching the image from upstream for instance. Raise
webhook.availabilityCheck.timeout. - kuik cannot reach the registry, or does not trust its certificate. See Registry TLS.
A rewritten pod cannot pull
Section titled “A rewritten pod cannot pull”The pod shows ErrImagePull or ImagePullBackOff on the image kuik placed. The kuik.enix.io/rewrites annotation holds the original image and the resource that placed the new one.
401 Unauthorizedor403 Forbidden: the node has no credential for the new registry. With anauth.secretRefandinjectPullSecretleft to its default (true), kuik addskuik-inject-<kind>-<name>to the pod’simagePullSecrets, the kind in lowercase (kuik-inject-imagealternative-<name>,kuik-inject-imagemirror-<name>), and the secret syncer writes that Secret in the pod’s namespace (see Injected pull secrets). When a source Secret is missing or malformed, the secret syncer still writes the injected Secret, without that entry, and the resource has aPullSecretInjectionFailedevent. Check that the Secret holds the registry:kubectl get secret kuik-inject-<kind>-<name> -n <namespace> -o jsonpath='{.data.\.dockerconfigjson}' | base64 -d. A Secret missing altogether points at the secret syncer: read its logs. UnderOnFailure, the first pod of a namespace may start a few seconds before its Secret: the kubelet retries. Anauth.providercredential is not injected yet.x509: certificate signed by unknown authority, orhttp: server gave HTTP response to HTTPS client: the node’s container runtime does not trust the registry, or does not know it is plain HTTP. Thetlsandinsecuresettings of kuik apply to kuik only: configure the runtime of every node too (containerd’scerts.d, CRI-O’s/etc/containers/certs.d).not found: the candidate answered kuik’s check, then lost the image before the pull. Restart the pod: kuik checks the candidates again.
A resource is not Ready
Section titled “A resource is not Ready”kubectl get shows READY False. The reason is in the Ready condition, and in a ResourceNotReady event:
kubectl get imagemirror <name> -o jsonpath='{.status.conditions[?(@.type=="Ready")]}'| Reason | Cause | Fix |
|---|---|---|
SecretNotFound | A secretRef names a Secret that does not exist in kuik’s namespace | Create it in kuik’s namespace (kuik-system by default): a secretRef carries no namespace |
SecretMalformed | The Secret is not of type kubernetes.io/dockerconfigjson, or its content does not parse | Recreate it with kubectl create secret docker-registry |
InvalidConfig | A selector or an entry the API server accepted cannot be used | The message names the field |
RegistryDeleteUnsupported | The ImageMirror destination refuses tag deletion, or manifest deletion under cleanup.deleteByDigest, so the cleanup cannot run | Allow the deletion on the registry, set cleanup.deleteByDigest: true when the ImageMirror is the only writer of its destination (see Deleting by digest), or set cleanup.enabled: false. Once the deletion is allowed, kuik resumes at its next try, within 1 hour, or at once on a change of the ImageMirror spec. With cleanup.deleteByDigest: true, a try also waits for the mirror copies running to end |
The other conditions (FallbackActive, ImagesUnavailable…) are not errors of the resource: they report an image, see Status conventions.
A copy fails
Section titled “A copy fails”An ImageMirror lists the copies that fail in status.failedImageCopies, with a reason. A failing copy is retried one copy.interval after its failure, then twice as long after each new one, up to 30 minutes, so lastAttempt may be that old (see Registry pacing):
kubectl get imagemirror <name> -o jsonpath='{.status.failedImageCopies}'| Reason | Cause | Fix |
|---|---|---|
SourceNotFound | No source holds the image any more: the origin and every alternative answered not found | Rebuild or push the image. Pods still running it do so from a node cache |
PushRejected | The destination refused the manifest: size, media type, or a policy such as nested paths or immutable tags | Read the registry’s logs. The destination must accept nested repository paths, see Destination requirements |
Unauthorized | A registry refused the credential, on either side | On the destination, the manage credential needs read and write. On the source, kuik reads with the pods’ pull secrets, then fallbackAuth |
QuotaExceeded | A registry rate-limited the copy | kuik tries again later, waiting longer after each failure. Raise the host’s copy.interval if it lasts, see Registry pacing |
SourceUnreachable / DestinationUnreachable | That side did not answer: DNS, connection, TLS or timeout, or answered with a server error (5xx) | Check the network from kuik’s namespace, and Registry TLS |
Copies are slow. That is the pacing: kuik copies at most one image per source registry per copy.interval, 3 minutes by default. 100 images from one registry take 5 hours. For a registry you own, lower its interval, see Registry pacing.
An image is reported unavailable
Section titled “An image is reported unavailable”An ImageMonitor lists the images whose check fails in status.unavailableImages, with a reason:
| Reason | Cause | Fix |
|---|---|---|
ManifestNotFound | The tag or digest no longer exists in the registry | Rebuild or push the image before its pods restart |
Unauthorized | No credential kuik holds can read it | Declare one in fallbackAuth. With the chart value secretAccess.mode: restricted, kuik cannot read the pods’ pull secrets outside the listed namespaces |
QuotaExceeded | The registry rate-limited the check | Raise the host’s check.interval |
Unreachable | The registry did not answer: DNS, connection, TLS or timeout, or answered with a server error (5xx) | Check the network, and Registry TLS |
An AnonymousAccessDenied event on the monitor says that a registry refused an anonymous check: the image is likely private, and no credential covers it. Declare a fallbackAuth entry for it.
The counts lag behind. available plus unavailable stays below tracked until every image has been checked once: kuik checks one image per registry per check.interval. status.checks.registries[].cycleDuration is how long a full round takes on each registry.
An ImageMirror stays Terminating
Section titled “An ImageMirror stays Terminating”The DeletionBlocked condition says what holds it, its reason naming the hold and its message the way out:
kubectl get imagemirror <name> -o jsonpath='{.status.conditions[?(@.type=="DeletionBlocked")]}'A deleted ImageMirror waits for the copies still running (CopiesInFlight), which ends within a copy timeout. Beyond that, it stays Terminating while:
-
A live pod runs one of its copies (
PodsRunningCopies), whatever itsimagePullPolicy. Since Kubernetes 1.35 the kubelet checks the pull Secret again at every container start, restarts included: once theImageMirrorand its injected pull Secrets are gone, a crashed or OOM-killed container of that pod could not start again. The message gives how many pods hold it and names up to 5 of them; a NormalWaitingForPodsevent fires when the wait starts and each time that count changes, and the reconciler logsHeld a deleted ImageMirror: live pods run its copieswithcountandpods:Terminal window kubectl get events --field-selector involvedObject.kind=ImageMirror,involvedObject.name=<name>,reason=WaitingForPodsRoll those workloads (
kubectl rollout restart deployment/<name>): the new pods go through the webhook again, which no longer offers the deletedImageMirror, and theImageMirrorgoes once the old pods are gone. -
It cannot delete its tags, with
cleanup.enabled: themanagecredential cannot be read (ManageCredentialUnreadable), the destination refuses tag deletion, or manifest deletion undercleanup.deleteByDigest(DestinationRefusedDeletion), or the destination cannot be reached or refuses the credential (shown only in the reconciler logs). A destination that refuses the deletion also setsReadytoFalsewith the reasonRegistryDeleteUnsupported, its message naming which deletion was refused, and emits anImageDeletionFailedevent on each try.
To release it while leaving the tags in place, set cleanup.enabled: false on it: it still waits for the pods running its copies. When the destination refuses tag deletion and the ImageMirror is its only writer, cleanup.deleteByDigest: true lets the cleanup through instead. When it refuses manifest deletion under cleanup.deleteByDigest, allow manifest deletion on the registry (on the CNCF distribution registry, storage.delete.enabled), or set cleanup.enabled: false. See Deleting an ImageMirror, and Harbor as an ImageMirror destination for a Harbor destination.
A status list is truncated
Section titled “A status list is truncated”The anomaly lists of a status hold 500 entries at most. From 80%, the ListCapacityPressure condition turns True, and status.truncated counts the entries left out. The metrics still carry every image: alert and count on them, see Anomalies.
kuik does not start, or ignores a config change
Section titled “kuik does not start, or ignores a config change”- A process does not start: its global config file does not validate. The first lines of its logs say which key. See Global config file.
- The ConfigMap
kuik-cluster-idholds an invalid ID: the reconciler does not start. The webhook starts, logs that the cluster ID is invalid, and stays not ready: it admits every pod unchanged. See Cluster ID. - A config change has no effect: the kubelet updates the mounted file a minute or two after the ConfigMap changes, and
Reloaded global configin the logs marks the reload. If it does not come, the reload was refused, and the previous config stays in effect. The logs say why, andkuik_config_reload_errors_totalcounts the refusals.metricsis only read at startup. - After an upgrade, a field is unknown: Helm does not upgrade CRDs. Apply the CRDs of the new version, see Installation.
Still stuck?
Section titled “Still stuck?”Open an issue with the kuik version, the resource, the pod annotations, the events, and the debug logs of the process involved.