mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
Feature/run jenkins as non root user (#2899)
* option to run Jenkins as a non root user * add parameters to run Jenkins as non root user * doc to run Jenkins as non root user * increment minor version due to feature "run Jenkins as non root user"
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
name: jenkins
|
||||
home: https://jenkins.io/
|
||||
version: 0.10.3
|
||||
version: 0.11.0
|
||||
appVersion: 2.73
|
||||
description: Open source continuous integration server. It supports multiple SCM tools
|
||||
including CVS, Subversion and Git. It can execute Apache Ant and Apache Maven-based
|
||||
|
||||
@@ -38,6 +38,8 @@ The following tables lists the configurable parameters of the Jenkins chart and
|
||||
| `Master.AdminUser` | Admin username (and password) created as a secret if useSecurity is true | `admin` |
|
||||
| `Master.Cpu` | Master requested cpu | `200m` |
|
||||
| `Master.Memory` | Master requested memory | `256Mi` |
|
||||
| `Master.RunAsUser` | uid that jenkins runs with | `0` |
|
||||
| `Master.FsGroup` | uid that will be used for persistent volume | `0` |
|
||||
| `Master.ServiceAnnotations` | Service annotations | `{}` |
|
||||
| `Master.ServiceType` | k8s service type | `LoadBalancer` |
|
||||
| `Master.ServicePort` | k8s service port | `8080` |
|
||||
@@ -164,3 +166,20 @@ If running upon a cluster with RBAC enabled you will need to do the following:
|
||||
* `helm install stable/jenkins --set rbac.install=true`
|
||||
* Create a Jenkins credential of type Kubernetes service account with service account name provided in the `helm status` output.
|
||||
* Under configure Jenkins -- Update the credentials config in the cloud section to use the service account credential you created in the step above.
|
||||
|
||||
## Run Jenkins as non root user
|
||||
|
||||
The default settings of this helm chart let Jenkins run as root user with uid `0`.
|
||||
Due to security reasons you may want to run Jenkins as a non root user.
|
||||
Fortunately the default jenkins docker image `jenkins/jenkins` contains a user `jenkins` with uid `1000` that can be used for this purpose.
|
||||
|
||||
Simply use the following settings to run Jenkins as `jenkins` user with uid `1000`.
|
||||
```
|
||||
jenkins:
|
||||
Master:
|
||||
RunAsUser: 1000
|
||||
FsGroup: 1000
|
||||
```
|
||||
|
||||
Docs taken from https://github.com/jenkinsci/docker/blob/master/Dockerfile:
|
||||
*Jenkins is run with user `jenkins`, uid = 1000. If you bind mount a volume from the host or a data container,ensure you use the same uid*
|
||||
|
||||
@@ -34,7 +34,12 @@ spec:
|
||||
{{ toYaml .Values.Master.Tolerations | indent 8 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsUser: {{ default 0 .Values.Master.RunAsUser }}
|
||||
{{- if and (.Values.Master.RunAsUser) (.Values.Master.FsGroup) }}
|
||||
{{- if not (eq .Values.Master.RunAsUser 0.0) }}
|
||||
fsGroup: {{ .Values.Master.FsGroup }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ if .Values.rbac.install }}{{ template "jenkins.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
|
||||
initContainers:
|
||||
- name: "copy-default-config"
|
||||
|
||||
@@ -19,6 +19,10 @@ Master:
|
||||
# JavaOpts: "-Xms512m -Xmx512m"
|
||||
# JenkinsOpts: ""
|
||||
# JenkinsUriPrefix: "/jenkins"
|
||||
# Set RunAsUser to 1000 to let Jenkins run as non-root user 'jenkins' which exists in 'jenkins/jenkins' docker image.
|
||||
# When setting RunAsUser to a different value than 0 also set FsGroup to the same value:
|
||||
# RunAsUser: <defaults to 0>
|
||||
# FsGroup: <will be omitted in deployment if RunAsUser is 0>
|
||||
ServicePort: 8080
|
||||
# For minikube, set this to NodePort, elsewhere use LoadBalancer
|
||||
# Use ClusterIP if your setup includes ingress controller
|
||||
|
||||
Reference in New Issue
Block a user