157 lines
3.1 KiB
YAML
157 lines
3.1 KiB
YAML
|
---
|
||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||
|
kind: ClusterRole
|
||
|
metadata:
|
||
|
name: jenkins-admin
|
||
|
rules:
|
||
|
- apiGroups: [""]
|
||
|
resources: ["*"]
|
||
|
verbs: ["*"]
|
||
|
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: ServiceAccount
|
||
|
metadata:
|
||
|
name: jenkins-admin
|
||
|
|
||
|
---
|
||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||
|
kind: ClusterRoleBinding
|
||
|
metadata:
|
||
|
name: jenkins-admin
|
||
|
roleRef:
|
||
|
apiGroup: rbac.authorization.k8s.io
|
||
|
kind: ClusterRole
|
||
|
name: jenkins-admin
|
||
|
subjects:
|
||
|
- kind: ServiceAccount
|
||
|
name: jenkins-admin
|
||
|
# ref: ServiceAccount
|
||
|
namespace: basic
|
||
|
|
||
|
---
|
||
|
apiVersion: storage.k8s.io/v1
|
||
|
kind: StorageClass
|
||
|
metadata:
|
||
|
name: local-storage
|
||
|
provisioner: kubernetes.io/no-provisioner
|
||
|
volumeBindingMode: WaitForFirstConsumer
|
||
|
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: PersistentVolumeClaim
|
||
|
metadata:
|
||
|
name: jenkins-pvc-local
|
||
|
spec:
|
||
|
storageClassName: local-storage
|
||
|
accessModes:
|
||
|
- ReadWriteOnce
|
||
|
resources:
|
||
|
requests:
|
||
|
storage: 3Gi
|
||
|
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: PersistentVolume
|
||
|
metadata:
|
||
|
name: jenkins-pv-local
|
||
|
labels:
|
||
|
type: local
|
||
|
spec:
|
||
|
storageClassName: local-storage
|
||
|
claimRef:
|
||
|
name: jenkins-pvc-local
|
||
|
# ref: PersistentVolumeClaim
|
||
|
namespace: basic
|
||
|
capacity:
|
||
|
storage: 20Gi
|
||
|
accessModes:
|
||
|
- ReadWriteOnce
|
||
|
local:
|
||
|
path: /data/jenkins
|
||
|
nodeAffinity:
|
||
|
required:
|
||
|
nodeSelectorTerms:
|
||
|
- matchExpressions:
|
||
|
- key: kubernetes.io/hostname
|
||
|
operator: In
|
||
|
values:
|
||
|
- bfs-k8snode-10-2-1-7.hetzner.base.beaconfireinc.com
|
||
|
|
||
|
---
|
||
|
apiVersion: apps/v1
|
||
|
kind: Deployment
|
||
|
metadata:
|
||
|
name: jenkins
|
||
|
spec:
|
||
|
replicas: 1
|
||
|
selector:
|
||
|
matchLabels:
|
||
|
app: jenkins
|
||
|
template:
|
||
|
metadata:
|
||
|
labels:
|
||
|
app: jenkins
|
||
|
spec:
|
||
|
securityContext:
|
||
|
fsGroup: 1000
|
||
|
runAsUser: 1000
|
||
|
serviceAccountName: jenkins-admin
|
||
|
containers:
|
||
|
- name: jenkins
|
||
|
image: jenkins/jenkins:2.414
|
||
|
resources:
|
||
|
limits:
|
||
|
memory: "2Gi"
|
||
|
cpu: "1000m"
|
||
|
requests:
|
||
|
memory: "500Mi"
|
||
|
cpu: "500m"
|
||
|
ports:
|
||
|
- name: httpport
|
||
|
containerPort: 8080
|
||
|
- name: jnlpport
|
||
|
containerPort: 50000
|
||
|
livenessProbe:
|
||
|
httpGet:
|
||
|
path: "/login"
|
||
|
port: 8080
|
||
|
initialDelaySeconds: 90
|
||
|
periodSeconds: 10
|
||
|
timeoutSeconds: 5
|
||
|
failureThreshold: 5
|
||
|
readinessProbe:
|
||
|
httpGet:
|
||
|
path: "/login"
|
||
|
port: 8080
|
||
|
initialDelaySeconds: 60
|
||
|
periodSeconds: 10
|
||
|
timeoutSeconds: 5
|
||
|
failureThreshold: 3
|
||
|
volumeMounts:
|
||
|
- name: jenkins-data
|
||
|
mountPath: /var/jenkins_home
|
||
|
volumes:
|
||
|
- name: jenkins-data
|
||
|
persistentVolumeClaim:
|
||
|
claimName: jenkins-pvc-local
|
||
|
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
name: jenkins
|
||
|
annotations:
|
||
|
prometheus.io/scrape: 'true'
|
||
|
prometheus.io/path: /
|
||
|
prometheus.io/port: '8080'
|
||
|
spec:
|
||
|
selector:
|
||
|
app: jenkins
|
||
|
ports:
|
||
|
- port: 8080
|
||
|
targetPort: 8080
|
||
|
nodePort: 30080
|
||
|
type: NodePort
|
||
|
|