[Kubernetes (K8S)] Helm install Jenkis to support building, deploying and automating any project within Kubernetes (K8S)

Jenkis

Jenkins is the leading open source automation server.

Jenkins provides hundreds of plugins to support building, deploying and automating any project.

Jenkins has the following features.

  • Continuous Integration and Continuous Delivery

  • Easy installation

  • Easy configuration

  • Plugins

  • Extensible

  • Distributed

This article is about how to use Helm to deploy Jenkins on Kubernetes (K8S).

Prerequisites

  • Kubernetes (K8S)
    Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.

    For more information about installing and using Kubernetes (K8s), see the Kubernetes (K8s) Docs.

  • Helm
    Helm is the best way to find, share, and use software built for Kubernetes.

    For more information about installing and using Helm, see the Helm Docs.

Installation

Custom Values.yaml

Remember to replace content within {{ }} with your prefer values.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# values.yaml

# helm-charts/values.yaml at main · jenkinsci/helm-charts
# https://github.com/jenkinsci/helm-charts/blob/main/charts/jenkins/values.yaml

master:
ingress:
enabled: true

annotations:
# kubernetes.io/ingress.class: {{ .Values.ingress.class }} # "nginx"
# kubernetes.io/tls-acme: {{ .Values.ingress.acme }} # "true"

# cert-manager.io/acme-challenge-type: dns01
# cert-manager.io/cluster-issuer: cert-manager-webhook-dnspod-cluster-issuer

hostName: {{ .Values.ingress.host }}

tls:
- secretName: {{ .Values.ingress.tls.secretName }}
hosts:
- {{ .Values.ingress.host }}

Install by Helm

Helm install jenkins into jenkins namespace.

1
2
3
4
5
6
7
8
9
10
11
# crate namespace:
$ kubectl create namespace jenkins

# Add the Helm repository:
$ helm repo add jenkins https://charts.jenkins.io

# Update your local Helm chart repository cache:
$ helm repo update

# To install Helm chart:
$ helm install jenkins jenkins/jenkins --namespace jenkins -f values.yaml

See Helm release about jenkins.

1
2
3
$ helm list --namespace jenkins
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
jenkins jenkins 1 2020-09-19 16:48:00.965014 +0800 +0800 failed jenkins-2.17.1 lts9

See pods about jenkins.

1
2
3
$ kubectl get pods -n jenkins
NAME READY STATUS RESTARTS AGE
jenkins-5cd8c86944-mtc4l 2/2 Running 0 5h17m

Then, you can visit jenkins server with https://{{ .Values.ingress.host }}.

References

[1] jenkinsci/helm-charts: Jenkins community Helm charts - https://github.com/jenkinsci/helm-charts

[2] Install Jenkins with Helm v3 - https://www.jenkins.io/doc/book/installing/kubernetes/#install-jenkins-with-helm-v3

[3] Jenkins - https://www.jenkins.io/

[4] Helm - https://helm.sh/

[5] Kubernetes - https://kubernetes.io/