Installation
This document describes installation procedure for Jenkins Operator. All container images can be found at virtuslab/jenkins-operator
Requirements
To run Jenkins Operator, you will need:
access to a Kubernetes cluster version
1.11+
kubectl
version1.11+
Configure Custom Resource Definition
Install Jenkins Custom Resource Definition:
kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/deploy/crds/jenkins_v1alpha2_jenkins_crd.yaml
Deploy Jenkins Operator
There are two ways to deploy the Jenkins Operator.
Using YAML’s
Apply Service Account and RBAC roles:
kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/deploy/all-in-one-v1alpha2.yaml
Watch Jenkins Operator instance being created:
kubectl get pods -w
Now Jenkins Operator should be up and running in the default
namespace.
Using Helm Chart
There is a option to use Helm to install the operator. It requires the Helm 3+ for deployment.
Create a namespace for the operator:
$ kubectl create namespace <your-namespace>
To install, you need only to type these commands:
$ helm repo add jenkins https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart
$ helm install <name> jenkins/jenkins-operator -n <your-namespace>
In case you want to use released Chart v0.4.1, before installing/upgrading please install additional CRD into the cluster:
$ kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/crds/jenkinsimage-crd.yaml
To add custom labels and annotations, you can use values.yaml
file or pass them into helm install
command, e.g.:
$ helm install <name> jenkins/jenkins-operator -n <your-namespace> --set jenkins.labels.LabelKey=LabelValue,jenkins.annotations.AnnotationKey=AnnotationValue
You can further customize Jenkins using values.yaml
:
Jenkins instance configuration
Field | Default value | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jenkins
|
operator is section for configuring operator deployment
|
Configuring operator deployment
Field | Default value | Description | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operator
|
operator is section for configuring operator deployment
|
Backup
(Appears on: JenkinsConfiguration)
Backup defines configuration of Jenkins backup.
Field | Default value | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
enabled
|
true | Enabled is enable/disable switch for backup feature. | ||||||||||||
image
|
virtuslab/jenkins-operator-backup-pvc:v0.0.8 | Image used by backup feature. | ||||||||||||
containerName
|
backup | Backup container name. | ||||||||||||
interval
|
30 | Defines how often make backup in seconds. | ||||||||||||
makeBackupBeforePodDeletion
|
true | When enabled will make backup before pod deletion. | ||||||||||||
backupCommand
|
/home/user/bin/backup.sh | Backup container command. | ||||||||||||
restoreCommand
|
/home/user/bin/restore.sh | Backup restore command. | ||||||||||||
pvc
|
Persistent Volume Claim Kubernetes resource
|
|||||||||||||
env
|
- name: BACKUP_DIR value: /backup - name: JENKINS_HOME value: /jenkins-home - name: BACKUP_COUNT value: "3" |
Contains container environment variables.
PVC backup provider handles these variables: BACKUP_DIR - path for storing backup files (default: "/backup") JENKINS_HOME - path to jenkins home (default: "/jenkins-home") BACKUP_COUNT - define how much recent backups will be kept |
||||||||||||
volumeMounts
|
- name: jenkins-home mountPath: /jenkins-home - mountPath: /backup name: backup |
Holds the mount points for volumes. |
Configuration
(Appears on: Jenkins instance configuration)
Field | Default value | Description |
---|---|---|
configurationAsCode
|
{} |
ConfigurationAsCode defines configuration of Jenkins customization via Configuration as Code Jenkins plugin.
Example:- configMapName: jenkins-casc content: {} |
groovyScripts
|
{} |
GroovyScripts defines configuration of Jenkins customization via groovy scripts.
Example:- configMapName: jenkins-gs content: {} |
secretRefName
|
“” | secretRefName of existing secret (previously created). |
secretData
|
{} | If secretRefName is empty, secretData creates new secret and fills with data provided in secretData. |