apiVersion: apps/v1
kind: Deployment
metadata:
  name: metrics-server
  namespace: kube-system
  labels:
    application: metrics-server
    version: v0.4.2
spec:
  replicas: 1
  selector:
    matchLabels:
      application: metrics-server
  template:
    metadata:
      name: metrics-server
      labels:
        application: metrics-server
        version: v0.4.2
      annotations:
        logging/destination: "{{.Cluster.ConfigItems.log_destination_infra}}"
    spec:
      dnsConfig:
        options:
          - name: ndots
            value: "1"
      serviceAccountName: metrics-server
      containers:
      - name: metrics-server
        image: registry.opensource.zalan.do/teapot/metrics-server:v0.4.2
        args:
        - --cert-dir=/tmp
        - --secure-port=4443
        - --kubelet-use-node-status-port
        resources:
          limits:
            cpu: "{{.ConfigItems.metrics_service_cpu}}"
            memory: "{{.ConfigItems.metrics_service_mem}}"
          requests:
            cpu: "{{.ConfigItems.metrics_service_cpu}}"
            memory: "{{.ConfigItems.metrics_service_mem}}"
        ports:
        - containerPort: 4443
          name: https
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /readyz
            port: https
            scheme: HTTPS
          periodSeconds: 10
        securityContext:
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          runAsUser: 1000
        volumeMounts:
        - name: tmp-dir
          mountPath: /tmp
      volumes:
      # mount in tmp so we can safely use from-scratch images and/or read-only containers
      - name: tmp-dir
        emptyDir: {}
