Can't pull docker images from Kubernetes
Summary
When deploying to Kubernetes using GitLab CI/CD Cluster integration, I can't pull docker images from the GitLab container registry.
Steps to reproduce
- Adding an existing Kubernetes cluster to the project
- Deploy a simple application using
kubectlorhelm - Check deployment status on the cluster using
kubectl get pods
Example Project
None
What is the current bug behavior?
The Kubernetes cluster can't pull the images from the GitLab container registry.
All pods are in ImagePullBackOff state.
Need to manually apply/create imagePullSecret credentials to all pods/service-accounts.
What is the expected correct behavior?
Because the Kubernetes cluster is Managed by GitLab, resources deployed through GitLab CI using Kubernetes integration should at least be able to pull images from the deployed repo.
When creating a namespace dynamically using GitLab environment, all service-accounts (default and the one created by GitLab) should use an imagePullSecret pointing to the container registry.
Relevant logs and/or screenshots
None
Possible fixes
Currently using this script github.com/titansoft-pte-ltd/imagepullsecret-patcher as a workaround.
It will loop on each namespace, patch each service-account in that namespace using the imagePullSecret containing the credentials to the GitLab container registry