Pcornel
Browse topics
Options
Recent
Favorites
Containers · Technical reference

Private Registry Authentication

Direct answer

Private registry authentication: clients log in with credentials or tokens; Kubernetes uses imagePullSecrets or node/cloud identity (IRSA, workload identity) to pull from private registries.

When to use this

Use it when pulls fail with unauthorized or denied.

First 30 seconds

1. Error text: unauthorized / denied / not found.

2. kubectl get secret <s> -o jsonpath='{.type}' — dockerconfigjson?

3. Pod/ServiceAccount references the secret?

4. Test: docker login <registry> with the same credentials.

5. Token expiry/rotation.

Operational verification

pod → imagePullSecret/identity → registry auth → pull

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Docker / containerd / Podman / Kubernetes / OCI-compatible platforms
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformDocker / containerd / Podman / Kubernetes / OCI-compatible platforms
Scope / prerequisiteUse it when pulls fail with unauthorized or denied.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 How to verify Verify boundary

Pull manually with the same credentials on a node. Confirm the Secret is in the same namespace as the Pod. Confirm the service account lists it in imagePullSecrets if the Pod spec does not.

Step 2 Common failures Narrow the fault

A secret in another namespace is not usable. Expired cloud registry tokens cause intermittent failures on new nodes only. A typo or port difference in the registry host means credentials are never sent.

Key points

Secrets must be in the same namespace as the pod and of type kubernetes.io/dockerconfigjson. Tokens expire (ECR 12 h). Prefer cloud identities over static passwords.

Key checks
  • docker ps -a — containers and exit codes
  • docker logs <c> — container output
  • docker inspect <c> — config, mounts, network, state
ReferenceWhat it is1 section · depth on demand

How it works

The client requests a token from the registry auth endpoint and uses it for manifest and blob requests. Kubernetes passes the pull secret to the kubelet, which uses it when the runtime pulls. Cloud registries often use short-lived tokens refreshed by a credential provider.

ReferenceImportant terms & boundaries3 sections · depth on demand

Credentials per tool

ToolHow
Dockerdocker login registry.example.com → ~/.docker/config.json (use a credential helper)
Podmanpodman login → ${XDG_RUNTIME_DIR}/containers/auth.json
KubernetesimagePullSecrets (type kubernetes.io/dockerconfigjson) or node/workload identity (ECR, ACR, GAR)
kubectl create secret docker-registry regcred --docker-server=registry.example.com --docker-username=bot --docker-password=<token>

Documented example, not captured output. Use read-only robot accounts or tokens with expiry.

In depth

Registry authentication follows the Docker registry token flow: the first request returns 401 with a WWW-Authenticate header naming the token service; the client sends credentials there, gets a short-lived bearer token and retries.

Kubernetes: three places a pull credential can come from

SourceScopeNotes
imagePullSecrets on the PodThat PodSecret type kubernetes.io/dockerconfigjson, same namespace
imagePullSecrets on the ServiceAccountEvery Pod using that ServiceAccountAdded automatically at admission
Kubelet credential provider / node configWhole nodeUsed for cloud registries (ECR, ACR, GAR) with short-lived tokens

Worked setup

kubectl -n app create secret docker-registry regcred \
  --docker-server=registry.example.com --docker-username=ci --docker-password="$TOKEN"
kubectl -n app patch serviceaccount default \
  -p '{"imagePullSecrets":[{"name":"regcred"}]}'
kubectl -n app get pod web-0 -o jsonpath='{.spec.imagePullSecrets}'

Reading pull errors

Event textMeaning
401 Unauthorized / authentication requiredNo credential matched the registry host, or it is wrong
403 ForbiddenCredential valid, but lacks pull rights on that repository
manifest unknownAuthenticated fine; the tag or digest does not exist

The server name in the secret must match the image reference exactly, including the port (registry.example.com:5000).

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Common mistakes

  • Registry credentials stored in plain text.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
private registry authenticationimagePullSecretsdocker login registry
Confirmation

Confirm action

Continue?