123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- kind: Deployment
- apiVersion: apps/v1
- metadata:
- labels:
- k8s-app: jenkins
- name: jenkins
- spec:
- replicas: 1
- revisionHistoryLimit: 10
- selector:
- matchLabels:
- k8s-app: jenkins
- template:
- metadata:
- labels:
- k8s-app: jenkins
- name: jenkins
- spec:
- containers:
- - name: jenkins
- image: jenkins/jenkins:2.381
- imagePullPolicy: IfNotPresent
- ports:
- - containerPort: 30080
- name: web
- protocol: TCP
- - containerPort: 30081
- name: agent
- protocol: TCP
- resources:
- limits:
- cpu: 1000m
- memory: 2Gi
- requests:
- cpu: 500m
- memory: 512Mi
- livenessProbe:
- httpGet:
- path: /login
- port: 30080
- initialDelaySeconds: 60
- timeoutSeconds: 5
- failureThreshold: 12
- readinessProbe:
- httpGet:
- path: /login
- port: 30080
- initialDelaySeconds: 60
- timeoutSeconds: 5
- failureThreshold: 12
- volumeMounts:
- - name: jenkins-home
- mountPath: /var/lib/jenkins
- env:
- - name: JENKINS_HOME
- value: /var/lib/jenkins
- - name: JENKINS_OPTS
- value: --httpPort=30080
- - name: JENKINS_SLAVE_AGENT_PORT
- value: '30081'
- volumes:
- - name: jenkins-home
- persistentVolumeClaim:
- claimName: jenkins-data2
- serviceAccountName: jenkins
- ---
- kind: Service
- apiVersion: v1
- metadata:
- labels:
- k8s-app: jenkins
- name: jenkins
- spec:
- type: NodePort
- ports:
- - name: web
- port: 30080
- targetPort: 30080
- nodePort: 30080
- - name: slave
- port: 30081
- targetPort: 30081
- nodePort: 30081
- selector:
- k8s-app: jenkins
- ---
- apiVersion: v1
- kind: ServiceAccount
- metadata:
- labels:
- k8s-app: jenkins
- name: jenkins
- ---
- kind: ClusterRole
- apiVersion: rbac.authorization.k8s.io/v1
- metadata:
- name: jenkins
- rules:
- - apiGroups: ['']
- resources: ['pods', 'configmaps', 'namespaces', 'deployments']
- 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: ['secrets']
- verbs: ['get']
- - apiGroups: ['apps']
- resources: ['deployments']
- verbs: ['create', 'delete', 'get', 'list', 'patch', 'update', 'watch']
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: jenkins
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: jenkins
- subjects:
- - kind: ServiceAccount
- name: jenkins
- namespace: devops
- ---
- # apiVersion: networking.k8s.io/v1
- # kind: Ingress
- # metadata:
- # name: jenkins-ingress
- # spec:
- # ingressClassName: nginx
- # rules:
- # - host: jenkins.sxkj.com
- # http:
- # paths:
- # - path: /
- # pathType: Prefix
- # backend:
- # service:
- # name: jenkins
- # port:
- # number: 30080
|