edgedelta-agent.yaml

Example Agent Manifest

The following agent manifest can be used along with this ConfigMap to manage the Edge Delta agent using a local configuration.

apiVersion: v1
kind: Namespace
metadata:
  name: edgedelta
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: edgedelta
  namespace: edgedelta
  annotations:
    prometheus.io/scrape: "true"
  labels:
    k8s-app: edgedelta-logging
    version: v1
    kubernetes.io/cluster-service: "true"
spec:
  selector:
    matchLabels:
      k8s-app: edgedelta-logging
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
  template:
    metadata:
      labels:
        k8s-app: edgedelta-logging
        version: v1
        kubernetes.io/cluster-service: "true"
    spec:
      serviceAccountName: edgedelta
      containers:
      - name: edgedelta-agent
        image: gcr.io/edgedelta/agent:v0.1.54
        env:
          - name: ED_SKIP_CONF_DOWNLOAD
            value: "1"
          - name: ED_API_KEY
            valueFrom:
              # kubectl create secret generic ed-api-key \
              #   --namespace=edgedelta \
              #   --from-literal=ed-api-key="2c7a5780-..."
              secretKeyRef:
                key: ed-api-key
                name: ed-api-key
          # Uncomment if proxy setup needed
          # More details: https://github.com/golang/net/blob/master/http/httpproxy/proxy.go#L27
          # - name:  HTTP_PROXY
          #   value: my.proxy.com
          # - name:  NO_PROXY
          #   value: skip.proxy.com
          # pass node hostname to agent
          - name: ED_ORG_ID
            valueFrom:
              secretKeyRef:
                key: ed-org-id
                name: ed-org-id
          - name: ED_HOST_OVERRIDE
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: ED_LEADER_ELECTION_ENABLED
            value: "1"
        command:
          - /edgedelta/edgedelta
          - -c
          - /config/config.yml
        resources:
          limits:
            memory: 2048Mi
          requests:
            cpu: 200m
            memory: 256Mi
        volumeMounts:
          - name: edconfig
            mountPath: /config/
          - name: varlog
            mountPath: /var/log
            readOnly: true
          - name: varlibdockercontainers
            # Some Kubernetes distributions may use /docker/containers instead of standard /var/lib/docker/containers
            # Update mountPath to match the actual container log folder path
            mountPath: /var/lib/docker/containers
            readOnly: true
          - name: persisting-cursor-storage
            mountPath: /var/lib/edgedelta
        # Required for OpenShift or SELinux enabled K8s clusters
        # securityContext:
        #   runAsUser: 0
        #   privileged: true
      terminationGracePeriodSeconds: 10
      volumes:
        - name: varlog
          hostPath:
            path: /var/log
        - name: varlibdockercontainers
          hostPath:
            # Update path if you changed volumeMounts varlibdockercontainers mountPath
            path: /var/lib/docker/containers
        - name: persisting-cursor-storage
          hostPath:
            path: /var/lib/edgedelta
            type: DirectoryOrCreate
        - name: edconfig
          configMap:
            name: edgedelta-agent-config
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: edgedelta
subjects:
- kind: ServiceAccount
  name: edgedelta
  namespace: edgedelta
roleRef:
  kind: ClusterRole
  name: edgedelta
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: edgedelta
  labels:
    k8s-app: edgedelta-logging
rules:
- apiGroups: [""] # "" indicates the core API group
  resources:
  - namespaces
  - pods
  - events
  - nodes
  - nodes/metrics
  - services
  verbs:
  - get
  - watch
  - list
- apiGroups: [""] # "" indicates the core API group
  resources:
  - events
  verbs:
  - create
- apiGroups: ["apps"]
  resources:
  - daemonsets
  - deployments
  - replicasets
  - statefulsets
  verbs:
  - watch
  - list
- apiGroups: ["batch"]
  resources:
  - jobs
  - cronjobs
  verbs:
  - watch
  - list
- apiGroups: ["coordination.k8s.io"]
  resources:
  - leases
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups: ["metrics.k8s.io"]
  resources:
  - pods
  - nodes
  verbs:
  - get
  - list
  - watch
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: edgedelta
  namespace: edgedelta
  labels:
    k8s-app: edgedelta-logging

See Also:

GitOps Principles Deployment of Edge Delta