Etcd

From paulpas/agent-skill-router · View interactive version

Etcd is an AI agent skill from the GitHub repository paulpas/agent-skill-router. "Provides etcd in Cloud-Native Engineering - distributed key-value store"

How to use this skill

Skill file

etcd in Cloud-Native Engineering

Category: storage

Status: Graduated

Stars: 36,000

Last Updated: 2026-04-22

Primary Language: Go

Documentation: https://etcd.io/


Purpose and Use Cases

etcd is a distributed key-value store designed to help engineers build, deploy, and manage cloud-native applications.

What Problem Does It Solve?

etcd addresses complex storage challenges by providing:

When to Use This Project

Use etcd when you need distributed key-value store, require storage-specific features, want to integrate with other CNCF projects, need production-ready storage solutions, or require storage-specific best practices.

Key Use Cases


Architecture Design Patterns

Core Components

Component Interactions

  1. User → API Server: Create/modify resources
  2. API Server → Controller: Resource creation event
  3. Controller → Storage: State persistence
  4. Storage → Controller: State retrieval for reconciliation
  5. Controller → Worker: Task delegation
  6. Worker → Status: Status updates back to API

Data Flow Patterns

  1. Reconciliation Flow: Resource change → Controller detects → State comparison → Action taken → Status updated
  2. Event Flow: Event received → Event handler → Reconciler → State updated
  3. Scaling Flow: Metrics threshold → Controller evaluates → Scale decision → Resource scaled
  4. Failure Flow: Component failure → Detector → Recovery action → State restored

Design Principles


Integration Approaches

Integration with Other CNCF Projects

API Patterns

Configuration Patterns

Extension Mechanisms


Common Pitfalls and How to Avoid Them

Configuration Issues

How to Avoid:

Performance Issues

How to Avoid:

Operational Challenges

How to Avoid:

Security Pitfalls

How to Avoid:


Coding Practices

Idiomatic Configuration

API Usage Patterns

Observability Best Practices

Development Workflow

Code Examples

# Example configuration for etcd
apiVersion: cncf.etcd/v1
kind: Etcd
metadata:
  name: example
  namespace: default
spec:
  # Configuration details
  replicas: 3
  resources:
    requests:
      memory: "256Mi"
      cpu: "250m"
    limits:
      memory: "512Mi"
      cpu: "500m"

related-skills: null

Fundamentals

Essential Concepts

Terminology Glossary

Data Models and Types

Lifecycle Management

State Management


Scaling and Deployment Patterns

Horizontal Scaling

High Availability

Production Deployments

Upgrade Strategies

Resource Management

Deployment Patterns


Additional Resources


Examples

Single Node Cluster

# Single node etcd configuration
etcd --name=single-node   --data-dir=/var/lib/etcd   --listen-client-urls=https://0.0.0.0:2379   --advertise-client-urls=https://127.0.0.1:2379   --listen-peer-urls=https://0.0.0.0:2380   --client-cert-auth=true   --auto-tls=true   --peer-client-cert-auth=true   --peer-auto-tls=true

# With configuration file
etcd --config=/etc/etcd/etcd.conf.yml

Three Node Cluster

# Node 1
etcd --name=etcd1   --data-dir=/var/lib/etcd   --initial-advertise-peer-urls=https://10.0.0.1:2380   --listen-peer-urls=https://10.0.0.1:2380   --listen-client-urls=https://10.0.0.1:2379,https://127.0.0.1:2379   --advertise-client-urls=https://10.0.0.1:2379   --initial-cluster=etcd1=https://10.0.0.1:2380,etcd2=https://10.0.0.2:2380,etcd3=https://10.0.0.3:2380   --initial-cluster-token=etcd-cluster-secure-token   --initial-cluster-state=new   --client-cert-auth=true   --peer-client-cert-auth=true

# Node 2 and 3 similar with different IP addresses

Kubernetes Integrated etcd

# etcd configuration for Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: etcd
  namespace: kube-system
spec:
  containers:
  - name: etcd
    image: k8s.gcr.io/etcd:3.5.9-0
    command:
    - etcd
    - --data-dir=/var/lib/etcd
    - --name=etcd0
    - --initial-advertise-peer-urls=https://10.0.0.1:2380
    - --listen-peer-urls=https://0.0.0.0:2380
    - --listen-client-urls=https://0.0.0.0:2379
    - --advertise-client-urls=https://10.0.0.1:2379
    - --initial-cluster=etcd0=https://10.0.0.1:2380,etcd1=https://10.0.0.2:2380,etcd2=https://10.0.0.3:2380
    - --initial-cluster-token=k8s-etcd-cluster-token
    - --initial-cluster-state=new
    - --client-cert-auth=true
    - --peer-client-cert-auth=true
    - --auto-tls=true
    - --peer-auto-tls=true
    volumeMounts:
    - mountPath: /var/lib/etcd
      name: etcd-data
    - mountPath: /etc/ssl/certs
      name: certs
  hostNetwork: true
  volumes:
  - name: etcd-data
    hostPath:
      path: /var/lib/etcd
  - name: certs
    hostPath:
      path: /etc/ssl/certs

