-
-
Save atulkumarpccs/74606e7534d0db1eb584863a8062a6aa to your computer and use it in GitHub Desktop.
YAML file to install Jenkins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: jenkins | |
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: build | |
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: jenkins | |
namespace: jenkins | |
--- | |
kind: Role | |
apiVersion: rbac.authorization.k8s.io/v1 | |
metadata: | |
name: jenkins | |
namespace: build | |
rules: | |
- apiGroups: [""] | |
resources: ["pods"] | |
verbs: ["create","delete","get","list","patch","update","watch"] | |
- apiGroups: [""] | |
resources: ["pods/exec"] | |
verbs: ["create","delete","get","list","patch","update","watch"] | |
- apiGroups: [""] | |
resources: ["pods/log"] | |
verbs: ["get","list","watch"] | |
- apiGroups: [""] | |
resources: ["events"] | |
verbs: ["watch"] | |
- apiGroups: [""] | |
resources: ["secrets"] | |
verbs: ["get"] | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: RoleBinding | |
metadata: | |
name: jenkins | |
namespace: build | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: Role | |
name: jenkins | |
subjects: | |
- kind: ServiceAccount | |
name: jenkins | |
namespace: jenkins | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: jenkins | |
namespace: jenkins | |
spec: | |
selector: | |
app: jenkins | |
ports: | |
- name: http | |
port: 8080 | |
targetPort: 8080 | |
protocol: TCP | |
- name: agent | |
port: 50000 | |
protocol: TCP | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: jenkins | |
namespace: jenkins | |
annotations: | |
kubernetes.io/ingress.class: "nginx" | |
ingress.kubernetes.io/ssl-redirect: "false" | |
ingress.kubernetes.io/proxy-body-size: 50m | |
ingress.kubernetes.io/proxy-request-buffering: "off" | |
nginx.ingress.kubernetes.io/ssl-redirect: "false" | |
nginx.ingress.kubernetes.io/proxy-body-size: 50m | |
nginx.ingress.kubernetes.io/proxy-request-buffering: "off" | |
spec: | |
rules: | |
- http: | |
paths: | |
- path: /jenkins | |
backend: | |
serviceName: jenkins | |
servicePort: 8080 | |
--- | |
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: jenkins | |
namespace: jenkins | |
spec: | |
selector: | |
matchLabels: | |
app: jenkins | |
serviceName: jenkins | |
replicas: 1 | |
updateStrategy: | |
type: RollingUpdate | |
template: | |
metadata: | |
labels: | |
app: jenkins | |
spec: | |
terminationGracePeriodSeconds: 10 | |
serviceAccountName: jenkins | |
containers: | |
- name: jenkins | |
image: jenkins/jenkins:lts-alpine | |
imagePullPolicy: Always | |
ports: | |
- containerPort: 8080 | |
- containerPort: 50000 | |
resources: | |
limits: | |
cpu: 1 | |
memory: 1Gi | |
requests: | |
cpu: 0.5 | |
memory: 500Mi | |
env: | |
- name: JENKINS_OPTS | |
value: --prefix=/jenkins | |
- name: LIMITS_MEMORY | |
valueFrom: | |
resourceFieldRef: | |
resource: limits.memory | |
divisor: 1Mi | |
- name: JAVA_OPTS | |
value: -Xmx$(LIMITS_MEMORY)m -XshowSettings:vm -Dhudson.slaves.NodeProvisioner.initialDelay=0 -Dhudson.slaves.NodeProvisioner.MARGIN=50 -Dhudson.slaves.NodeProvisioner.MARGIN0=0.85 | |
volumeMounts: | |
- name: jenkins-home | |
mountPath: /var/jenkins_home | |
livenessProbe: | |
httpGet: | |
path: /jenkins/login | |
port: 8080 | |
initialDelaySeconds: 60 | |
timeoutSeconds: 5 | |
failureThreshold: 12 # ~2 minutes | |
readinessProbe: | |
httpGet: | |
path: /jenkins/login | |
port: 8080 | |
initialDelaySeconds: 60 | |
timeoutSeconds: 5 | |
failureThreshold: 12 # ~2 minutes | |
securityContext: | |
fsGroup: 1000 | |
volumeClaimTemplates: | |
- metadata: | |
name: jenkins-home | |
spec: | |
accessModes: [ "ReadWriteOnce" ] | |
resources: | |
requests: | |
storage: 2Gi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment