Skip to main content

etcd

Overview​

  • Namespace: etcd
  • Purpose: etcd key-value store for APISIX configuration
  • Age: 567 days
  • Status: x Scaled to Zero - No pods running

Workloads​

StatefulSets​

NameReplicasStatusAgePurpose
apisix-etcd0/0x Scaled to 0435detcd cluster for APISIX

Services​

NameTypeCluster IPPortsPurpose
apisix-etcdClusterIP10.29.42.1332379, 2380etcd client/peer API
apisix-etcd-headlessClusterIP (Headless)None2379, 2380StatefulSet service

Current Status​

The etcd StatefulSet is scaled to 0, meaning:

  • No etcd pods are running
  • No data storage is active
  • APISIX cannot function without it

Dependencies​

Used by: APISIX namespace

  • APISIX requires etcd for configuration storage
  • Both APISIX and etcd are currently scaled to 0

Management​

View resources:​

kubectl get all -n etcd

Scale up etcd (if reactivating APISIX):​

# Scale up to 3 replicas for HA
kubectl scale statefulset apisix-etcd -n etcd --replicas=3

# Wait for pods to be ready
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=etcd -n etcd --timeout=300s

Check StatefulSet status:​

kubectl describe statefulset apisix-etcd -n etcd

View etcd pods (when running):​

kubectl get pods -n etcd -o wide

etcd Cluster Configuration​

etcd is deployed as a StatefulSet for:

  • Stable Network Identity: Predictable pod names and DNS
  • Persistent Storage: Data survives pod restarts
  • Ordered Deployment: Pods start/stop in order

Typical etcd cluster setup:

  • 3 or 5 replicas for high availability
  • Persistent volumes for data storage
  • Peer communication on port 2380
  • Client API on port 2379

Persistent Volumes​

Check persistent volume claims:

kubectl get pvc -n etcd

When scaled to 0, PVCs may still exist, preserving data.

Monitoring (when active)​

Check etcd health:​

# From within an etcd pod
kubectl exec -it apisix-etcd-0 -n etcd -- etcdctl endpoint health

View etcd members:​

kubectl exec -it apisix-etcd-0 -n etcd -- etcdctl member list

Resource usage:​

kubectl top pods -n etcd

Recommendations​

Decision Required​

Since etcd is only used by APISIX, and APISIX is scaled to 0:

Option 1: Remove (if APISIX not needed)

# Delete StatefulSet
kubectl delete statefulset apisix-etcd -n etcd

# Check and delete PVCs (x DATA LOSS)
kubectl get pvc -n etcd
kubectl delete pvc -n etcd --all

# Delete namespace
kubectl delete namespace etcd

Option 2: Keep for future use

  • Keep namespace and resources scaled to 0
  • Can scale up when needed
  • PVCs preserve data

Option 3: Reactivate with APISIX

# Scale up etcd first
kubectl scale statefulset apisix-etcd -n etcd --replicas=3

# Wait for etcd to be ready
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=etcd -n etcd --timeout=300s

# Then scale up APISIX
kubectl scale deployment apisix -n apisix --replicas=2

Data Backup​

Before any deletion, back up etcd data (if needed):

# Scale up temporarily
kubectl scale statefulset apisix-etcd -n etcd --replicas=1

# Create snapshot
kubectl exec apisix-etcd-0 -n etcd -- etcdctl snapshot save /tmp/backup.db

# Copy snapshot
kubectl cp etcd/apisix-etcd-0:/tmp/backup.db ./etcd-backup.db

Cost Consideration​

  • Scaled to 0: No compute costs
  • PVCs: May still incur storage costs
  • Consider deleting if not needed

etcd Basics​

etcd is a distributed key-value store used for:

  • Configuration management
  • Service discovery
  • Distributed locking
  • Cluster coordination

In this setup, it stores APISIX configuration:

  • Routes
  • Services
  • Plugins
  • Upstream targets

Documentation​