Cluster: single k3s node, TransIP VPS 136.144.174.219 (ssh sarkoutmahmoud@, key ~/.ssh/id_ed25519), staging only, memory-tight (~4 GB), storage local-path only.
Durable fix tracked in project-template#2 (pin the k3s node name so this can't recur). Until that ships, this runbook is the recovery.
After the VPS reboots, the k3s node re-registers under a different name. Every local-path PV was provisioned with a nodeAffinity pinned to the old node name, so all PVs are now stranded on a node that no longer exists. Result: every PVC-backed pod (all Postgres, all Redis, anything with a volume) is unschedulable — 0/1 nodes are available: … node(s) had volume node affinity conflict. Backends that depend on those datastores CrashLoop or stay Pending.
kubectl get nodes -o name
kubectl get pv -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.nodeAffinity.required.nodeSelectorTerms[0].matchExpressions[0].values[0]}{"\n"}{end}'
kubectl get pods -A | grep -E 'Pending|CrashLoop'
kubectl describe pod -n <ns> <pod> | grep -i 'volume node affinity'
nodeAffinityon a bound PV is immutable, so you cannot edit the name in place — the PVC/PV must be recreated.
Staging data is throwaway, so we recreate the stranded volumes. The node is memory-tight, so bring stacks up one at a time, never all at once.
*-staging workload to 0 so nothing fights for the node or the PVs during recovery:for ns in $(kubectl get ns -o name | grep -- '-staging' | cut -d/ -f2); do
kubectl scale deploy,statefulset -n "$ns" --all --replicas=0
done
local-path reprovisions fresh ones pinned to the live node. Do this only with data you're willing to lose (staging).kubectl delete pvc -n <ns> --all # datastore re-inits empty on next start
Running + a fresh PVC bound to the live node.Running:kubectl exec -n <ns> <pg-pod> -- bash -c \
'PGPASSWORD="$(cat $POSTGRES_POSTGRES_PASSWORD_FILE)" psql -U postgres -d <db> -c "ALTER ROLE \"<flyway_user>\" WITH CREATEROLE;"'
${appPassword}. Wait for 1/1 and /actuator/health = UP.kubectl top node ; kubectl describe node | grep -A6 'Allocated resources'
NEED-CAPACITY rather than evicting another project.Pin the k3s node name so a reboot can't re-register it under a new name and strand the PVs. Tracked in project-template#2. Until merged, re-run this runbook after any VPS reboot.
kubectl get nodes — note the live name.delete pvc.*-staging to 0 first.
Reacties