My goal is to set up jenkins agent pod in kubernetes cluster for which the docker image is needed to be pulled from a private registry. I cannot provide the credentials in source control. Is there any possible way to fetch credentials from jenkins secrets rather than providing a kubernetes secret in podSpec?
I've done this before when the images were stored in Azure Container Registry (ACR). In that case we used the "with credentials" plugin combined with the "Azure CLI" plugin to push/pull the images from ACR.
Here is a similar example, but using docker hub instead of ACR as the private registry: https://medium.com/@gustavo.guss/jenkins-building-docker-image-and-sending-to-registry-64b84ea45ee9