CertGrid CertGrid
Hands-on Lab·Kubernetes and Cloud Native Security Associate

Private Registry Authentication

Private images need a credential, and Kubernetes stores it as an ordinary Secret with the password in clear. This guide reads it back out, watches a pull fail without it and again with it, and attaches it once to a ServiceAccount instead of to every Pod.

Platform Security Guide 34 of 42 Beginner

Written against the versions above. `kubernetes.io/dockerconfigjson` is base64, not encryption. `imagePullSecrets` on a ServiceAccount is applied to Pods by the ServiceAccount admission plugin.

The cka5001 cluster: one control plane and 3 schedulable workers, on Cilium.
Server NameIP AddressOSRolesCPURAMHDD
CKA5001192.168.0.41Ubuntu 26.04 LTSControl Plane Node (tainted NoSchedule)2 Core4 GB50 GB
CKA5001-NODE01192.168.0.42Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA5001-NODE02192.168.0.43Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA5001-NODE03192.168.0.44Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB

Before you start

  1. A Secret that is a registry login

  2. The auth field, which is the same thing twice

  3. A Pod that needs the credential and has not got it

  4. The same image with the Secret attached

  5. Attaching it once instead of on every Pod

Official sources