I'm traying to create a Pod from a docker private image. For this i have created a secret like this:
kubectl create secret docker-registry $SECRETNAME --docker-server=$DOCKER_REGISTRY_SERVER --docker-username=$DOCKER_USER --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL
and then in the pod yml file,
apiVersion: v1
kind: Pod
metadata:
name: website.com
labels:
app: website
spec:
containers:
- name: my-web
image: company/web:1.0.2
imagePullPolicy: Always
command: [ "echo", "SUCCESS" ]
ports:
- name: web-port
containerPort: 8080
imagePullSecrets:
- name: docker-hub-key
When I run "kubectl create -f web-pod.yml", and then I run "kubectl get pod website.com" I get the following error:
- Failed to pull image "company/web:1.0.2": rpc error: code = Unknown desc = Error response from daemon: repository company/web not found: does not exist or no pull access
- Back-off pulling image "company/web:1.0.2"
Please help, thanks in advance
company
something you're using for the sake of this post or are you actually using that? – frankgreco$SECRETNAME == 'docker-hub-key'
, what do you get when you runkubectl get secret docker-hub-key -o yaml
. Also, are you sure that the user has access to the image? It is common to push images with a users account but pull them into k8s with a system account. The repository will default to only giving access to the user that pushed the image initially. – erk