Kubernetes#

Being deployable as a Docker container, the codingconcepts/edg image works natively in Kubernetes. edg is the entrypoint, and any arguments you pass are forwarded directly to the CLI.

Running a built-in workload#

Run a one-shot pod with a built-in workload:

kubectl run edg --image=codingconcepts/edg:v0.4.0 --restart=Never -- \
  workload consistency all \
  --driver pgx \
  --url "postgres://root@cockroachdb.crdb.svc.cluster.local:26257?sslmode=disable" \
  --retries 5 \
  -d 10s \
  -w 1

kubectl logs edg -f
kubectl delete pod edg

Running a custom workload with a ConfigMap#

Create a ConfigMap from your workload config file:

kubectl create configmap edg-config --from-file=workload.yaml=./my_workload.yaml

Then mount it into the pod:

apiVersion: v1
kind: Pod
metadata:
  name: edg
spec:
  restartPolicy: Never
  containers:
    - name: edg
      image: codingconcepts/edg:v0.4.0
      args:
        - all
        - --driver
        - pgx
        - --config
        - /config/workload.yaml
        - --url
        - "postgres://root@cockroachdb.crdb.svc.cluster.local:26257?sslmode=disable"
        - -w
        - "10"
        - -d
        - 5m
      volumeMounts:
        - name: config
          mountPath: /config
          readOnly: true
  volumes:
    - name: config
      configMap:
        name: edg-config

Running as a Job#

For better lifecycle management, use a Kubernetes Job. The pod will be retried on failure and kept for log inspection after completion:

apiVersion: batch/v1
kind: Job
metadata:
  name: edg-bank
spec:
  backoffLimit: 3
  template:
    spec:
      restartPolicy: Never
      containers:
        - name: edg
          image: codingconcepts/edg:v0.4.0
          args:
            - workload
            - bank
            - all
            - --driver
            - pgx
            - --url
            - "postgres://root@cockroachdb.crdb.svc.cluster.local:26257?sslmode=disable"
            - -w
            - "10"
            - -d
            - 5m
kubectl apply -f edg-job.yaml
kubectl logs job/edg-bank -f
kubectl delete job edg-bank

Passing the connection URL via a Secret#

Avoid embedding credentials in pod specs by referencing a Kubernetes Secret:

kubectl create secret generic edg-db \
  --from-literal=url="postgres://root@cockroachdb.crdb.svc.cluster.local:26257?sslmode=disable"

Then use the EDG_URL environment variable instead of --url:

containers:
  - name: edg
    image: codingconcepts/edg:v0.4.0
    args:
      - workload
      - bank
      - all
      - --driver
      - pgx
      - -w
      - "10"
      - -d
      - 5m
    env:
      - name: EDG_URL
        valueFrom:
          secretKeyRef:
            name: edg-db
            key: url

All --flag arguments have corresponding EDG_ environment variables (e.g. --driver -> EDG_DRIVER, --retries -> EDG_RETRIES). This lets you configure edg entirely through the pod’s env block or a ConfigMap-backed envFrom.