apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: otelcol
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: otelcol
  serviceName: otelcol
  template:
    metadata:
      labels:
        app.kubernetes.io/name: otelcol
    spec:
      securityContext:
        runAsUser: 0
        runAsGroup: 0
      containers:
        - name: otelcol
          image: index.docker.io/otel/opentelemetry-collector-contrib
          args:
            - --config=/config/config.yaml
          env:
            - name: HOST_PROC
              value: /host/proc
            - name: HOST_SYS
              value: /host/sys
            - name: HOST_RUN
              value: /host/run
            - name: HOST_DEV
              value: /host/dev
          ports:
            - containerPort: 4317
              name: otlpgrpc
          volumeMounts:
            - mountPath: /config
              name: config
            - mountPath: /host/proc
              name: hostproc
            - mountPath: /host/sys
              name: hostsys
            - mountPath: /host/run
              name: hostrun
            - mountPath: /host/dev
              name: hostdev
            - mountPath: /host/var
              name: hostvar
            - mountPath: /host/etc
              name: hostetc
      volumes:
        - name: config
          configMap:
            name: otelcol
        - name: hostproc
          hostPath:
            path: /proc
        - name: hostsys
          hostPath:
            path: /sys
        - name: hostrun
          hostPath:
            path: /run
        - name: hostdev
          hostPath:
            path: /dev
        - name: hostvar
          hostPath:
            path: /var
        - name: hostetc
          hostPath:
            path: /etc