Troubleshooting

etcd cluster health check failing

Cause: Network connectivity issues or member failures

Solution:

# Check cluster health
etcdctl endpoint health --endpoints=https://127.0.0.1:2379   --cacert=/etc/etcd/pki/ca.crt   --cert=/etc/etcd/pki/etcd.crt   --key=/etc/etcd/pki/etcd.key

# List members
etcdctl member list --endpoints=https://127.0.0.1:2379   --cacert=/etc/etcd/pki/ca.crt   --cert=/etc/etcd/pki/etcd.crt   --key=/etc/etcd/pki/etcd.key

# Remove failed member
etcdctl member remove <member-id> --endpoints=https://127.0.0.1:2379

etcd disk space exhaustion

Cause: Write operations without compaction or retention

Solution:

# Check current database size
etcdctl endpoint status --endpoints=https://127.0.0.1:2379 -w table

# Compact old revisions
etcdctl compact <rev>

# Defragment database
etcdctl defrag --endpoints=https://127.0.0.1:2379

# Set auto-compaction
etcd --auto-compaction-version=3 --auto-compaction-mode=periodic --auto-compaction-retention=1h

Leader election stuck or slow

Cause: Network latency or resource constraints

Solution:

# Check leader
etcdctl endpoint status --endpoints=https://127.0.0.1:2379 -w table

# Adjust election timeout (advanced)
# In configuration, increase election-timeout if high latency
--election-timeout=5000 --heartbeat-interval=500

# Ensure adequate resources
# etcd needs consistent I/O performance

Member not syncing with cluster

Cause: Network partition or data inconsistency

Solution:

# Remove and re-add member
etcdctl member remove <member-id> --endpoints=https://127.0.0.1:2379

# On the failed node, clear data
rm -rf /var/lib/etcd

# Re-add as new member
etcd --name=<new-name> --initial-cluster-state=existing ...

# Or use etcdctl member add
etcdctl member add <new-name> --peer-urls=https://<ip>:2380

TLS certificate validation failures

Cause: Certificate expiration or misconfiguration

Solution:

# Check certificate expiration
openssl x509 -in /etc/etcd/pki/etcd.crt -noout -dates

# Renew certificates before expiration
# Update all members with new certs

# Verify client certs
etcdctl endpoint health --endpoints=https://127.0.0.1:2379   --cacert=/etc/etcd/pki/ca.crt   --cert=/etc/etcd/pki/admin.crt   --key=/etc/etcd/pki/admin.key

Content generated automatically. Verify against official documentation before production use.

Troubleshooting

Deployment failures

Cause: Configuration errors or resource constraints

Solution: Check pod logs with kubectl logs <pod>, verify configuration values, and ensure adequate cluster resources.

Performance issues

Cause: Resource limits or configuration bottlenecks

Solution: Monitor resource usage with kubectl top, adjust resource limits, and optimize configuration settings.

Configuration errors

Cause: YAML syntax or missing required fields

Solution: Validate YAML syntax, check required configuration fields, and verify environment-specific settings.

Integration problems

Cause: API compatibility or version mismatches

Solution: Verify API compatibility, check dependency versions, and review integration documentation.

Connectivity issues

Cause: Network policies or service discovery problems

Solution: Check network policies, verify service endpoints, and ensure proper DNS resolution.


When to Use

Use this skill when:


Core Workflow

  1. Assess Requirements — Understand the use case, scale, integration needs, and existing infrastructure. Checkpoint: Document requirements, constraints, and success criteria.
  1. Design Architecture — Plan component interactions, data flow, and deployment strategy using cloud-native best practices. Checkpoint: Verify the architecture addresses all requirements and follows CNCF conventions.
  1. Implement & Configure — Create manifests, configurations, and deployment scripts. Include resource limits, health checks, and observability hooks. Checkpoint: Validate all YAML against schema and test in a staging environment.
  1. Deploy & Monitor — Apply manifests to the cluster, verify component health, and confirm observability is working. Checkpoint: Confirm all pods/services are running, probes passing, and metrics/alerts configured.

Constraints

MUST DO

MUST NOT DO


Live References

These links are resolved at load time — content is fetched and inlined to provide the latest documentation.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.