The easiest thing to do is start up a Jenkins instance, configure it the way I want, exec
into it (e.g., kubectl exec -it {my-jenkins-pod} /bin/bash
), cd
into /var/jenkins_home
, and just grab the appropriate files and base64 encode them.
In this case the appropriate files are:
/var/jenkins_home/credentials.xml
/var/jenkins_home/secrets/master.key
/var/jenkins_home/secrets/hudson.util.Secret
You can just base64 -w 0 credentials.xml
for instance to get the base64 encoded contents of any of those files. Then just copy it and paste it into the appropriate k8s secret.
The first k8s secrete you need to create is:
apiVersion: v1
kind: Secret
metadata:
name: jenkins-credentials
data:
credentials.xml: AAAGHckcdhie==
Where the value given to credentials.xml
is a base64
encoded string of the contents of the credentials.xml file.
The other k8s secret you need to create is:
apiVersion: v1
kind: Secret
metadata:
name: jenkins-secrets-secret
data:
master.key: AAAdjkdfjicki+
hudson.util.Secret: AAAidjciud=
Then in your values.yaml
:
CredentialsXmlSecret: jenkins-credentials
SecretsFilesSecret: jenkins-secrets-secret
Edit: Since Apr 22, 2019, version 1.00, the name convention has changed
Thanks to ythdelmar, who pointed out in the comments, it is now
credentialsXmlSecret: jenkins-credentials
secretsFilesSecret: jenkins-secrets-secret
without the first capital.