Deploying a Traefik Log Dashboard on Kubernetes with IngressRoute by fhptech

@ fhptech published Kubernetes Manifest for Traefik Log Dashboard

His Post.

We are running Traefik as part of our Kubernetes deployment (vSphere with Tanzu) and recently deployed the log dashboard to monitor the access logs. Thought I would share this manifest as a POC reference for others or if you wanted to use it as a template for inclusion as another installation option. Excuse any mistakes in the manifest and the use of multiple containers per deployment which goes against standard Kubernetes practices as it was slapped together quickly just to get operational. It includes publishing the frontend via Traefik IngressRoutes

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/part-of: traefik-log-dashboard
  name: traefik-log-dashboard
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/part-of: traefik-log-dashboard
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/part-of: traefik-log-dashboard
    spec:
      containers:
      - image: ghcr.io/hhftechnology/traefik-log-dashboard-backend:latest
        imagePullPolicy: Always
        name: traefik-log-dashboard-backend
        env:
          - name: NODE_ENV
            value: production
          - name: PORT
            value: "3001"
          - name: TRAEFIK_LOG_FILE
            value: /logs/traefik
        volumeMounts:
          - name: traefik-logs
            mountPath: /logs/traefik
      - image: ghcr.io/hhftechnology/traefik-log-dashboard-frontend:latest
        imagePullPolicy: Always
        name: traefik-log-dashboard-frontend
        env:
          - name: NODE_ENV
            value: production
          - name: BACKEND_SERVICE
            value: traefik-log-dashboard-backend
          - name: BACKEND_PORT
            value: "3001"
      volumes:
        - name: traefik-logs
          nfs:
            server: nfs.contoso.com
            path: /nfsvol/traefik/logs
      restartPolicy: Always
---            
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/part-of: traefik-log-dashboard
  name: traefik-log-dashboard-backend
spec:
  selector:
    app.kubernetes.io/part-of: traefik-log-dashboard
  ports:
    - protocol: TCP
      port: 3001
      targetPort: 3001
---            
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/part-of: traefik-log-dashboard
  name: traefik-log-dashboard-frontend
spec:
  selector:
    app.kubernetes.io/part-of: traefik-log-dashboard
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: traefik-log-dashboard-http
  namespace: default
spec:
  entryPoints:
  - web
  routes:
  - match: Host(`traefik-log-dashboard.contoso.com`)
    kind: Rule
    services:
    - kind: Service
      name: traefik-log-dashboard-frontend
      port: 80
    middlewares:
    - name: redirect-https
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: traefik-log-dashboard
  namespace: default
spec:
  entryPoints:
  - websecure
  routes:
  - match: Host(`traefik-log-dashboard.contoso.com`)
    kind: Rule
    services:
    - kind: Service
      name: traefik-log-dashboard-frontend
      port: 80
  tls:
    secretName: traefik-tls-cert