---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kibana
  labels:
    k8s-app: kibana
    kubernetes.io/cluster-service: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: kibana
  template:
    metadata:
      labels:
        k8s-app: kibana
      annotations:
        seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
    spec:
      affinity:
        podAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 1
              podAffinityTerm:
                topologyKey: "kubernetes.io/hostname"
                labelSelector:
                  matchExpressions:
                    - key: k8s-app
                      operator: In
                      values:
                        - elasticsearch
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 1
              podAffinityTerm:
                topologyKey: "kubernetes.io/hostname"
                labelSelector:
                  matchExpressions:
                    - key: k8s-app
                      operator: In
                      values:
                        - kibana
      containers:
        - name: kibana
          image: docker.elastic.co/kibana/kibana-oss:7.4.2
          env:
            - name: LOGGING_QUIET
              value: "true"
          resources:
            # need more cpu upon initialization, therefore burstable class
            requests:
              cpu: 100m
              memory: 200Mi
            limits:
              cpu: 1000m
              memory: 500Mi
          ports:
            - containerPort: 5601
              name: ui
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /status
              port: 5601
            initialDelaySeconds: 30
            timeoutSeconds: 10
          readinessProbe:
            httpGet:
              path: /status
              port: 5601
            initialDelaySeconds: 30
            timeoutSeconds: 10
