ErrImagePull on GitHub private registry
I am new to k8s and trying deploy a daemonset using GitHub Actions. Image was also built using GitHub actions. When it is attempted to deploy Linode Kubernetes through following error:
Failed to pull image "ghcr.io/mazhagiah/cpaas-slproxy:dev": rpc error: code = Unknown desc = failed to pull and unpack image "ghcr.io/mazhagiah/cpaas-slproxy:dev": failed to resolve reference "ghcr.io/mazhagiah/cpaas-slproxy:dev": failed to authorize: failed to fetch anonymous token: unexpected status: 401 Unauthorized
Could you help me how to authorize to pull image from ghcr private registry?
2 Replies
HTTP 401 errors occur when your request does not contain the authentication credentials required to access or work with your source repo/registry. You need to make sure that, not only are the package registry's permissions set to allow downloads but that your access token is included in the Kubernetes pull request.
I found some discussion about this issue on the ServerFault and StackOverflow forums on posts that appear to have been marked as "Solved":
- Docker build / docker compose up error: Unknown desc = failed to fetch anonymous token: unexpected status: 401 Unauthorized - Stack Overflow
- kubernetes - Getting 401 Unauthorized while trying to pull images from local docker registry (harbor) from k3s - Server Fault
- docker - Kubernetes not pulling image from JFrog private registry - Stack Overflow
Thank you @jhartman
I managed to create secret with GitHub PAT and used it as a default serviceaccount for image pull
Solution partly used from this: https://ryaneschinger.com/blog/using-google-container-registry-gcr-with-minikube/