Reputation: 6122
I have a scala application. I have pushed the docker image at a private registry. Now, as I understand I need to create a secret to pull the image from a private repository using a yaml file.
I have created a secret using the following command :
kubectl create secret docker-registry regsecret --docker-username=token --docker-password=<private repo password> --docker-email=<email id which I use to access the private repo>
This successfully creates a secret.
The image is now pushed to The image name is "imagecheck", and repo name is "repocheck". Now, when I try to pull the image from my yaml file, it gives an error saying
Failed to pull image "abc.somerepo.com/repocheck/imagecheck:latest": image pull failed for abc.somerepo.com/repocheck/imagecheck:latest, this may be because there are no credentials on this request
This is my yaml file :
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: onlinescoring
spec:
replicas: 4 # tells deployment to run 2 pods matching the template
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 0
template: # create pods using pod definition in this template
metadata:
labels:
app: online1
spec:
containers:
- name: cont1
image: abc.somerepo.com/repocheck/imagecheck:latest
ports:
- containerPort: 32014
imagePullSecrets:
- name: regsecret
I am able to pull the image from my terminal. please guide as to how to resolve the error.
Thanks in advance!
Upvotes: 0
Views: 644
Reputation: 39527
Delete the secret and the recreate using:
kubectl create secret docker-registry regsecret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=token --docker-password=<private repo password> --docker-email=<email id which I use to access the private repo>
Replace DOCKER_REGISTRY_SERVER
with private registry url.
Default value: https://index.docker.io/v1/
Upvotes: 3