---
kind: DaemonSet
apiVersion: apps/v1

metadata:
  name: traefik
  namespace: traefik
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: traefik
      app.kubernetes.io/instance: traefik
  template:
    metadata:
      labels:
        app.kubernetes.io/name: traefik
        app.kubernetes.io/instance: traefik
    spec:
      serviceAccountName: traefik
      hostNetwork: true
      terminationGracePeriodSeconds: 60
      containers:
        - name: traefik
          image: traefik:v2.3.4
          imagePullPolicy: IfNotPresent
          resources:
            requests:
              cpu: 50m
              memory: 128Mi
          readinessProbe:
            httpGet:
              path: /ping
              port: 9000
            failureThreshold: 1
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 2
          livenessProbe:
            httpGet:
              path: /ping
              port: 9000
            failureThreshold: 3
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 2
          args:
            - --api
            - --api.dashboard
            - --entryPoints.traefik.address=:9000
            - --entryPoints.web.address=:80
            - --entryPoints.websecure.address=:443
            - --providers.kubernetescrd
            - --providers.kubernetesingress
            - --ping
            - --accesslog=true
            - --log=true
          ports:
            - name: traefik
              containerPort: 9000
              protocol: TCP
            - name: web
              containerPort: 80
              hostPort: 80
            - name: websecure
              containerPort: 443
              hostPort: 443
