During the weekend, I wanted to try creating a CI/CD pipeline for web-applications I’ve been developing ( details on a separate post). Given the only experience I have with such technologies (CI/CD Pipeline) is seeing them from marketing slide – this is an opportunity for me to learn and document my experience.
When you think CI/CD- you’ll always going to come across Jenkins. Now, while researching – there are multiple “Jenkins” that you can install. Namely:
Jenkins – this is the legacy/ first application.
Jenkins: Blue Ocean – this is the “skinned” version of Jenkins above.
Jenkins X: modern CI/CD built for kubernetes.
I wanted to try Jenkins-X but after reading the documentation, it looks like a weekend work is not enough for me to get going as I only have an on-prem k8s running so I settled instead in installing jenkins: blueocean.
It comes as a docker-image so installing it in kubernetes is straight forward.
The only thing that took awhile to resolve is the security group which, weirdly, was not documented. The error
touch: cannot touch ‘/var/jenkins_home/copy_reference_file.log’: Permission deniedissue when trying to mount the /var/jenkins_home
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
Solution: Run the container under uid:gid 1000:1000
Here’s the resulting deployment manifest:
apiVersion: apps/v1 kind: Deployment metadata: name: jenkins namespace: jenkins labels: app: jenkins spec: replicas: 1 selector: matchLabels: app: jenkins template: metadata: labels: app: jenkins spec: containers: - name: jenkins image: jenkinsci/blueocean:1.23.2 ports: - name: jenkins containerPort: 8080 volumeMounts: - name: jenkins-home mountPath: /var/jenkins_home securityContext: runAsNonRoot: true runAsUser: 1000 fsGroup: 1000 volumes: - name: jenkins-home persistentVolumeClaim: claimName: jenkins-pvc
When the pod is up, just check the logs to get the initial password
kubectl logs <pod name> -n <namespace>
Once it’s up, just browse your ingress – and you should be greeted with the jenkins banner and setup. (set the username and plugin install)
UPDATE: After some thoughts – i’ll pause the jenkins foray for now and instead, focus on doing the CI/CD pipeline thru gitlab instead. I’ll have blogpost once I have everything setup.
Pingback: A private cloud – all for myself » Web Development/ Gitlab CICD Experience