Kubernetes imagePullSecret Generator

Build the .dockerconfigjson a private registry pull needs, with the registry key written the way the kubelet matches it. Give it the image you are pulling and it checks the key against what that reference resolves to, which is the mismatch that fails as though the image did not exist.

Secret
Registry credential

Nothing here leaves the browser. The value you type is written into the output below in plain text, because that is what a Secret manifest is.

Attach it
Check it against the image you are pulling

Not part of the output. Used to check that the registry key matches what the image reference resolves to.

imagepullsecret.yaml

updates as you type

    Common mistakes

    These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.

    1. Writing the Docker Hub registry URL by hand

      It must be https://index.docker.io/v1/ exactly. Anything else, including docker.io, produces a secret that authenticates nothing and the pull silently falls back to anonymous.

      Instead:Use the exact URL. This is the single most common failure with pull secrets.

    2. Using an Opaque secret

      The type must be kubernetes.io/dockerconfigjson and the key must be .dockerconfigjson with the leading dot. An Opaque secret with the same content is ignored with no error.

      Instead:Set both the type and the key exactly.

    3. Creating the secret in the wrong namespace

      Pull secrets are namespaced and not shared. A secret in default does nothing for a pod in production.

      Instead:Create it in every namespace that pulls, or attach it to the service account.

    What an imagePullSecret is, and the four ways it silently does nothing

    A pull secret is one JSON file, the same one Docker writes to ~/.docker/config.json, wrapped in a Secret of a specific type. The kubelet reads it before pulling an image from a private registry. Every way of getting it wrong produces the same symptom, ImagePullBackOff, with a registry error that reads as though the image does not exist, so the shape below is worth knowing rather than copying.

    The registry key has to match what the image resolves to

    The kubelet looks the credential up by the registry the image reference resolves to. Docker Hub is the case that catches everyone: its key is a URL left over from the v1 registry API, not the host in the image reference and not the host the pull goes to. A Secret keyed on docker.io applies cleanly, mounts cleanly, matches nothing, and the pull falls back to anonymous.

    nginx:1.27                   -> https://index.docker.io/v1/
    myuser/private-app:1.0       -> https://index.docker.io/v1/
    ghcr.io/org/app:1.0          -> ghcr.io
    localhost:5000/app           -> localhost:5000
    1234.dkr.ecr.eu-west-1...    -> 1234.dkr.ecr.eu-west-1.amazonaws.com
    
    # Docker's rule: the part before the first slash is a
    # registry only if it has a dot or a colon in it, or is
    # exactly localhost. Otherwise it is a Docker Hub user.

    The type and the key are both exact, and the dot is part of the key

    The Secret type must be kubernetes.io/dockerconfigjson and the key inside it must be .dockerconfigjson with the leading dot. An Opaque Secret with the same content is ignored. A key written without the dot is ignored. Neither produces an error at apply time, because both are valid objects: the failure arrives later, on the node, as a pull that was never authenticated.

    type: kubernetes.io/dockerconfigjson
    stringData:
      .dockerconfigjson: |-
        {"auths": ...}
    
    # The older format still exists and is not the same:
    #   type: kubernetes.io/dockercfg
    #   key:  .dockercfg
    #   body: the auths map WITHOUT the "auths" wrapper
    # Mixing the two is the second most common version
    # of this mistake.

    What is inside the file, and why auth is the field that matters

    The JSON is a map of registry to credential. Each credential carries a username, a password and an auth field, and auth is base64 of username:password. Most registries read auth and ignore the other two, which is why a config with only username and password works against one registry and returns 401 from another. base64 here is a transport detail from the format, not protection.

    {
      "auths": {
        "https://index.docker.io/v1/": {
          "username": "myuser",
          "password": "dckr_pat_xxx",
          "auth": "bXl1c2VyOmRja3JfcGF0X3h4eA=="
        }
      }
    }
    
    echo bXl1c2VyOmRja3JfcGF0X3h4eA== | base64 -d
    myuser:dckr_pat_xxx

    Two ways to attach it, and only one of them covers pods you did not write

    imagePullSecrets on a pod spec covers that workload. On a ServiceAccount it covers every pod that uses the account, which includes pods created by operators and charts whose manifests you do not control, and it is the route most people want. The catch is timing: the account's list is copied onto a pod when the pod is created, so patching the ServiceAccount does nothing for pods that already exist.

    # per workload
    spec:
      imagePullSecrets:
        - name: regcred
      containers: [...]
    
    # per ServiceAccount, applies to every pod using it
    kubectl patch serviceaccount default -n prod \
      -p '{"imagePullSecrets":[{"name":"regcred"}]}'
    
    # and the Secret is namespaced: five namespaces
    # pulling the same private image need five copies.

    Where a static secret is the wrong answer entirely

    An ECR authorization token expires 12 hours after it is issued, so a Secret built from one works today and breaks overnight, on a pod that merely rescheduled. Use the node's IAM role through the ECR credential provider, the credential helper, or a CronJob that recreates the Secret. Google's key file has the opposite problem: it never expires, so it works until it leaks, and Workload Identity removes it. The kubelet also has its own credentials on the node, which is why identical manifests pull on one cluster and not another.

    # ECR: valid for 12 hours from issue
    aws ecr get-login-password --region eu-west-1
    
    # GCR / Artifact Registry with a key file
    username: _json_key
    password: <the entire key.json, newlines and all>
    
    # On EKS and GKE the node credential provider often
    # means no pull secret is needed at all, which is why
    # the missing one is not noticed until a workload
    # moves to a differently built cluster.

    More kubernetes tools

    Kubernetes YAML Generator Answer a few questions, get a manifest Kubernetes YAML Validator Is this YAML valid, and where is it wrong? Kubernetes Rollout & Probe Timing Restart loops, capacity dips and stuck drains Kubernetes Service Checker Will this Service have any endpoints? Kubernetes Network Policy Viewer What can reach what, and what just broke Kubernetes Manifest Diff What actually changed Kubernetes Resource Calculator What these manifests actually reserve Kubernetes RBAC Viewer Who can actually do what Kubernetes Deployment Generator See the capacity dip before you deploy Kubernetes Service Generator port, targetPort, and which one you meant Kubernetes StatefulSet Generator Stable names, and volumes that outlive you Kubernetes QoS Class Calculator And where you sit in the eviction order Kubernetes Node Capacity Planner Allocatable is not capacity Kubernetes Max Pods per Node Calculator The ENI limit, not the 110 default Kubernetes Label Selector Tester Which key failed, not just that one did Kubernetes Taint & Toleration Tester Tolerations permit, they do not attract Kubernetes Resource Name Validator RFC 1123 subdomain, label, or 1035 Kubernetes Label & Annotation Validator Why your image tag is not a legal label Kubernetes CrashLoopBackOff Guide The status is a timer, not a cause Kubernetes TLS Certificate Decoder When it expires, and what it covers Kubernetes ServiceAccount Token Decoder Bound or legacy, and when it dies Kubernetes cert-manager Certificates Issuer scope, and the rate limit that costs a week Kubernetes Flux HelmRelease Generator With the source it cannot work without Kubernetes Helm Chart Generator Chart.yaml, values, and working templates Kubernetes Argo CD Application Generator The defaults that are off, turned on Kubernetes Ingress Generator pathType, and the TLS secret that fails quietly Kubernetes HPA Generator Why it says unknown and never scales Kubernetes SecurityContext Generator Pod level, container level, and which wins Kubernetes Probe Generator How long it gets to start before liveness kills it Kubernetes PVC Generator Access modes your storage can actually do Kubernetes ResourceQuota Generator And the LimitRange that stops it breaking deploys Kubernetes CronJob Generator The fields that decide whether it runs Kubernetes NetworkPolicy Generator With the DNS rule already in it Kubernetes RBAC Generator And what it actually grants Kubernetes PodDisruptionBudget Generator Can this budget ever be satisfied? Kubernetes API Deprecation Checker What breaks on the next upgrade Kubernetes Kubeconfig Viewer Read it without handing it to anyone Kubernetes Quantity Parser What 512Mi, 100m and 1e3 actually mean Kubernetes Multi-Document YAML Splitter One file per object, in apply order Kubernetes .env to ConfigMap & Secret Split the credentials out on the way Kubernetes Secret Decoder See what is actually in there Kubernetes Ingress to Gateway API Which annotations silently stop working Kubernetes Manifest Visualizer What points at what, and what points at nothing Kubernetes Patch Tester Which --type, and what it deletes Kubernetes kubectl JSONPath Tester kubectl's dialect, not generic JSONPath Kubernetes Node Affinity Tester Required excludes, preferred only scores Kubernetes Helm Values Diff A missing key is a third value Kubernetes Pod and Service CIDR Fixed at cluster creation Kubernetes Secret Encoder base64 is not encryption Kubernetes API Version Checker Will this apply on that cluster Kubernetes Go Template Tester Go truthiness is not JavaScript's Kubernetes Cluster Cost Estimator At your rates, not a price table Kubernetes Kustomize Build Transformers run in kustomize's order Kubernetes Helm Chart Validator version is SemVer, appVersion is not

    Elsewhere on the site