apiVersion: v1
kind: Namespace
metadata:
  name: netdata
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: netdata
  namespace: netdata
spec:
  selector:
    matchLabels:
      app: netdata
  template:
    metadata:
      labels:
        app: netdata
    spec:
      hostPID: true
      hostIPC: true
      hostNetwork: true
      containers:
        - name: netdata
          image: netdata/netdata:latest
          securityContext:
            capabilities:
              add:
                - SYS_PTRACE
                - SYS_ADMIN
          volumeMounts:
            - name: proc
              mountPath: /host/proc
              readOnly: true
            - name: sys
              mountPath: /host/sys
              readOnly: true
            - name: os-release
              mountPath: /host/etc/os-release
              readOnly: true
            - name: nextcloud-data
              mountPath: /host/mnt/nextcloud-data
              readOnly: true
          env:
            - name: NETDATA_CLAIM_TOKEN
              value: ""
      volumes:
        - name: proc
          hostPath:
            path: /proc
        - name: sys
          hostPath:
            path: /sys
        - name: os-release
          hostPath:
            path: /etc/os-release
        - name: nextcloud-data
          hostPath:
            path: /mnt/nextcloud-data
---
apiVersion: v1
kind: Service
metadata:
  name: netdata
  namespace: netdata
spec:
  selector:
    app: netdata
  ports:
    - port: 19999
      targetPort: 19999
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: netdata
  namespace: netdata
spec:
  ingressClassName: traefik
  rules:
    - host: netdata.local
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: netdata
                port:
                  number: 19999
