I am failing to pull from my private Docker Hub repository into my local Kubernetes setup running on Vagrant:
Container "hellonode" in pod "hellonode-n1hox" is waiting to start: image can't be pulled
Failed to pull image "username/hellonode": Error: image username/hellonode:latest not found
I have set up Kubernetes locally via Vagrant as described here and created a secret named "dockerhub" with kubectl create secret docker-registry dockerhub --docker-server=https://registry.hub.docker.com/ --docker-username=username --docker-password=... --docker-email=... which I supplied as the image pull secret.
I am running Kubernetes 1.2.0.
You can follow these instructions on how to configure nodes to authenticate to a private repository in order to configure the kubelets to make Docker use your credentials, or follow +Phagun Baya's solution with imagePullSecrets that applies to pods.
Create k8 Secret:
Then in pod or rc config mention the secret. Example :
Docker auth config
Or
To pull a private DockerHub hosted image from a Kubernetes YAML:
Run these commands:
If your username on DockerHub is
DOCKER_USER
, and your private repo is calledPRIVATE_REPO_NAME
, and the image you want to pull is tagged aslatest
, create thisexample.yaml
file:Then run: