Kubernetes & Helm Cheat Sheet
kubectl Basics
Section titled “kubectl Basics”kubectl get nodes # List all nodeskubectl get nodes -o wide # List nodes with detailed infokubectl get pods # List all podskubectl get pods -w # Watch pod statuskubectl get deploy # List deploymentskubectl get service # List serviceskubectl get ing # List ingresseskubectl describe pod <POD> # Show detailed info for a podkubectl describe ing <ING> # Show detailed info for ingresskubectl delete pod <POD> # Delete a podkubectl edit deploy <DEPLOY> # Edit deployment configurationkubectl edit service <SVC> # Edit service configurationkubectl get pvc # List persistent volume claimskubectl get all -n <NAMESPACE> # Get all resources in a namespacePort Forwarding
Section titled “Port Forwarding”export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=<APP>,app.kubernetes.io/instance=<INSTANCE>" -o jsonpath="{.items[0].metadata.name}")export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT# Access app at http://127.0.0.1:8080Helm Basics
Section titled “Helm Basics”helm --version # Check Helm versionhelm help # Helm CLI helphelm search repo <CHART> # Search installed repos for a charthelm search hub <CHART> # Search Helm Hubhelm repo add <NAME> <URL> # Add a Helm repositoryhelm repo update # Update repo indexeshelm install <RELEASE> <CHART> [options] # Install a charthelm upgrade <RELEASE> <CHART> --values <FILE> # Upgrade chart with custom valueshelm uninstall <RELEASE> <CHART> [options] # Uninstall a chart (Not recommended.)helm show values <CHART> > values.yml # Export default chart values for editingNote: Try fixing any issues via ‘helm upgrade’ instead of uninstalling and installing again, since this might recreate things you want to keep the same.
Helm Example Usage
Section titled “Helm Example Usage”# Add reposhelm repo add community-charts https://community-charts.github.io/helm-chartshelm repo add traefik https://traefik.github.io/chartshelm repo add secustor https://secustor.dev/helm-chartshelm repo update
# Install applicationshelm install n8n community-charts/n8nhelm install traefik traefik/traefikhelm install imchlc secustor/immich -n immich --create-namespace
# Upgrade applications with custom valueshelm show values community-charts/n8n > n8n-values.ymlhelm upgrade n8n community-charts/n8n --values n8n-values.ymlhelm upgrade immich secustor/immich -n immich --values immich-values.yml
# Uninstallhelm uninstall n8n community-charts/n8nDebugging & Logs
Section titled “Debugging & Logs”kubectl logs <POD> [-c <CONTAINER>] [--previous] # View logskubectl get pods -w # Watch pod statuskubectl describe pod <POD> # Debug pod eventsnslookup <HOSTNAME> # DNS resolution checkNetworking
Section titled “Networking”ip route # Show routing tableroute list # Alternative routing info- Use namespaces for multi-app environments.
- Port-forwarding is useful for local testing before exposing ingress.
- Always check logs and describe pods when troubleshooting.
- Helm
values.ymlallows for customization of deployments.