diff --git a/.github/scripts/validate.py b/.github/scripts/validate.py index 2ab7e21..9b01ebb 100644 --- a/.github/scripts/validate.py +++ b/.github/scripts/validate.py @@ -37,14 +37,13 @@ content = skill_md.read_text() - # Check frontmatter exists - if not content.startswith("```skill\n---"): - errors.append(f"{skill_dir.name}: SKILL.md must start with ```skill frontmatter block") + # Check frontmatter exists (plain YAML frontmatter only) + if not content.startswith("---"): + errors.append(f"{skill_dir.name}: SKILL.md must start with plain --- frontmatter") continue # Extract frontmatter try: - # Find the YAML between --- markers inside the ```skill block first_marker = content.index("---") + 3 second_marker = content.index("---", first_marker) frontmatter = content[first_marker:second_marker] diff --git a/skills/dvpod/SKILL.md b/skills/dvpod/SKILL.md new file mode 100644 index 0000000..732fdb5 --- /dev/null +++ b/skills/dvpod/SKILL.md @@ -0,0 +1,385 @@ +--- +name: dvpod +description: | + Deploy, manage, monitor, and troubleshoot Obol DVpod (Distributed Validator Pod) deployments + on Kubernetes using the dv-pod Helm chart. Use when the user wants to deploy a new DVpod, + check status, troubleshoot issues, upgrade, backup, or recover a DVpod deployment. + Covers fresh cluster creation, joining existing clusters, ENR management, DKG orchestration, + and validator client configuration. +user-invocable: true +disable-model-invocation: false +allowed-tools: Read, Grep, Glob, Bash +argument-hint: "[action] [options] — actions: deploy, status, logs, troubleshoot, upgrade, backup, recover, enr, destroy" +--- + +# DVpod — Obol Distributed Validator Pod Manager + +You are an expert Kubernetes operator specializing in Obol Distributed Validator (DV) deployments. You help users deploy and manage DVpod instances using the `dv-pod` Helm chart. + +## Safety Rules + +**ALWAYS ask for user confirmation before:** +- Deleting or destroying a DVpod deployment (`helm uninstall`) +- Deleting secrets (especially ENR private keys — these are **irrecoverable** if lost) +- Running `kubectl delete pvc` (validator data loss risk) +- Any operation that could cause key loss or slashing + +**You MAY proceed autonomously for:** +- `helm upgrade --install` (deploy/upgrade) +- Reading logs, status, secrets +- Creating namespaces +- Adding helm repos +- Running `helm test` +- Port-forwarding for debugging +- Creating backups (read-only copy operations) + +## Context + +The dv-pod Helm chart source is at https://github.com/ObolNetwork/helm-charts/tree/main/charts/dv-pod. +The chart is published via GitHub Pages at `https://obolnetwork.github.io/helm-charts`. +Reference the chart's values, templates, and documentation when answering questions. + +For the full values reference, see [values-reference.md](values-reference.md). +For troubleshooting patterns, see [troubleshooting.md](troubleshooting.md). +For deployment examples, see [examples.md](examples.md). + +## Helm Repo Setup + +If the user hasn't added the Obol helm repo yet, guide them: + +```bash +helm repo add obol https://obolnetwork.github.io/helm-charts +helm repo update +``` + +## Deployment Prerequisites + +Use this quick check before deploy: + +- **Helm chart mode** + - Use when the user already has a reachable beacon API endpoint (external or locally managed). + - Example endpoints: + - external: `https://ethereum-beacon-api.publicnode.com` + - local/in-cluster: `http://:5052` + - Pros: fastest DVpod setup. + +The key requirement is that +`charon.beaconNodeEndpoints[0]` is reachable from the DVpod. + +## Action: deploy + +Deploy a new DVpod. Gather the following from the user before deploying: + +### Required Information +1. **Release name** — a name for this deployment (e.g., `my-dv-pod`) +2. **Namespace** — Kubernetes namespace (default: `dv-pod`) +3. **Operator address** — Ethereum address (0x...) for the operator +4. **Network** — `mainnet`, `sepolia`, or `hoodi` + +**Input collection rules before deploy:** +- Ask the user for all four deploy inputs: release name, namespace, operator address, and network. +- If release name is not provided, the agent may choose a sensible release default and confirm it. +- If namespace is not provided, the agent may choose `dv-pod` (or an existing DVpod namespace) and confirm it. +- **Do not invent or default** `operatorAddress`; it must come from the user. +- **Do not invent or default** `network`; it must come from the user. +- The operator address must be the same address the user will use to sign in Obol Launchpad. + +### Optional but Important +5. **Beacon node endpoint(s)** — URL(s) of beacon node(s). If not provided, the user will need to configure this later. +6. **Validator client type** — lighthouse (default), teku, prysm, nimbus, or lodestar +7. **Target config hash** — if joining a specific existing cluster (0x + 64 hex chars) +8. **Existing ENR secret** — if the user has a pre-existing ENR private key + +### Multiple Releases in the Same Namespace + +**IMPORTANT:** When deploying multiple DVpod releases in the same namespace, you **MUST** set +`secrets.defaultEnrPrivateKey=""` so each release gets its own ENR secret (`-enr-key`) +instead of all sharing the default `charon-enr-private-key` secret. Without this, all releases +will share a single ENR, which breaks cluster formation since each peer needs a unique identity. + +Add to every `helm upgrade --install` command: +``` +--set secrets.defaultEnrPrivateKey="" +``` + +### Group Clusters vs Solo Clusters + +**Group clusters** have multiple distinct operators — each node has a different operator address. +The DKG sidecar's auto-discovery only works with group clusters. It polls the Obol API for cluster +definitions where this node's ENR is registered under its operator address. + +**Solo clusters** (one operator controls all nodes) are NOT supported for auto-setup via the DKG +sidecar. The Launchpad solo flow does not use the same API-based discovery mechanism. + +When deploying multiple nodes for a **group cluster**, each release MUST have a different +`charon.operatorAddress` matching the address that will sign for that node on the Launchpad. +If the operator addresses don't match the Launchpad configuration, the DKG sidecar will poll +indefinitely without finding an invite — this is a common source of confusion. + +### Deployment Scenarios + +**Scenario A: Fresh group cluster** +- Auto-generates ENR +- DKG sidecar polls Obol API waiting for cluster creation on Launchpad +- User creates/joins cluster on the network-specific Launchpad after deploy +- Each node must have the correct operator address matching its Launchpad registration +- Ask the user for the real `charon.operatorAddress` before running Helm + +```bash +helm upgrade --install obol/dv-pod \ + --namespace --create-namespace \ + --set charon.operatorAddress=
\ + --set network= \ + --set 'charon.beaconNodeEndpoints[0]=' \ + --set secrets.defaultEnrPrivateKey="" \ + --timeout=10m +``` + +**Scenario B: Join existing cluster with targetConfigHash** +- User already has a cluster invitation and config hash from Launchpad + +```bash +helm upgrade --install obol/dv-pod \ + --namespace --create-namespace \ + --set charon.operatorAddress=
\ + --set network= \ + --set 'charon.beaconNodeEndpoints[0]=' \ + --set charon.dkgSidecar.targetConfigHash= \ + --timeout=10m +``` + +**Scenario C: Import existing ENR** +- User has an ENR private key from a previous setup + +First, help them create the secret: +```bash +kubectl create namespace --dry-run=client -o yaml | kubectl apply -f - +kubectl create secret generic charon-enr-private-key -n \ + --from-file=charon-enr-private-key= \ + --from-literal=enr="" +``` + +Then deploy with: +```bash +helm upgrade --install obol/dv-pod \ + --namespace \ + --set charon.operatorAddress=
\ + --set network= \ + --set 'charon.beaconNodeEndpoints[0]=' \ + --set charon.enr.existingSecret.name=charon-enr-private-key \ + --timeout=10m +``` + +### Post-Deploy Steps +After deploying, automatically: +1. Wait for pods to be ready +2. Retrieve and display the public ENR +3. Show next steps: + - remind the user which operator address they deployed with + - give the correct Launchpad URL for the selected network + - tell them to sign with that same operator address in Launchpad +4. Start DKG monitoring: + `kubectl logs -n -c dkg-sidecar --follow` +5. Validate beacon reachability from charon: + `kubectl exec -n -c charon -- wget -qO- /eth/v1/node/health` + +## Action: status + +Check the health and state of a DVpod deployment. + +```bash +# Find DVpod releases +helm list -n --filter ".*dv-pod.*" + +# Pod status +kubectl get pods -n -l app.kubernetes.io/instance= + +# Check all containers in the pod +kubectl get pods -n -l app.kubernetes.io/instance= -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{range .status.containerStatuses[*]} {.name}: ready={.ready}, restarts={.restartCount}{"\n"}{end}{end}' + +# Check PVCs +kubectl get pvc -n -l app.kubernetes.io/instance= + +# Check secrets +kubectl get secrets -n -l app.kubernetes.io/instance= + +# Check ENR secret +kubectl get secret charon-enr-private-key -n -o jsonpath='{.data.enr}' 2>/dev/null | base64 -d + +# Check if cluster-lock exists (DKG completed) +kubectl exec -n -c charon -- ls -la /charon-data/cluster-lock.json 2>/dev/null + +# Check ENR job +kubectl get jobs -n -l app.kubernetes.io/instance= +``` + +Present the status in a clear summary: deployment phase (waiting for ENR, waiting for DKG, running, error), container health, and any issues detected. + +## Action: logs + +Show logs for DVpod containers. Determine which container the user needs: + +- **charon** — main Charon middleware logs +- **dkg-sidecar** — DKG orchestration logs (most useful during setup) +- **validator-client** — validator client logs (after DKG completes) + +```bash +# DKG sidecar logs (during setup) +kubectl logs -n -c dkg-sidecar --tail=100 + +# Charon logs +kubectl logs -n -c charon --tail=100 + +# Validator client logs +kubectl logs -n -c validator-client --tail=100 + +# Follow logs in real-time +kubectl logs -n -c --follow +``` + +## Action: troubleshoot + +Diagnose issues with a DVpod deployment. Run a comprehensive check: + +1. **Pod status** — check for CrashLoopBackOff, ImagePullBackOff, Pending +2. **Events** — `kubectl get events -n --sort-by='.lastTimestamp'` +3. **ENR job** — did it complete? Check job logs +4. **DKG sidecar** — is it polling? Any errors? +5. **Charon container** — startup errors, peer connectivity +6. **Validator client** — keystore import issues +7. **PVC** — storage bound? +8. **Network policy** — if enabled, check connectivity + +Common issues and fixes — see [troubleshooting.md](troubleshooting.md). + +## Action: upgrade + +Upgrade a DVpod deployment (new chart version or config change). + +```bash +# Check current values +helm get values -n + +# Check available chart versions +helm search repo obol/dv-pod --versions + +# Upgrade +helm repo update +helm upgrade obol/dv-pod -n \ + --reuse-values \ + --set = \ + --timeout=10m +``` + +**Important:** Always use `--reuse-values` to preserve existing configuration unless the user explicitly wants to reset values. + +## Action: enr + +Manage ENR (Ethereum Node Record) for the DVpod. + +```bash +# Get public ENR +kubectl get secret charon-enr-private-key -n \ + -o jsonpath='{.data.enr}' | base64 -d + +# Get ENR from release-named secret +kubectl get secret -enr-key -n \ + -o jsonpath='{.data.enr}' | base64 -d +``` + +If the user needs to find the ENR secret name: +```bash +kubectl get secrets -n | grep -E "enr|charon" +``` + +## Action: backup + +Back up the .charon directory (cluster-lock, keys, deposit data) from a running pod. + +**IMPORTANT:** Always confirm the backup destination with the user. + +```bash +# Create local backup directory +mkdir -p ~/charon-backup--$(date +%Y%m%d) + +# Copy charon data from pod +kubectl cp /:/charon-data/ ~/charon-backup--$(date +%Y%m%d)/ -c charon + +# Verify backup contents +ls -la ~/charon-backup--$(date +%Y%m%d)/ +``` + +Expected files after DKG: +- `cluster-lock.json` — cluster configuration +- `cluster-definition.json` — original cluster definition +- `deposit-data.json` — validator deposit data +- `validator_keys/` — keystores and passwords + +## Action: recover + +Recover a DVpod from backup. **Ask for user confirmation before proceeding.** + +Steps: +1. Verify backup contents exist +2. Create the namespace if needed +3. Create ENR secret from backup +4. Deploy with existing secret reference +5. Copy cluster-lock and keys back into the pod + +## Action: destroy + +**ALWAYS ask for explicit user confirmation.** Warn about: +- Loss of ENR private key if not backed up +- Loss of validator keys if not backed up +- Potential slashing risk if validators are still active + +```bash +# Step 1: Backup first (offer this) +# Step 2: Uninstall +helm uninstall -n + +# Step 3: Optionally clean up PVCs +kubectl delete pvc -n -l app.kubernetes.io/instance= + +# Step 4: Optionally clean up secrets +kubectl delete secret charon-enr-private-key -n +``` + +## General Guidelines + +- When the user's request doesn't match a specific action, use your knowledge of the chart to help. +- Always check `helm list` and `kubectl get pods` first to understand existing state. +- If the user provides a namespace, use it. If not, check for existing DVpod deployments or default to `dv-pod` and confirm. +- Require the user to explicitly provide `network` and `operatorAddress` before deployment. +- When showing ENRs, format them clearly — they are long strings the user may need to copy. +- For network selection, map friendly names: mainnet=1, sepolia=11155111, hoodi=560048. +- The Obol Launchpad URLs are network-specific: + - **Mainnet:** https://launchpad.obol.org + - **Hoodi:** https://hoodi.launchpad.obol.org + - **Sepolia:** https://sepolia.launchpad.obol.org +- The Obol API endpoint is https://api.obol.tech +- If the user mentions `$ARGUMENTS`, parse it to determine the action and any additional context. + +## Capabilities and Limits + +- This skill can deploy, upgrade, monitor, and troubleshoot `dv-pod` on Kubernetes. +- This skill cannot perform Launchpad actions for the user (cluster creation, invite acceptance, operator signatures). +- DKG completion depends on all external operator steps being completed on Launchpad. +- Solo-flow DKG is not supported. + +## Parsing $ARGUMENTS + +Parse the first word of `$ARGUMENTS` as the action. Everything after is context: +- `/dvpod deploy` — start fresh deploy flow +- `/dvpod deploy sepolia` — deploy on sepolia +- `/dvpod status` — check status (auto-detect namespace/release) +- `/dvpod status my-dv-pod` — check specific release +- `/dvpod logs dkg` — show DKG sidecar logs +- `/dvpod logs charon` — show Charon logs +- `/dvpod troubleshoot` — run diagnostics +- `/dvpod upgrade` — upgrade existing deployment +- `/dvpod enr` — retrieve ENR +- `/dvpod backup` — backup charon data +- `/dvpod recover` — recover from backup +- `/dvpod destroy` — tear down (with confirmation) +- `/dvpod` (no args) — show available actions and detect existing deployments diff --git a/skills/dvpod/examples.md b/skills/dvpod/examples.md new file mode 100644 index 0000000..fedbe72 --- /dev/null +++ b/skills/dvpod/examples.md @@ -0,0 +1,247 @@ +# DVpod Deployment Examples + +## Example 1: Minimal Mainnet Deploy (Fresh Cluster) + +The simplest deployment — auto-generates ENR, uses defaults for everything else. + +```bash +helm repo add obol https://obolnetwork.github.io/helm-charts +helm repo update + +helm upgrade --install my-dv-pod obol/dv-pod \ + --namespace dv-pod --create-namespace \ + --set charon.operatorAddress=0x1234567890abcdef1234567890abcdef12345678 \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon-node:5052' \ + --timeout=10m +``` + +After deploy: +```bash +# Get your ENR to paste on the Launchpad +kubectl get secret charon-enr-private-key -n dv-pod \ + -o jsonpath='{.data.enr}' | base64 -d +``` + +## Example 2: Sepolia Testnet Deploy + +```bash +helm upgrade --install test-dv obol/dv-pod \ + --namespace dv-pod-testnet --create-namespace \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set network=sepolia \ + --set 'charon.beaconNodeEndpoints[0]=http://sepolia-beacon:5052' \ + --set charon.logLevel=debug \ + --timeout=10m +``` + +## Example 3: Join Specific Cluster with Config Hash + +When you have a cluster invitation from the Obol Launchpad: + +```bash +helm upgrade --install my-dv-pod obol/dv-pod \ + --namespace dv-pod --create-namespace \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set charon.dkgSidecar.targetConfigHash=0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890 \ + --timeout=10m +``` + +## Example 4: Using Teku Validator Client + +```bash +helm upgrade --install my-dv-pod obol/dv-pod \ + --namespace dv-pod --create-namespace \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set validatorClient.type=teku \ + --timeout=10m +``` + +## Example 5: Using Prysm Validator Client + +Prysm requires accepting Terms of Service: + +```bash +helm upgrade --install my-dv-pod obol/dv-pod \ + --namespace dv-pod --create-namespace \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set validatorClient.type=prysm \ + --set validatorClient.config.prysm.acceptTermsOfUse=true \ + --timeout=10m +``` + +## Example 6: Import Existing ENR + +If you already have an ENR from a previous setup: + +```bash +# Step 1: Create the secret +kubectl create namespace dv-pod --dry-run=client -o yaml | kubectl apply -f - +kubectl create secret generic charon-enr-private-key -n dv-pod \ + --from-file=charon-enr-private-key=~/.charon/charon-enr-private-key \ + --from-literal=enr="enr:-IS4Q..." + +# Step 2: Deploy referencing the secret +helm upgrade --install my-dv-pod obol/dv-pod \ + --namespace dv-pod \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set charon.enr.existingSecret.name=charon-enr-private-key \ + --timeout=10m +``` + +## Example 7: Group Cluster — Multiple Nodes with Different Operators + +Deploy 4 nodes for a group cluster where each node has a distinct operator address. +Each operator will sign for their node on the Launchpad independently. + +**IMPORTANT:** Each release MUST have: +- A unique operator address matching the Launchpad configuration +- `secrets.defaultEnrPrivateKey=""` so each gets its own ENR secret + +```bash +# Node 0 — Operator A +helm upgrade --install my-dv-pod-0 obol/dv-pod \ + --namespace dv-pod --create-namespace \ + --set charon.operatorAddress=0xOPERATOR_A_ADDRESS \ + --set network=hoodi \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set secrets.defaultEnrPrivateKey="" \ + --timeout=10m + +# Node 1 — Operator B +helm upgrade --install my-dv-pod-1 obol/dv-pod \ + --namespace dv-pod \ + --set charon.operatorAddress=0xOPERATOR_B_ADDRESS \ + --set network=hoodi \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set secrets.defaultEnrPrivateKey="" \ + --timeout=10m + +# Node 2 — Operator C +helm upgrade --install my-dv-pod-2 obol/dv-pod \ + --namespace dv-pod \ + --set charon.operatorAddress=0xOPERATOR_C_ADDRESS \ + --set network=hoodi \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set secrets.defaultEnrPrivateKey="" \ + --timeout=10m + +# Node 3 — Operator D +helm upgrade --install my-dv-pod-3 obol/dv-pod \ + --namespace dv-pod \ + --set charon.operatorAddress=0xOPERATOR_D_ADDRESS \ + --set network=hoodi \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set secrets.defaultEnrPrivateKey="" \ + --timeout=10m +``` + +After deploy, collect all ENRs and create the cluster on the Launchpad: +```bash +for i in 0 1 2 3; do + echo "my-dv-pod-$i:" + kubectl get secret "my-dv-pod-$i-enr-key" -n dv-pod \ + -o jsonpath='{.data.enr}' | base64 -d + echo +done +``` + +Each operator must accept the cluster invite on the Launchpad for DKG to begin. + +## Example 8: Multiple Beacon Nodes with Fallbacks + +```bash +helm upgrade --install my-dv-pod obol/dv-pod \ + --namespace dv-pod --create-namespace \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set 'charon.beaconNodeEndpoints[0]=http://primary-beacon:5052' \ + --set 'charon.beaconNodeEndpoints[1]=http://secondary-beacon:5052' \ + --set 'charon.fallbackBeaconNodeEndpoints[0]=http://fallback-beacon:5052' \ + --timeout=10m +``` + +## Example 9: Custom Resource Limits + +For resource-constrained environments: + +```bash +helm upgrade --install my-dv-pod obol/dv-pod \ + --namespace dv-pod --create-namespace \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set resources.requests.cpu=500m \ + --set resources.requests.memory=1Gi \ + --set resources.limits.cpu=1000m \ + --set resources.limits.memory=2Gi \ + --timeout=10m +``` + +## Example 10: Enable Central Monitoring + +```bash +helm upgrade --install my-dv-pod obol/dv-pod \ + --namespace dv-pod --create-namespace \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set centralMonitoring.enabled=true \ + --set centralMonitoring.token=YOUR_MONITORING_TOKEN \ + --timeout=10m +``` + +## Example 11: Enable Prometheus ServiceMonitor + +For clusters running Prometheus Operator: + +```bash +helm upgrade --install my-dv-pod obol/dv-pod \ + --namespace dv-pod --create-namespace \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set 'charon.beaconNodeEndpoints[0]=http://beacon:5052' \ + --set serviceMonitor.enabled=true \ + --set serviceMonitor.interval=30s \ + --timeout=10m +``` + +## Example 12: Full Production Deploy + +A comprehensive production deployment with all recommended settings: + +```bash +helm upgrade --install prod-dv obol/dv-pod \ + --namespace dv-prod --create-namespace \ + --set charon.operatorAddress=0xYOUR_ADDRESS \ + --set charon.nickname="prod-operator-1" \ + --set 'charon.beaconNodeEndpoints[0]=http://primary-beacon:5052' \ + --set 'charon.beaconNodeEndpoints[1]=http://secondary-beacon:5052' \ + --set 'charon.fallbackBeaconNodeEndpoints[0]=http://fallback-beacon:5052' \ + --set charon.builderApi=true \ + --set charon.featureSet=stable \ + --set charon.logLevel=info \ + --set validatorClient.type=lighthouse \ + --set persistence.size=5Gi \ + --set centralMonitoring.enabled=true \ + --set centralMonitoring.token=YOUR_TOKEN \ + --set serviceMonitor.enabled=true \ + --set podDisruptionBudget.enabled=true \ + --set networkPolicy.enabled=true \ + --timeout=10m +``` + +## Quick Status Check Commands + +```bash +# All-in-one status +kubectl get pods,pvc,jobs,secrets -n dv-pod -l app.kubernetes.io/instance=my-dv-pod + +# Get ENR +kubectl get secret charon-enr-private-key -n dv-pod -o jsonpath='{.data.enr}' | base64 -d + +# DKG progress +kubectl logs -n dv-pod -l app.kubernetes.io/instance=my-dv-pod -c dkg-sidecar --tail=20 + +# Check if DKG completed +kubectl exec -n dv-pod my-dv-pod-0 -c charon -- ls /charon-data/cluster-lock.json 2>/dev/null && echo "DKG COMPLETE" || echo "DKG NOT YET COMPLETE" +``` diff --git a/skills/dvpod/troubleshooting.md b/skills/dvpod/troubleshooting.md new file mode 100644 index 0000000..4e13f3d --- /dev/null +++ b/skills/dvpod/troubleshooting.md @@ -0,0 +1,242 @@ +# DVpod Troubleshooting Reference + +## Diagnostic Checklist + +Run these in order when troubleshooting a DVpod deployment: + +```bash +# 1. Check pod status +kubectl get pods -n -l app.kubernetes.io/instance= -o wide + +# 2. Check events for errors +kubectl get events -n --sort-by='.lastTimestamp' --field-selector involvedObject.kind=Pod | tail -20 + +# 3. Check ENR job completion +kubectl get jobs -n -l app.kubernetes.io/instance= +kubectl logs job/-dv-pod-enr-job -n + +# 4. Check DKG sidecar +kubectl logs -n -c dkg-sidecar --tail=50 + +# 5. Check Charon +kubectl logs -n -c charon --tail=50 + +# 6. Check validator client +kubectl logs -n -c validator-client --tail=50 + +# 7. Check PVCs +kubectl get pvc -n -l app.kubernetes.io/instance= + +# 8. Check secrets exist +kubectl get secrets -n | grep -E "enr|charon" +``` + +## Common Issues + +### Interpreting Results Quickly + +- DKG sidecar polling is normal right after deploy; persistent polling usually means Launchpad/operator mismatch or pending signatures. +- Missing `/charon-data/cluster-lock.json` means DKG has not completed yet. +- Charon restart loops with beacon errors usually indicate bad/unreachable `charon.beaconNodeEndpoints`. +- Healthy pods but no DKG progress usually means external coordination (other operators) is incomplete. + +### Pod stuck in Pending + +**Symptoms:** Pod stays in `Pending` state. + +**Causes & Fixes:** +- **Insufficient resources:** Check node capacity. Charon needs 1 CPU + 2Gi RAM minimum. + ```bash + kubectl describe pod -n | grep -A5 "Events" + kubectl top nodes + ``` +- **PVC not binding:** StorageClass may not support `ReadWriteOnce` or no available PVs. + ```bash + kubectl get pvc -n + kubectl get storageclass + ``` +- **Node selector/tolerations:** Check if nodeSelector or tolerations are misconfigured. + +### ENR Job Failed + +**Symptoms:** ENR job shows `Failed` or `BackoffLimitExceeded`. + +**Causes & Fixes:** +- **RBAC issue:** The ENR job needs permission to create secrets. + ```bash + kubectl logs job/-dv-pod-enr-job -n + kubectl get role,rolebinding -n | grep enr + ``` +- **Image pull failure:** Check if the charon image is accessible. +- **Secret already exists with wrong keys:** The secret must have keys `charon-enr-private-key` and `enr`. + ```bash + kubectl get secret charon-enr-private-key -n -o json | jq '.data | keys' + ``` + +### DKG Sidecar Polling Forever + +**Symptoms:** DKG sidecar logs show repeated polling with no cluster found. Logs show cluster definitions +but say "No invite found" for all of them. + +**Causes & Fixes:** +- **Operator address mismatch (most common):** Each release's `charon.operatorAddress` must exactly + match the address assigned to that node's ENR on the Launchpad. For group clusters, each node + typically has a different operator address. Verify with: + ```bash + helm get values -n | grep operatorAddress + ``` + Fix: `helm upgrade obol/dv-pod -n --reuse-values --set charon.operatorAddress=` + then restart the pod: `kubectl delete pod -n ` +- **Cluster not fully confirmed:** ALL operators must accept/sign on the Launchpad before the + sidecar will detect the invite. Check the Launchpad cluster page to see which operators are pending. +- **Solo cluster (not supported):** The DKG sidecar auto-discovery only works with group clusters. + Solo cluster flows on the Launchpad use a different mechanism. +- **Wrong targetConfigHash:** If set, verify it matches the cluster on Launchpad. +- **API connectivity:** Check if the pod can reach `api.obol.tech`. + ```bash + kubectl exec -n -c dkg-sidecar -- wget -qO- https://api.obol.tech/health 2>&1 || echo "Cannot reach API" + ``` +- **Network policy blocking egress:** If `networkPolicy.enabled=true`, ensure Obol API egress is allowed. + +### Multiple Releases Sharing the Same ENR + +**Symptoms:** Multiple DVpod releases in the same namespace all report the same public ENR. DKG sidecar polls forever because the cluster definition expects distinct peer identities. + +**Cause:** By default, the ENR job writes to a shared secret named `charon-enr-private-key`. When multiple releases exist in the same namespace, each ENR job overwrites the previous one, so all pods end up with the last-generated key. + +**Fix:** Set `secrets.defaultEnrPrivateKey=""` on every release so each gets its own secret (`-enr-key`): +```bash +helm upgrade obol/dv-pod -n \ + --reuse-values \ + --set secrets.defaultEnrPrivateKey="" +``` +After upgrading, verify each release has a unique ENR: +```bash +for release in my-dv-pod-0 my-dv-pod-1 my-dv-pod-2 my-dv-pod-3; do + enr=$(kubectl get secret -n ${release}-enr-key -o jsonpath='{.data.enr}' | base64 -d) + echo "${release}: ${enr}" +done +``` + +### ENR Mismatch Error + +**Symptoms:** DKG sidecar logs show "ENR MISMATCH". + +**Causes & Fixes:** +- The ENR in the secret doesn't match what's registered in the cluster definition. +- **Option 1:** Update the cluster definition on Launchpad with the current ENR. +- **Option 2:** Delete the secret and redeploy with the correct ENR: + ```bash + # Get current ENR + kubectl get secret charon-enr-private-key -n -o jsonpath='{.data.enr}' | base64 -d + ``` + +### CrashLoopBackOff on Charon Container + +**Symptoms:** Charon container keeps restarting. + +**Causes & Fixes:** +- **No beacon node configured:** + ```bash + helm get values -n | grep beacon + ``` + Fix: Set `charon.beaconNodeEndpoints[0]`. +- **Beacon node unreachable:** Check network connectivity from the pod. + ```bash + kubectl exec -n -c charon -- wget -qO- /eth/v1/node/health 2>&1 + ``` +- **Invalid cluster-lock.json:** Check Charon logs for specific error messages. +- **Port conflicts:** Ensure ports 3600, 3610, 3620 are not conflicting. + +### Local k3d/macOS Mount Error in dkg-sidecar + +**Symptoms:** Init container fails with an error similar to: +`error mounting ... /charon-data/charon-enr-private-key ... mountpoint ... is outside of rootfs`. + +**Cause:** Environment-specific mount behavior when a secret subPath is mounted under a PVC path. + +**Testing workaround:** disable charon-data persistence for the test run: +```bash +helm upgrade obol/dv-pod -n \ + --reuse-values \ + --set persistence.enabled=false +``` + +**Note:** This workaround is for test/dev only; data is not persisted across restarts. +This chart-level mount-path issue is expected to be fixed soon. + +### Validator Client Not Starting + +**Symptoms:** validator-client container in CrashLoopBackOff or Error. + +**Causes & Fixes:** +- **No keystores yet:** Validator client needs DKG to complete first. Check if `cluster-lock.json` exists. + ```bash + kubectl exec -n -c charon -- ls /charon-data/cluster-lock.json + ``` +- **Wrong validator client type:** Check compatibility with the network. +- **Prysm ToS not accepted:** + ```bash + helm get values -n | grep acceptTerms + ``` + Fix: Set `validatorClient.config.prysm.acceptTermsOfUse=true`. +- **Keystore import failure:** Check init container logs: + ```bash + kubectl logs -n -c import-keystores + ``` + +### Storage Issues + +**Symptoms:** Pod restart loses data, or PVC shows as `Pending`. + +**Causes & Fixes:** +- **persistence.enabled=false:** Data stored in emptyDir is lost on restart. + ```bash + helm get values -n | grep persistence + ``` +- **StorageClass missing:** Ensure a default StorageClass exists. + ```bash + kubectl get storageclass + ``` + +### Network Connectivity Between Peers + +**Symptoms:** Charon logs show peer connection failures. + +**Causes & Fixes:** +- **P2P relays not configured:** For clusters spanning networks, relays may be needed. + ```bash + helm get values -n | grep p2p + ``` +- **Firewall/NetworkPolicy:** Ensure port 3610 (P2P TCP) is accessible. +- **External IP not set:** If running behind NAT: + ```bash + --set charon.p2pExternalHostname= + # or + --set charon.p2pExternalIp= + ``` + +## Recovery from Failed DKG + +If DKG fails or gets stuck: + +1. Check all operators' nodes are online and running +2. Check all operators have signed on the Launchpad +3. Check DKG sidecar logs for specific errors +4. If needed, restart the DKG sidecar: + ```bash + kubectl delete pod -n + ``` + The StatefulSet will recreate it and DKG sidecar will retry. + +## Monitoring Endpoints + +```bash +# Charon metrics +kubectl port-forward -n 3620:3620 +# Visit: http://localhost:3620/metrics + +# Validator client metrics (if enabled) +kubectl port-forward -n 5064:5064 +# Visit: http://localhost:5064/metrics +``` diff --git a/skills/dvpod/values-reference.md b/skills/dvpod/values-reference.md new file mode 100644 index 0000000..fe10bd0 --- /dev/null +++ b/skills/dvpod/values-reference.md @@ -0,0 +1,113 @@ +# DVpod Values Reference + +Quick reference for the most important `dv-pod` Helm chart values. For the complete schema, see the [values.yaml](https://github.com/ObolNetwork/helm-charts/blob/main/charts/dv-pod/values.yaml) in the helm-charts repo. + +## Essential Values + +| Value | Description | Default | Required | +|-------|-------------|---------|----------| +| `charon.operatorAddress` | Ethereum address for auto-DKG | — | Yes | +| `network` | Network: mainnet, sepolia, hoodi | `mainnet` | No | +| `charon.beaconNodeEndpoints[0]` | Primary beacon node URL | — | Recommended | + +## Network / Chain ID Mapping + +| Network | Chain ID | Notes | +|---------|----------|-------| +| mainnet | 1 | Production Ethereum | +| sepolia | 11155111 | Primary testnet | +| hoodi | 560048 | Newer testnet | + +## Charon Configuration + +| Value | Description | Default | +|-------|-------------|---------| +| `charon.nickname` | Node identifier (max 32 chars) | — | +| `charon.beaconNodeEndpoints` | List of beacon node URLs | `[]` | +| `charon.fallbackBeaconNodeEndpoints` | Fallback beacon node URLs | `[]` | +| `charon.builderApi` | Enable MEV/builder API | `true` | +| `charon.featureSet` | Feature set: alpha, beta, stable | `stable` | +| `charon.logLevel` | Log level: debug, info, warn, error | `info` | +| `charon.logFormat` | Log format: console, logfmt, json | `json` | +| `charon.p2pRelays` | libp2p relay URLs | — | +| `charon.p2pExternalHostname` | External P2P hostname | — | +| `charon.directConnectionEnabled` | Pod-to-pod direct P2P | `true` | +| `charon.noVerify` | Disable verification | `false` | + +## DKG Sidecar + +| Value | Description | Default | +|-------|-------------|---------| +| `charon.dkgSidecar.enabled` | Enable DKG sidecar | `true` | +| `charon.dkgSidecar.targetConfigHash` | Target specific cluster (0x + 64 hex) | — | +| `charon.dkgSidecar.apiEndpoint` | Obol API endpoint | `https://api.obol.tech` | +| `charon.dkgSidecar.image.repository` | DKG sidecar image | `obolnetwork/charon-dkg-sidecar` | +| `charon.dkgSidecar.image.tag` | DKG sidecar version | `main` | + +## ENR Management + +| Value | Description | Default | +|-------|-------------|---------| +| `charon.enr.generate.enabled` | Auto-generate ENR | `true` | +| `charon.enr.existingSecret.name` | Use pre-existing ENR secret | — | +| `charon.enr.existingSecret.privateKeyDataKey` | Secret key for private key | `charon-enr-private-key` | +| `charon.enr.existingSecret.publicKeyDataKey` | Secret key for public ENR | `enr` | +| `charon.enr.privateKey` | Direct ENR private key (hex) | — | +| `secrets.defaultEnrPrivateKey` | Default ENR secret name | `charon-enr-private-key` | + +## Validator Client + +| Value | Description | Default | +|-------|-------------|---------| +| `validatorClient.enabled` | Enable validator client | `true` | +| `validatorClient.type` | Type: lighthouse, teku, prysm, nimbus, lodestar | `lighthouse` | +| `validatorClient.image.repository` | Custom image (auto-selected if empty) | — | +| `validatorClient.image.tag` | Custom image tag | — | +| `validatorClient.config.graffiti` | Block graffiti string | — | +| `validatorClient.config.extraArgs` | Additional CLI arguments | `[]` | +| `validatorClient.config.prysm.acceptTermsOfUse` | Accept Prysm ToS | `false` | +| `validatorClient.resources.requests.cpu` | CPU request | `500m` | +| `validatorClient.resources.requests.memory` | Memory request | `1Gi` | + +## Persistence + +| Value | Description | Default | +|-------|-------------|---------| +| `persistence.enabled` | Enable persistent storage | `true` | +| `persistence.size` | Charon data volume size | `1Gi` | +| `persistence.validatorDataSize` | Validator data volume size | `500Mi` | +| `persistence.accessModes` | PVC access modes | `[ReadWriteOnce]` | + +## Monitoring + +| Value | Description | Default | +|-------|-------------|---------| +| `centralMonitoring.enabled` | Enable central monitoring | `false` | +| `centralMonitoring.promEndpoint` | Prometheus remote write URL | `https://vm.monitoring.gcp.obol.tech/write` | +| `centralMonitoring.token` | Monitoring auth token | — | +| `serviceMonitor.enabled` | Enable Prometheus ServiceMonitor | `false` | + +## Resources + +| Component | CPU Request | CPU Limit | Mem Request | Mem Limit | +|-----------|-----------|-----------|-------------|-----------| +| Charon | 1000m | 2000m | 2Gi | 4Gi | +| Validator Client | 500m | 1000m | 1Gi | 2Gi | +| DKG Sidecar | 50m | 200m | 128Mi | 256Mi | + +## Security & RBAC + +| Value | Description | Default | +|-------|-------------|---------| +| `rbac.enabled` | Enable RBAC resources | `true` | +| `serviceAccount.enabled` | Create service account | `true` | +| `networkPolicy.enabled` | Enable network policy | `false` | +| `podDisruptionBudget.enabled` | Enable PDB | `true` | + +## Image + +| Value | Description | Default | +|-------|-------------|---------| +| `image.repository` | Charon image | `obolnetwork/charon` | +| `image.tag` | Charon version | `v1.9.2` | +| `image.pullPolicy` | Pull policy | `IfNotPresent` | diff --git a/skills/obol-monitoring/SKILL.md b/skills/obol-monitoring/SKILL.md index d3de62b..7c594a6 100644 --- a/skills/obol-monitoring/SKILL.md +++ b/skills/obol-monitoring/SKILL.md @@ -1,4 +1,3 @@ -```skill --- name: obol-monitoring description: Monitor and diagnose Obol DVT cluster performance using their hosted Grafana (Prometheus metrics + Loki logs) @@ -314,4 +313,3 @@ If the issue is intermittent or slot-specific, use `duty_analysis.py` for a spec - [CDVN Repo](https://github.com/ObolNetwork/charon-distributed-validator-node) — Standard deployment - [LCDVN Repo](https://github.com/ObolNetwork/lido-charon-distributed-validator-node) — Lido-specific deployment - [Charon Source](https://github.com/ObolNetwork/charon) — Charon source code -``` diff --git a/skills/obol-monitoring/scripts/duty_analysis.py b/skills/obol-monitoring/scripts/duty_analysis.py index aea4a0f..63db371 100644 --- a/skills/obol-monitoring/scripts/duty_analysis.py +++ b/skills/obol-monitoring/scripts/duty_analysis.py @@ -9,12 +9,11 @@ import argparse import json import os -import re import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from lib.grafana import ( - get_auth_headers, discover_datasources, prom_query, loki_query, + get_auth_headers, discover_datasources, loki_query, cluster_selector, slot_to_time, slot_to_timestamp, parse_embedded_ts, extract_logfmt, get_cluster_size, ) @@ -84,14 +83,22 @@ def main(): "level": level, "msg": msg, } - if rnd: event["round"] = rnd - if new_round: event["new_round"] = new_round - if rule: event["rule"] = rule - if timeout_reason: event["timeout_reason"] = timeout_reason - if leader_name: event["leader_name"] = leader_name - if leader_index: event["leader_index"] = leader_index - if endpoint: event["endpoint"] = endpoint - if rtt: event["rtt"] = rtt + if rnd: + event["round"] = rnd + if new_round: + event["new_round"] = new_round + if rule: + event["rule"] = rule + if timeout_reason: + event["timeout_reason"] = timeout_reason + if leader_name: + event["leader_name"] = leader_name + if leader_index: + event["leader_index"] = leader_index + if endpoint: + event["endpoint"] = endpoint + if rtt: + event["rtt"] = rtt events.append(event) diff --git a/skills/obol-monitoring/scripts/fleet_overview.py b/skills/obol-monitoring/scripts/fleet_overview.py index 2a6fa35..0c655bb 100644 --- a/skills/obol-monitoring/scripts/fleet_overview.py +++ b/skills/obol-monitoring/scripts/fleet_overview.py @@ -23,20 +23,34 @@ def categorise_cluster(name, size): """Categorise cluster by operator type.""" n = name.lower() - if "curated" in n and "etherfi" in n: return "etherfi_curated" - if name.startswith("EtherFi:"): return "etherfi_curated" - if name.startswith("Pier Two x Etherfi"): return "etherfi_curated" - if "etherfi" in n: return "etherfi_solo" - if "stakely" in n and ("lido" in n or "obol" in n): return "lido_curated" - if "rocklogic" in n: return "lido_curated" - if "ebunker" in n: return "lido_curated" - if name == "?" and size == 4: return "lido_curated" - if "lido x obol" in n: return "lido_sdvt" - if "stakewise" in n: return "protocol_curated" - if "swell" in n: return "protocol_curated" - if "obol" in n and ("mainnet" in n or "eigensquad" in n): return "obol_internal" - if name == "Stakely Obol Portal": return "obol_internal" - if name == "?" or size <= 1: return "unknown" + if "curated" in n and "etherfi" in n: + return "etherfi_curated" + if name.startswith("EtherFi:"): + return "etherfi_curated" + if name.startswith("Pier Two x Etherfi"): + return "etherfi_curated" + if "etherfi" in n: + return "etherfi_solo" + if "stakely" in n and ("lido" in n or "obol" in n): + return "lido_curated" + if "rocklogic" in n: + return "lido_curated" + if "ebunker" in n: + return "lido_curated" + if name == "?" and size == 4: + return "lido_curated" + if "lido x obol" in n: + return "lido_sdvt" + if "stakewise" in n: + return "protocol_curated" + if "swell" in n: + return "protocol_curated" + if "obol" in n and ("mainnet" in n or "eigensquad" in n): + return "obol_internal" + if name == "Stakely Obol Portal": + return "obol_internal" + if name == "?" or size <= 1: + return "unknown" return "community" diff --git a/skills/obol-monitoring/scripts/lib/grafana.py b/skills/obol-monitoring/scripts/lib/grafana.py index 1705fda..606f87f 100644 --- a/skills/obol-monitoring/scripts/lib/grafana.py +++ b/skills/obol-monitoring/scripts/lib/grafana.py @@ -207,12 +207,18 @@ def extract_logfmt(line, field): def parse_bn_client(version): """Extract BN client name from version string.""" - if "Lighthouse" in version: return "Lighthouse" - if "teku" in version.lower(): return "Teku" - if "Prysm" in version: return "Prysm" - if "Nimbus" in version: return "Nimbus" - if "Lodestar" in version: return "Lodestar" - if "Grandine" in version: return "Grandine" + if "Lighthouse" in version: + return "Lighthouse" + if "teku" in version.lower(): + return "Teku" + if "Prysm" in version: + return "Prysm" + if "Nimbus" in version: + return "Nimbus" + if "Lodestar" in version: + return "Lodestar" + if "Grandine" in version: + return "Grandine" return "Unknown" @@ -221,10 +227,16 @@ def parse_vc_client(user_agent): if not user_agent: return "Lighthouse" # Lighthouse VC doesn't send user-agent ua = user_agent.lower() - if "lodestar" in ua: return "Lodestar" - if "prysm" in ua: return "Prysm" - if "teku" in ua: return "Teku" - if "nim-presto" in ua or "nimbus" in ua: return "Nimbus" - if "vouch" in ua: return "Vouch" - if "go-http-client" in ua: return "Go-http-client" + if "lodestar" in ua: + return "Lodestar" + if "prysm" in ua: + return "Prysm" + if "teku" in ua: + return "Teku" + if "nim-presto" in ua or "nimbus" in ua: + return "Nimbus" + if "vouch" in ua: + return "Vouch" + if "go-http-client" in ua: + return "Go-http-client" return user_agent[:30]