Skip to content

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.

kuik reports what it does in 5 places. Start with the first one that matches your question.

QuestionLook atCommand
What did kuik decide for this pod?The pod annotationskubectl get pod <pod> -o jsonpath='{.metadata.annotations}'
Is this resource working?Its Ready condition and anomaly conditionskubectl get imagealternatives,imagemirrors,imagemonitors
Which images fail, and why?The lists of the resource’s statuskubectl get <kind> <name> -o yaml, with <kind> one of imagealternative, imagemirror, imagemonitor
What just happened?Events, on the pod and on the resourcekubectl describe pod <pod>, kubectl describe <kind> <name>
What did a process do, step by step?Logs, at debug levelkubectl 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:

Terminal window
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.

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:

  1. The pod existed before the resource. kuik only rewrites pods when they are created. Restart the workload (kubectl rollout restart deployment/<name>, or statefulset/<name>, daemonset/<name>), or delete the pod so that its controller creates it again.
  2. The selectors do not match. Compare the pod’s labels and its namespace’s labels with podSelector and namespaceSelector. An empty selector matches everything. See Selecting workloads.
  3. The image does not match any entry. Entries match whole path segments: quay.io/acme/foo never matches quay.io/acme/foo-bar, and a repository entry never matches a deeper path. See Matching.
  4. The container is never rewritten: it has imagePullPolicy: Never, it belongs to a static pod, or its image is already one kuik produced.
  5. 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 for webhook.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.
  6. The chart restricts the webhook to some namespaces, with the webhook.namespaceSelector value.

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:

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> or docker manifest inspect <candidate>.
  • The candidate needs a credential. The webhook checks with the candidate’s auth, then the pod’s imagePullSecrets, as the node would. Add an auth to the entry. With the chart value secretAccess.mode: restricted, the webhook cannot read the pod’s pull secrets outside secretAccess.namespaces, and checks anonymously: it never uses fallbackAuth. List the pod’s namespace in secretAccess.namespaces.
  • The candidate is an ImageMirror copy 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.

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 Unauthorized or 403 Forbidden: the node has no credential for the new registry. With an auth.secretRef and injectPullSecret left to its default (true), kuik adds kuik-inject-<kind>-<name> to the pod’s imagePullSecrets, 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 a PullSecretInjectionFailed event. 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. Under OnFailure, the first pod of a namespace may start a few seconds before its Secret: the kubelet retries. An auth.provider credential is not injected yet.
  • x509: certificate signed by unknown authority, or http: 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. The tls and insecure settings of kuik apply to kuik only: configure the runtime of every node too (containerd’s certs.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.

kubectl get shows READY False. The reason is in the Ready condition, and in a ResourceNotReady event:

Terminal window
kubectl get imagemirror <name> -o jsonpath='{.status.conditions[?(@.type=="Ready")]}'
ReasonCauseFix
SecretNotFoundA secretRef names a Secret that does not exist in kuik’s namespaceCreate it in kuik’s namespace (kuik-system by default): a secretRef carries no namespace
SecretMalformedThe Secret is not of type kubernetes.io/dockerconfigjson, or its content does not parseRecreate it with kubectl create secret docker-registry
InvalidConfigA selector or an entry the API server accepted cannot be usedThe message names the field
RegistryDeleteUnsupportedThe ImageMirror destination refuses tag deletion, or manifest deletion under cleanup.deleteByDigest, so the cleanup cannot runAllow 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.

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):

Terminal window
kubectl get imagemirror <name> -o jsonpath='{.status.failedImageCopies}'
ReasonCauseFix
SourceNotFoundNo source holds the image any more: the origin and every alternative answered not foundRebuild or push the image. Pods still running it do so from a node cache
PushRejectedThe destination refused the manifest: size, media type, or a policy such as nested paths or immutable tagsRead the registry’s logs. The destination must accept nested repository paths, see Destination requirements
UnauthorizedA registry refused the credential, on either sideOn the destination, the manage credential needs read and write. On the source, kuik reads with the pods’ pull secrets, then fallbackAuth
QuotaExceededA registry rate-limited the copykuik tries again later, waiting longer after each failure. Raise the host’s copy.interval if it lasts, see Registry pacing
SourceUnreachable / DestinationUnreachableThat 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 ImageMonitor lists the images whose check fails in status.unavailableImages, with a reason:

ReasonCauseFix
ManifestNotFoundThe tag or digest no longer exists in the registryRebuild or push the image before its pods restart
UnauthorizedNo credential kuik holds can read itDeclare one in fallbackAuth. With the chart value secretAccess.mode: restricted, kuik cannot read the pods’ pull secrets outside the listed namespaces
QuotaExceededThe registry rate-limited the checkRaise the host’s check.interval
UnreachableThe 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.

The DeletionBlocked condition says what holds it, its reason naming the hold and its message the way out:

Terminal window
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:

  1. A live pod runs one of its copies (PodsRunningCopies), whatever its imagePullPolicy. Since Kubernetes 1.35 the kubelet checks the pull Secret again at every container start, restarts included: once the ImageMirror and 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 Normal WaitingForPods event fires when the wait starts and each time that count changes, and the reconciler logs Held a deleted ImageMirror: live pods run its copies with count and pods:

    Terminal window
    kubectl get events --field-selector involvedObject.kind=ImageMirror,involvedObject.name=<name>,reason=WaitingForPods

    Roll those workloads (kubectl rollout restart deployment/<name>): the new pods go through the webhook again, which no longer offers the deleted ImageMirror, and the ImageMirror goes once the old pods are gone.

  2. It cannot delete its tags, with cleanup.enabled: the manage credential cannot be read (ManageCredentialUnreadable), the destination refuses tag deletion, or manifest deletion under cleanup.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 sets Ready to False with the reason RegistryDeleteUnsupported, its message naming which deletion was refused, and emits an ImageDeletionFailed event 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.

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-id holds 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 config in 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, and kuik_config_reload_errors_total counts the refusals. metrics is 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.

Open an issue with the kuik version, the resource, the pod annotations, the events, and the debug logs of the process involved.