create k8s secret for docker registry

I am writing my experience, it is well documented on k8s site as well. Below is the link to refer:

Step 1: login to docker from command line: “docker login”. It will prompt for username and password. Provide that, it will create on json file “~/.docker/config.json”

Output of json : cat ~/.docer/config.json

We will use that json file and create the secret

kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \

once it create the secret, we can just check the output
kubectl get secret regcred -o yaml

Now this secret we can use in any pod/deployment for image pulling. Check this blog: