Image Pull Secrets in Kubernetes - Failed

Hello everybody,
@KodeKloud @Inderpreet

at first i forgot to take some screenshots but i describe the task. In this task i must create a Image Pull Secrets.

My Steps were the following:

the first task was to create a Secret in the default namespace with credentials were given.
I do this with the following Command:

kubectl create secret docker-registry myregistrykey --docker-server= --docker-username= --docker-password= --docker-email=

after that the next task was to modify the default service account in the default namespace.

I do this with the following Command:

kubectl edit serviceaccount default

and i add under the secrets section the above secret with the name myregistrykey and save it.
I did’t get a error message and i click on finish and i get the following message:

I hope somebody please can help me.

I got the same task assigned today. The task asked me to create the secret with value docker-server=SERVER. I used the following command


but the task failed with

‘docker-server’ value is incorrect in secret ‘myregistrykey’.

Now I see that I put an extra ‘g’ on docker-email. but the message says docker-server instead.
@Inderpreet @rahul456

Hello, @francilio In case of Docker, We use
kubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL

1 Like

The task is about pulling image from a private registry. Therefore, the command should be as:

kubectl create secret docker-registry myregistrykey --docker-server=SERVER --docker-username=cap --docker-password=DOCKER_PASSWORD --docker-email=capkke@gmail.com

kubectl get secrets myregistrykey

You will get

NAME             TYPE                              DATA    AGE
myregistrykey    kubernetes.io/.dockerconfigjson   1       1d

With kubectl create secret generic ,you will get Type as Opaque not .dockerconfigjson which kubelet needs to pull secrets to access private registry.

2 Likes