imagePullSecrets
entry. Environment variable substitution are supported for the name input, so you can use available environment
variables to construct the name dynamically, e.g., some-secret-$BUILD_NUMBER
. The name should be in
the pattern [a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*
, i.e., dot (.) concatenated
sequences of hyphen (-) separated alphanumeric words.
(See
Kubernetes Names)
If left blank, the plugin will generate a name based on the build name.
The secret name will be exposed with the environment variable $KUBERNETES_SECRET_NAME
. You can use this
in your Kubernetes configuration to reference the updated secret when the "Enable Variable Substitution in Config"
option is enabled.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: some.private.registry.domain/nginx
ports:
- containerPort: 80
imagePullSecrets:
- name: $KUBERNETES_SECRET_NAME
Note that once the secret is created, it will only be updated by the plugin. You have to manually delete it when it is not used anymore. If this is a problem, you may use fixed name so every time the job runs, the secret gets updated and no new secret is created.