How do I create an image pull secret to pull a private image from Docker Hub

Posted October 13, 2020 2.5k views

I’m not sure about the format of my image pull secret in Kubernetes Advanced Options.

When I “Create a new secret” I use a random secret name (or does the secret name has to be something specific?). Then I encode my docker hub username and password in base64 (username:password) as my “image pull secret data”. Is this the right approach?I get the following error message: “Error creating set”.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

To create a docker secret, you can follow the example here:

Below the kubectl description there’s an example of how to reference it in your pod/deployment.

And now for a shameless plug: If you’re looking to use Amazon for your registry, I wrote a little tool that makes the integration easy: