Image Pull Secrets for Private Registries
Intermediate · 30 minutes · 5 tasks, checked automatically · 100 points
In this lab you will learn how to authenticate Kubernetes to pull container images from private registries using Image Pull Secrets. You will simulate a private registry using a local Docker registry running inside the kind cluster, push a custom image to it, create the necessary Kubernetes Secret of type `kubernetes.io/dockerconfigjson`, and deploy a Pod that uses the secret to successfully pull the image. This is a foundational security skill required in virtually every production Kubernetes environment.
What you’ll learn
- Deploy a private container registry inside the Kubernetes cluster and expose it via a NodePort service
- Create a Kubernetes Image Pull Secret (docker-registry type) that stores registry credentials
- Deploy a Pod that references the Image Pull Secret and successfully pulls an image from the private registry
How this lab works
- Start the lab: One click starts a real Kubernetes cluster on your computer (kind), with kubectl ready in a toolbox terminal.
- Work through 5 tasks: Each task says what to build or fix. You do it yourself, in a real terminal, with hints when you get stuck.
- Check your work: Check my work reads your live cluster and says, task by task, what passed and what to fix.
- Finish and keep going: 100 points, your progress saved, and the next lab to try.
What it runs on
- Cluster: A real Kubernetes cluster on your computer (kind)
- Kubernetes: 1.34.8
What you need
- A free LearnXops account
- The LearnXops desktop app for macOS, Windows or Linux
- Docker Desktop installed and running
- A kind cluster created in the Kubernetes Playground
Topics: image-pull-secrets, private-registry, docker-registry, serviceaccount, security, authentication, kubernetes-secrets
Create a free account to start this lab.
Keep going
- ServiceAccount Tokens and Projected Token Volumes
- RBAC ClusterRoles and ClusterRoleBindings Across Namespaces
- Audit Permissions with kubectl auth can-i and Impersonation
- Drop Linux Capabilities and Run as Non-Root
- Benchmark Cluster Hardening with kube-bench (CIS)
- Scan Images and Live Workloads for CVEs with Trivy