Kubernetes can't access gitlab registry with access token

3/1/2020

I'm deploying my app hosted on Gitlab registry on Kubernetes.

From Gitlab, I generated an access token and created a secret

kubectl create secret docker-registry gitlab-registry \
 --docker-server=registry.gitlab.com \
 --docker-username=kosted \
 --docker-password=HERE-MY-SECRET \
 --docker-email=HERE-MY-MAIL

They are all valid. But when I deploy my app, I got this error :

Warning  Failed     17s (x2 over 34s)  kubelet, gke-gara-cluster-default-pool-affe594e-hslk  Failed to pull image "registry.gitlab.com/gara-project/back-end-micro-services/mebooks:latest": rpc error: code = Unknown desc = Error response from daemon: Get https://registry.gitlab.com/v2/gara-project/back-end-micro-services/mebooks/manifests/latest: denied: access forbidden
  Warning  Failed     17s (x2 over 34s)  kubelet, gke-gara-cluster-default-pool-affe594e-hslk  Error: ErrImagePull
  Normal   BackOff    5s (x3 over 33s)   kubelet, gke-gara-cluster-default-pool-affe594e-hslk  Back-off pulling image "registry.gitlab.com/gara-project/back-end-micro-services/mebooks:latest"
  Warning  Failed     5s (x3 over 33s)   kubelet, gke-gara-cluster-default-pool-affe594e-hslk  Error: ImagePullBackOff

I know that everything works fine, because when I change the access token by my password, kubernetes can access the registry and download the docker image, but I don't want to pu in clear my password.

Please, how could I do ? Thanks in advance.

-- Teddy Kossoko
docker
gitlab
kubernetes

0 Answers