Jenkins Kubernetes Plugin: How to specify private docker repo credentials via the UI?

3/11/2019

I'm currently using the Kubernetes Plugin for Jenkins to on-demand provision Jenkins workers on my kubernetes cluster.

A base image for the worker node is stored in my (artifactory) docker registry, and the Kubernetes plugin is configured to pull this image to spawn workers.

My artifactory docker repo was not using authentication but I've now moved it to authenticating image pulls. However there is no apparent way to provide the registry credentials via the UI.

The Jenkins K8s plugin documentation doesn't appear to mention a way to do this via the UI either. There is minimal documentation on the "imagePullSecrets" parameter, but the scope of this seems to apply to pipeline definition or kubernetes template definitions, which seems like overkill.

Is there something I'm missing? I'd be thankful if someone could point out the steps to configure this without having to create a kubernetes template configuration from scratch again.

Thanks in advance!

-- Traiano Welcome
docker
jenkins
jenkins-plugins
kubernetes

1 Answer

6/19/2019

the imagePullSecret relates to a Kubernetes secret where your credentials are stored

Details of how to create the Kubernetes can be found here: pull image from private registry

Create a Secret by providing credentials on the command line

Create this Secret, naming it regcred:

kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>

where:

<your-registry-server> is your Private Docker Registry FQDN. (https://index.docker.io/v1/ for DockerHub)
<your-name> is your Docker username.
<your-pword> is your Docker password.
<your-email> is your Docker email.

then you should be able to set your imagepullsecret to: regcred

-- Graeme
Source: StackOverflow