apiVersion: apps/v1
kind: Deployment
metadata:
  name: blackbox-exporter
spec:
  replicas: 1
  selector:
    matchLabels:
      app: blackbox-exporter
  template:
    metadata:
      labels:
        app: blackbox-exporter
    spec:
      serviceAccountName: blackbox-exporter
      
      containers:
      
        - name: blackbox-exporter
          image: quay.io/prometheus/blackbox-exporter:v0.18.0@sha256:1ffc3f109eb39c89df16cdaf359cb9127d4ca2b5313724e939c2c8769aff8176
          imagePullPolicy: IfNotPresent
          args:
            - --config.file=/etc/blackbox_exporter/config.yaml
            - --web.listen-address=:9115
            # - --web.listen-address=:19115
            - --log.format=json
            - --log.level=debug
          ports:
            - name: http
              containerPort: 9115
              # containerPort: 19115
          resources:
            requests:
              cpu: 10m
              memory: 20Mi
            limits:
              cpu: 20m
              memory: 40Mi
          securityContext:
            runAsNonRoot: true
            runAsUser: 65534
          volumeMounts:
            - mountPath: /etc/blackbox_exporter/
              name: config
              readOnly: true
          livenessProbe:
            httpGet:
              path: /metrics
              port: http
            initialDelaySeconds: 15
            periodSeconds: 10
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /metrics
              port: http
            initialDelaySeconds: 15
            periodSeconds: 10
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 3

        - name: module-configmap-reloader
          image: jimmidyson/configmap-reload:v0.4.0@sha256:220bf78aa8652bb0e64ff3c4833b33b1a9b09d60df07423a244c4a2b632bfa57
          imagePullPolicy: IfNotPresent
          args:
            - --webhook-url=http://localhost:19115/-/reload
            - --volume-dir=/etc/blackbox_exporter/
          resources:
            requests:
              cpu: 10m
              memory: 20Mi
            limits:
              cpu: 20m
              memory: 40Mi
          securityContext:
            runAsNonRoot: true
            runAsUser: 65534
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: FallbackToLogsOnError
          volumeMounts:
            - mountPath: /etc/blackbox_exporter/
              name: config
              readOnly: true
          # MISSING
          # liveness
          # readiness

        # - name: kube-rbac-proxy
        #   image: quay.io/brancz/kube-rbac-proxy:v0.8.0@sha256:05e15e1164fd7ac85f5702b3f87ef548f4e00de3a79e6c4a6a34c92035497a9a
        #   imagePullPolicy: IfNotPresent
        #   args:
        #     - --logtostderr
        #     - --secure-listen-address=:9115
        #     - --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
        #     - --upstream=http://127.0.0.1:19115/
        #   ports:
        #   - name: https
        #     containerPort: 9115
        #   resources:
        #     requests:
        #       cpu: 10m
        #       memory: 20Mi
        #     limits:
        #       cpu: 20m
        #       memory: 40Mi
        #   securityContext:
        #     runAsNonRoot: true
        #     runAsUser: 65532
        #     runAsGroup: 65532
        #   # MISSING
        #   # liveness
        #   # readiness

      volumes:
      - name: config
        configMap:
          name: blackbox-exporter
