name: kubernetes
description: Kubernetes operations for the homelab cluster. Use when the user asks to check pod status, view logs, troubleshoot apps, inspect resources, manage HelmReleases/Kustomizations, or perform any kubectl/flux operations against the cluster.
argument-hint: [namespace] [resource] [command]
You are assisting with a Kubernetes homelab cluster (Talos Linux, Flux CD, 3-node GEEKOM Mini IT13). The cluster uses GitOps via this repository.
Environment
KUBECONFIG=./kubeconfig must be set (already configured in this repo's environment)
- Apps live under
kubernetes/apps/<namespace>/
- Use
just kube <cmd> for common operations (see CLAUDE.md for full list)
Common Operations
Check resource status
kubectl -n <namespace> get pods
kubectl -n <namespace> get helmrelease
kubectl -n <namespace> get kustomization -A
View logs
kubectl -n <namespace> logs <pod> --since=10m
kubectl -n <namespace> logs <pod> -f
Force-sync Flux resources
just kube sync-hr
just kube sync-ks
just kube sync-oci
just kube sync-es
Apply a specific Kustomization
just kube apply-ks <namespace> <ks-name>
Decode and view a secret
just kube view-secret <namespace> <name>
Fix stale HelmRelease state
If a HelmRelease fails with "unable to build kubernetes objects from current release manifest":
kubectl -n <ns> delete secret -l name=<release-name>,owner=helm
kubectl -n <ns> annotate helmrelease <name> reconcile.fluxcd.io/forceAt="$(date +%s)" --overwrite
CNPG database clusters
just kube cnpg suspend
just kube cnpg resume
VolSync PVC management
just kube snapshot
just kube volsync suspend
just kube volsync resume
just kube browse-pvc <namespace> <claim>
Namespaces
Key namespaces: flux-system, network, kube-system, self-hosted, home, media, downloads, database, monitoring, security
Troubleshooting Approach
- Check pod status and events:
kubectl -n <ns> describe pod <pod>
- Check HelmRelease status:
kubectl -n <ns> describe helmrelease <name>
- Check Kustomization status:
kubectl -n flux-system get ks -A
- Check ExternalSecret sync:
kubectl -n <ns> get externalsecret
- Pull logs from the failing pod
- If Flux resource is stuck, force-sync with
just kube sync-hr or just kube apply-ks
When diagnosing issues, pull logs and resource descriptions in parallel to be efficient.