Kubernates cheat sheet

Kubernetes Cheat Sheet

Kubernetes Cheat Sheet (EXAMPLE)

This is an example cheat sheet. Feel free to customize for your own needs.

Installation & Configuration

  • pip3 install -U stups - Installs zkubectl
  • stups configure stups.example.org - Might need "sudo"
  • source <(zkubectl completion bash)
  • source <(zkubectl completion zsh)

Troubleshooting

  • zkubectl get deploy - Get all application pods
  • zkubectl get pods -l application=APP_NAME
  • zkubectl describe pod POD_NAME - View status and reason
  • zkubectl logs -f POD_NAME - Tail app logs

Architecture

Resource Types

  • configmaps - cm
  • deployments - deploy
  • pods - po
  • services - svc

Basic Commands

  • zkubectl get deploy - Get all application pods
  • zkubectl get pods -l application=APP_NAME
  • zkubectl describe pod POD_NAME - See status and reason (e.g., OOM killed)
  • zkubectl top pod POD_NAME --containers

Cluster Login

  • zkubectl list - Shows all available clusters
  • zkubectl list-clusters - Writes to /kube/config
  • zkubectl login CLUSTER_ALIAS
  • zkubectl cluster-info

Logs & Debugging

  • zkubectl logs -f [-c CONTAINER_NAME] POD_NAME - Tail app logs
  • zkubectl logtail REGEX_PATTERN [-s TIME]
  • zkubectl exec -it POD_NAME [-c CONTAINER_NAME] sh
  • zkubectl port-forward POD_NAME [LOCAL_PORT:]PORT
  • zkubectl dashboard - Open Kubernetes Dashboard in browser

Service & Ingress

  • zkubectl describe svc SVC_NAME - Check if service has endpoints
  • zkubectl describe ingress INGRESS_NAME - Check ALB configuration

Resource Types

  • ConfigMaps - cm
  • Deployments - deploy
  • Endpoints - ep
  • HorizontalPodAutoscalers - hpa
  • Jobs
  • Namespaces - ns
  • Pods - po
  • ReplicaSets - rs
  • Secrets - Store DB passwords and credentials
  • Services - svc
  • StatefulSets - For databases
  • CronJobs

Zalando Specific

  • PlatformCredentialSets - Declare needed platform credentials

Comments