Mounting Generic Secrets
Learn to mount generic Secrets to secure the deployed Jenkins.
We'll cover the following...
We'll cover the following...
Looking into the definition
Let’s see how we can mount the Secret we created. For this, let’s see an updated definition of jenkins.yml. The definition (limited to the relevant parts) is as follows:
apiVersion: apps/v1kind: Deploymentmetadata:name: jenkinsspec:...template:...spec:containers:- name: jenkinsimage: vfarcic/jenkinsenv:- name: JENKINS_OPTSvalue: --prefix=/jenkinsvolumeMounts:- name: jenkins-homemountPath: /var/jenkins_home- name: jenkins-credsmountPath: /etc/secretsvolumes:- name: jenkins-homeemptyDir: {}- name: jenkins-credssecret:secretName: my-credsdefaultMode: 0444items:- key: usernamepath: jenkins-user- key: passwordpath: jenkins-pass...
-
Lines 19–20: We add
jenkins-credswhich mounts the/etc/secretsdirectory. -
Lines 24–26: The
jenkins-credsvolume references the Secret namedmy-creds. ...