Mounting Generic Secrets
In this lesson, we will mount the generic Secret to secure the deployed Jenkins.
Looking into the Definition
Let’s see how we could mount the Secret we created.
cat secret/jenkins.yml
The output, limited to the relevant parts, is as follows.
apiVersion: apps/v1beta2kind: 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...
Line 19-20: We added jenkins-creds that mounts the /etc/secrets directory.
Line 24-26: The jenkins-creds Volume references the Secret named ...
Access this course and 1500+ top-rated courses and projects.