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

  docker, dockerhub, kubernetes

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?

Source: Docker Questions