Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.
VIDEO 🎞️ Watch Video
Prerequisites: Kubernetes cluster Helm 4.x Installing Jenkins with Helm: Helm v3.0+ must be installed on your workstation.
Artifact Hub is a web-based application that enables finding, and installing, packages for Cloud Native packages.
Add the jenkins Helm repository: 1
helm repo add jenkins https://charts.jenkins.io
Fetch the latest charts from the repository: Retrieve the package from jenkins repository, and download it locally: 1
helm fetch jenkins/jenkins --untar
Lets update values.yaml file as follow, 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Change admin password
controller:
admin:
username: "admin"
password: 'SecureP@ssw0rd!'
# Install Additional Plugins
controller:
additionalPlugins: [ 'pipeline-graph-view' , 'job-dsl' , 'junit' , 'coverage' , 'dark-theme' ]
# Configure Dark Theme
controller:
JCasC:
configScripts:
dark-theme: |
appearance:
themeManager:
disableUserThemes: true
theme: "dark"
# Configure welcome message
controller:
JCasC:
configScripts:
welcome-message: |
jenkins:
systemMessage: 🚀🚀🚀 Jenkins Prod instance 🚀🚀🚀
Install jenkins in the jenkins namespace: 1
helm install jenkins jenkins/jenkins --values jenkins-values.yaml -n jenkins --create-namespace
To confirm that the deployment succeeded, run: 1
2
3
4
5
kubectl -n jenkins get pods -w
kubectl logs jenkins-0 -n jenkins -c init --tail = 50 -f
watch -n 5 "kubectl get events -n jenkins"
port forward: 1
kubectl --namespace jenkins port-forward svc/jenkins 8080:8080
Get the Jenkins URL to visit by running these commands in the same shell: 1
2
3
4
5
6
7
8
kubectl patch svc jenkins --namespace jenkins -p '{"spec": {"type": "NodePort"}}'
export NODE_PORT = $( kubectl get --namespace jenkins -o jsonpath = "{.spec.ports[0].nodePort}" services jenkins)
export NODE_IP = $( kubectl get nodes --namespace jenkins -o jsonpath = "{.items[0].status.addresses[0].address}" )
echo http://$NODE_IP :$NODE_PORT
jenkinsUrl must be set correctly else stylesheet won’t load and the dark theme. 1
2
3
4
controller:
jenkinsUrl: http://$NODE_IP :$NODE_PORT
jenkinsAdminEmail: mkbn@mkbn.com
# don't set these via JCasC, set as helm chart values
Run helm upgrade 1
helm upgrade jenkins jenkins/jenkins --values /tmp/jenkins/values.yaml -n jenkins
Login with the username: admin and password: SecureP@ssw0rd!
Reference Links: