Shared Edge Delta Configuration

Share a single agent configuration across multiple agents.

You can share a single agent configuration across multiple agents, each with their own unique agent IDs.

In the following example there is one agent configuration named main_config.

On the Kubernetes dashboard there are two agents using that single configuration. They are named cluster-01 and cluster-02.

This is particularly useful for agents deployed in different production clusters.

Solution Overview

Each agent configuration defines one agent tag. This means that, by default, for every agent configuration there is a unique agent tag. If you deploy the same agent multiple times in different clusters the same agent tag will be used and you won’t be able to differentiate between the clusters in the dashboard. You could configure multiple agent configurations with different agent tags but this results in maintenance overhead.

A better solution is to use a common agent configuration but pass in an environment variable that overrides the default agent tag for the agent in that particular cluster.

Agent Tag Environment Variable

To specify an agent tag that will override the one set in the agent config, you pass in the ED_TAG_OVERRIDE environment variable after applying edgedelta-agent.yaml.

kubectl set env ds edgedelta ED_TAG_OVERRIDE=cluster-01 -n edgedelta

Kustomize Example

You can use Kustomize to pass in a unique tag name for different deployments on different clusters. This example has the following file structure.

  • application
    • apisecret.yaml
    • orgid.yaml
    • edgedelta-agent.yaml
    • kustomization.yaml
    • namespace.yaml
  • clusters
    • cluster-01
      • kustomization.yaml
      • tagname.yaml
    • cluster-02
      • kustomization.yaml
      • tagname.yaml

The edgedelta-agent.yaml file is the default manifest. The tagname.yaml override file in the cluster-01 overlay folder patches the edgedelta-agent.yaml with ED_TAG_OVERRIDE as follows:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: edgedelta
  namespace: edgedelta
spec:
  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_TAG_OVERRIDE
            value: cluster-01

The kustomization.yaml file in the cluster-01 overlay implements tagname.yaml as a patch on top of the base folder:

bases:
  - ../../application
patches:
  - tagname.yaml

The cluster-02 folder contains the same kustomization.yaml file and the same tagname.yaml but with the ED_TAG_OVERRIDE value set to cluster-02.

The following command installs the cluster-01 kustomization on the kind-01 cluster:

% kubectl kustomize ./clusters/cluster-01/ | kubectl --context=kind-kind01 apply -f -

Whereas the following command installs the cluster-02 kustomization on the kind-02 cluster:

% kubectl kustomize ./clusters/cluster-02/ | kubectl --context=kind-kind02 apply -f -

Secrets should not be stored as base64 encoded files. Rather implement a secrets management solution such as HashiCorp Vault.

See Also:

GitOps Principles Deployment of Edge Delta