apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: jenkins
  name: jenkins
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jenkins
  strategy:
    type: Recreate 
  template:
    metadata:
      labels:
        app: jenkins
    spec:
      containers:
      - image: jenkinsci/blueocean
        imagePullPolicy: Always
        name: jenkins
        ports:
        - containerPort: 8080
          name: web-port
          protocol: TCP
        - containerPort: 50000
          name: jnlp-port
          protocol: TCP
        stdin: true
        tty: true
        volumeMounts:
        - mountPath: /var/jenkins_home
          name: jenkins-home
        - mountPath: /var/jenkins_home/.kube
          name: kube-config
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      securityContext:
        runAsUser: 1000
        fsGroup: 1000
      terminationGracePeriodSeconds: 30
      volumes:
      - name: jenkins-home
        persistentVolumeClaim:
          claimName: jenkins-home
      - configMap:
          defaultMode: 292
          name: kube-config
          optional: false
        name: kube-config

