Unable to pull image from JFrog docker registery - docker

I'm using JFrog repository as my private jfog repo. And I have specified the secret in order to authenticate it. The pod fails with an ImagePullBackOff error, when I describe the pod I see
Failed to pull image "private_registry/image_name": rpc error: code =
Unknown desc = failed to pull and unpack image
"private_registry/image_name": failed to do request: Head
https://xx.xx.xx.xx:port-number/v2/<docker-registryname>/<application-name>/manifests/<tag>:
http: server gave HTTP response to HTTPS client Warning Failed
23m (x4 over 24m) kubelet, worker01 Error: ErrImagePull
when I pull the same image using docker pull , the image get pulled successfully

While having the HTTP server communicating with the HTTPS server (probably due to the usage of a self-signed certificate) being the private registry, registering the concerned registry as an insecure registry with the docker client could resolve the docker error.
{ "insecure-registries":["IP:PORT"] }
An entry similar to the above need to be included in the /etc/docker/daemon.json file and considering the environment to be in K8s, it needs to be configured on all the nodes.

Related

K8S on Docker Desktop cannot pull private repo - pull access denied

I have logged in to the Docker hub using the CLI command: docker login. Entered username and password and I can pull and push images to Docker hub.
However, my K8S can't. I am trying to apply a deployment that should pull those images into its pods but I got the following error when running kubectl describe pod POD_NAME:
Warning Failed 9s kubelet Failed to pull image "myprivate/repo:tag": rpc error: code = Unknown desc = Error response from daemon: pull access denied for myprivate/repo, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
How to make the docker run in the pods to also be logged to the docker hub as well as doing it from my terminal?
Create "image pull secret" and define on your deployment. Here is how you can do https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/

How to specify registry credentials on kubectl set image?

I have a deployment that uses a private registry by the use of imagePullSecrets. It is running ok but when I try to update its image by specifying another tag like this:
kubectl set image deployment/mydeployment mycontainer=my_docker_hub_user/my_image:some_tag
my pod get a ImagePullBackOff status with the message:
Failed to pull image "my_docker_hub_user/my_image:some_tag": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/my_docker_hub_user/my_image/manifests/some_tag: unauthorized: incorrect username or password
But I cannot find how to inform user and password
Kubernetes uses secrets to store the credentials to pull from a private docker registry. You can check out this guide to set it up properly as most likely the Secret defined in the imagePullSecrets does not have access to your new image. You need to define a Secret that has access to the private docker registry and update the deployment with the new imagePullSecrets.

Failed to pull dockerhub image on Kubernetes

I'm using minikube for kubernetes deployment and I am getting this error:
Failed to pull image
"libsynadmin/libsynmp:core-api-kubernetes-0.9.8.1": rpc error: code =
Unknown desc = Error response from daemon: Get
https://registry-1.docker.io/v2/: net/http: TLS handshake timeout ?
I think you need to create docker registry cache to pull images from since the error indicate slow internet connection
read more at Docker
Are you running behind company proxy then you have to use minikube start command as follows:
minikube start --docker-env HTTP_PROXY=http://$YOURPROXY:PORT \
--docker-env HTTPS_PROXY=https://$YOURPROXY:PORT
Ref: minikube issue

gcloud cluster cannot pull eu.gcr.io authentication required

I have set up a Kubernetes cluster on gcloud via gitlab.
I have some trouble pulling my images when I deploy my application.
I use a gcloud cluster with a registry on the same gcloud project. Normally, I'm able to pull my image directly without any modification (supposed to use the Compute Engine default service account?).
But I get a unauthorized on my pod when he try to pull the image :
Warning Failed 3m (x2 over 3m) kubelet, gke-production-default-pool-********-**** Failed to pull image "eu.gcr.io/[My-Project]/services-identity:715bfffa": rpc error: code = Unknown desc = unauthorized: authentication required
Warning Failed 3m (x2 over 3m) kubelet, gke-production-default-pool-********-**** Error: ErrImagePull
Normal BackOff 2m (x6 over 3m) kubelet, gke-production-default-pool-********-**** Back-off pulling image "eu.gcr.io/[My-Project]/services-identity:715bfffa"
Warning Failed 2m (x6 over 3m) kubelet, gke-production-default-pool-********-**** Error: ImagePullBackOff
Normal Pulling 2m (x3 over 3m) kubelet, gke-production-default-pool-********-**** pulling image "eu.gcr.io/[My-Project]/services-identity:715bfffa"
I deploy via gitlab-ci with the following command line:
helm upgrade --install services-identity -f ./deploy/env/production-values.yml ./deploy/ --set image.tag=${CI_COMMIT_SHA:0:8} --namespace=production --wait
For information, I can pull the registry when this one is public, I can also pull the image locally via a docker login(using my gcloud account).
Thanks in advance for your advice.
This is very similar to this: What's the minimal permissions I need to configure for a GKE node pool to pull from a private GCR repo in the same project?, except that you are not mentioning that it's on GKE so I assume is on GCE.
You can use a json_key_file.
On all your nodes (assuming you are using Docker):
$ docker login -u _json_key --password-stdin https://gcr.io
Or the same json_key_file using ImagePullSecrets in the pod spec as described here.
Or you can use on all your Kubernetes nodes:
$ gcloud auth configure-docker
Thanks for your helpful response. On the similar issues you have shared, I have found a solution Use Least Privilege Service Accounts for your Nodes.
The problem is on the Cloud API access scopes level, I have recreated an InstanceGroup with the right scope:
The default scopes for the nodes in GKE are devstorage.read_only,
logging.write, monitoring, service.management.readonly,
servicecontrol, and trace.append. When setting scopes, these are
specified as gke-default. If you are accessing private images in
Google Container Registry, the minimally required scopes are only
logging.write, monitoring, and devstorage.read_only.

Kubernetes executor on Gitlab ERROR: Job failed: image pull failed

I tried to setup Kubernetes executor on Gitlab, but I have this error:
ERROR: Job failed: image pull failed: image pull failed for
someprivateimage:latest,
this may be because there are no credentials on this request. details:
(Error response from daemon: {"message":"Get
https://someprivateimage/latest: denied: access forbidden"})
Anyone have idea why?
You need to either:
Have the docker daemon on your node login to the docker registry. Have a look at the docker login docs
Have the pod definition pull from a private registry. Take a look at these kubernetes docs
If you're going to be doing this often, I recommend the first one.

Resources