You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configure Kubernetes secrets for Jenkins Configuration as Code plugin
Prerequisites
SECRETS environment variable should provide a path to mounted secret volume.
Kubernetes secrets with all required values.
volumeMounts and volumes directives of Kubernetes manifest should have records for Kubernetes secrets mounts.
Sample configuration
---
apiVersion: v1kind: ConfigMapmetadata:
name: jenkins-cascdata:
jenkins.yaml: | jenkins: location: url: http://jenkins/ adminAddress: "${SECRET_JENKINS_ADMIN_ADDRESS}"
---
kind: SecretapiVersion: v1metadata:
name: jenkins-secretstype: Opaquedata:
# All values for secrets should be provided in base64 encodingSECRET_JENKINS_ADMIN_ADDRESS: YWRtaW5AZXhhbXBsZS5jb20=
---
apiVersion: apps/v1beta1kind: StatefulSetspec:
containers:
- name: jenkinsenv:
# Read the configuration-as-code from the ConfigMap
- name: CASC_JENKINS_CONFIGvalue: /var/jenkins_config/jenkins.yaml# With the help of SECRETS environment variable# we point Jenkins Configuration as Code plugin the location of the secrets
- name: SECRETSvalue: /secrets/jenkins# Mount the configuration-as-code ConfigMapvolumeMounts:
- name: jenkins-configuration-as-codemountPath: /var/jenkins_config
- name: jenkins-secretsmountPath: /secrets/jenkinsreadOnly: truevolumes:
# The configuration-as-code ConfigMap
- name: jenkins-configuration-as-codeconfigMap:
name: jenkins-casc
- name: jenkins-secretssecret:
secretName: jenkins-secrets