Image Pullback Issues
Log in to Docker
docker loginWhen prompted, enter your Docker username and password.
The login process creates or updates a config.json file that holds an authorization token.
View the config.json file:
cat ~/.docker/config.jsonThe output contains a section similar to this:
Create a Secret based on existing Docker credentials
A Kubernetes cluster uses the Secret of kubernetes.io/dockerconfigjson type to authenticate with a container registry to pull a private image.
If you already ran docker login, you can copy that credential into Kubernetes:
Replace the path in the below command
kubectl create secret generic regcred --from-file=.dockerconfigjson=/home/hcmlxadmin/.docker/config.json --type=kubernetes.io/dockerconfigjsonCreate a Pod Deployment
nano testpod.ymlapiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: nginx
imagePullSecrets:
- name: regcredSave the file
Last updated
Was this helpful?