etcd

by QuenchWorks

Helm chartv0.0.31App 3.7.4MITVerified publisher

Distributed, strongly consistent key-value store using Raft consensus. Hardened by QuenchWorks as a minimal, nonroot, CVE-gated image, cosign-signed and pinned by digest.

About this chart

Quenchworks etcd

Hardened etcd on a minimal, nonroot, CVE-gated image pinned by digest. Ships as a highly available Raft cluster by default; the image is configured entirely through ETCD_* env vars.

Install

helm install my-etcd oci://ghcr.io/quenchworks/charts/etcd

Standalone vs HA

The chart ships an HA 3-node Raft cluster by default. For dev/test or a small footprint, run a single node instead:

# Standalone: 1 node, no fault tolerance, smallest footprint
helm install my-etcd oci://ghcr.io/quenchworks/charts/etcd \
  --set replicaCount=1

# HA (default): 3-node Raft cluster with automatic leader election and failover
helm install my-etcd oci://ghcr.io/quenchworks/charts/etcd

Standalone is one pod with a single PVC and no quorum, so a pod or node loss is downtime until it restarts. HA runs 3 members (keep the count odd) and survives one member down with zero-touch recovery, at the cost of 3x the pods and storage. See High availability for the failover behavior and its boundaries.

High availability

The chart deploys a 3-node etcd cluster (a StatefulSet + headless Service) with automatic leader election and failover. This is native to etcd, Raft consensus, no sidecar or external operator.

  • Quorum: replicaCount defaults to 3 (tolerates 1 member down). Use an odd count so a majority always exists; 5 tolerates 2. 1 is single-node with no fault tolerance.
  • Peer discovery: members find each other over stable headless-Service DNS (<sts>-N.<sts>-headless). --initial-cluster is the full static peer list, rendered from replicaCount at template time.
  • Parallel bootstrap: podManagementPolicy: Parallel: all members start together to form the initial quorum (ordered startup would deadlock, since member 0 can't become Ready until its peers exist).
  • Node spread: a soft podAntiAffinity places members on distinct nodes when capacity allows (override with .Values.affinity).
  • PodDisruptionBudget: minAvailable: 2 so a voluntary drain can never take the 3-node cluster below quorum.
  • Per-pod storage: each member gets its own PVC (volumeClaimTemplate): never a shared disk.
  • Two Services: a client Service on 2379 load-balanced across all ready members, and the headless Service (2379/2380) for peer identity.

Failover / self-healing

  • Member/pod loss (T1): the StatefulSet recreates the pod; it reattaches its PVC and rejoins by replaying its WAL. Zero-touch. initialClusterState is only read on a member's first boot with an empty data dir, on restart etcd reads the WAL and rejoins regardless, so leaving it at new is correct.
  • Node loss (T2): the pod reschedules (anti-affinity spreads members) and its PVC reattaches.
  • Quorum loss is NOT auto-rebuilt. Losing a majority (2 of 3) is split-brain territory and requires a human. Restore/recreate deliberately.

Kill-the-leader is safe: delete the leader pod and the two survivors elect a new leader (Raft term advances) while the cluster stays writable; the deleted pod rejoins on restart.

Growing / re-adding members

Raising replicaCount after bootstrap does not auto-join new members, etcd forbids implicit membership changes. To add or re-add a member (e.g. one whose data was wiped), register it first with etcdctl member add, then bring the pod up with initialClusterState: existing.

Verify the image

cosign verify ghcr.io/quenchworks/images/etcd \
  --certificate-identity-regexp 'https://github.com/quenchworks/.+' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Each image also ships an SPDX SBOM and SLSA build provenance as attestations. Verify them with the GitHub CLI:

gh attestation verify oci://ghcr.io/quenchworks/images/etcd \
  --owner quenchworks

Values

KeyDefaultNotes
image.repositoryghcr.io/quenchworks/images/etcd
image.digest(CI-written)Required. Charts pin by digest, never a tag.
replicaCount3HA Raft cluster. Use an odd number for quorum.
initialClusterStatenewnew to bootstrap; existing only for manual member re-add.
persistence.enabledtrue8Gi PVC per member at /data.
service.clientPort2379Client Service across all ready members.
service.peerPort2380Peer traffic over the headless Service.
tls.enabledfalseNative TLS on the client port (https URLs, cert at /tls); peers stay http. Members advertise <pod>.<headless>.<ns>.svc. Use etcdctl --endpoints=https://... --cacert=/tls/ca.crt.
tls.existingSecret""Use this kubernetes.io/tls Secret (1st choice).
tls.certManager.enabledfalseRequest a cert-manager Certificate from tls.certManager.issuerRef (2nd choice).
tls.selfSigned.validityDays365Otherwise Helm generates a CA + certificate, kept across upgrades.
metrics.serviceMonitor.enabledfalseetcd serves /metrics natively on the client port.
serviceAccount.createtrueToken automount is off.
rbac.createfalseMinimal Role/RoleBinding.
networkPolicy.enabledtruePeer traffic allowed between members; client ingress from the namespace.
podDisruptionBudget.enabledtrueminAvailable: 2 (quorum of 3).
affinity{}Set to override the default soft node-spread anti-affinity.

Security

Runs nonroot (uid 1001) on a read-only root filesystem with all capabilities dropped. Only the /data volume is writable.

Notes

etcd RBAC auth / mTLS between peers and clients are tracked as follow-ups. Metrics need no exporter: etcd exposes Prometheus metrics on the client port at /metrics.

Deploy etcd with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has etcd on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartetcd is pinned at v0.0.31 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply