Question

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

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”.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Accepted Answer

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

https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-by-providing-credentials-on-the-command-line

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: https://github.com/nabsul/k8s-ecr-login-renew

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel