yurake/k8s-3tier-webapp

View on GitHub
kubernetes/monitoring/jenkins/jenkins-deployment.yaml

Summary

Maintainability
Test Coverage
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins
  namespace: monitoring
  labels:
    app: jenkins
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jenkins
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        tier: management
        component: cicd
        app: jenkins
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8080"
        prometheus.io/path: "/prometheus"
    spec:
      serviceAccountName: jenkins
      securityContext:
        fsGroup: 1000
        runAsUser: 0
      containers:
        - name: jenkins
          image: yurak/jenkins:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
          volumeMounts:
            - name: jenkins-persistent-storage
              mountPath: /var/jenkins_home
            - name: docker-socket-volume
              mountPath: /var/run/docker.sock
          env:
            - name: PROMETHEUS_NAMESPACE
              value: "monitoring"
          livenessProbe:
            tcpSocket:
              port: 8080
          readinessProbe:
            httpGet:
              path: /login
              port: 8080
      volumes:
        - name: jenkins-persistent-storage
          persistentVolumeClaim:
            claimName: jenkins-pvc
        - name: docker-socket-volume
          hostPath:
            path: /var/run/docker.sock