I am using JFrog as docker registry.
If I try to manually pull an image it works, but when I try the same by including in helm chart and helm install command it is throwing an error:
Error: ImagePullBackOff
pulling image registry_name/jfrogk8s:1.0
Failed to pull image registry_name/jfrogk8s:1.0: rpc error: code = Unknown desc = Error response from daemon: Get https://dip-docker-dip.bintray.io/v2/jfrogk8s/manifests/1.0: unauthorized: Unauthorized"
I have included docker registry in "/etc/docker/daemon.json"
It clearly says - unauthorized: Unauthorized
The docker registry is not invoked while pulling an internal image even though you did put docker registry in "/etc/docker/daemon.json"
in the kubernetes environment. Hence, you need to create a Docker Registry Secret
and later use it in helm installation to tell kubernetes to pull an internal image using this secret :
kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
where:
<your-registry-server>
is your Private Docker Registry FQDN. (https://index.docker.io/v1/ for DockerHub)
<your-name>
: is your Docker username.
<your-pword>
: is your Docker password.<your-email>
: is your Docker email.
To validate if the docker registry secret regcred
is created do
kubectl get secret regcred --output=yaml
Then in your helm charts value.yaml
add following line
imagePullSecret: regcred
If you need to do it the Kuberentes way your deploy.yaml
will look like this:
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: <your-private-image>
imagePullSecrets:
- name: regcred