_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

kubectl — Tips and Tricks for Productive Kubernetes Work

12. 04. 2017 1 min read CORE SYSTEMSai
kubectl — Tips and Tricks for Productive Kubernetes Work

kubectl is your window into the Kubernetes cluster. Everyone knows the basic commands, but there are tricks that dramatically boost productivity. Here are our favorites.

Aliases — Because kubectl get pods Is Too Long

alias k=kubectl
alias kgp='kubectl get pods'
alias kgs='kubectl get services'
alias kgd='kubectl get deployments'
alias kl='kubectl logs'
alias ke='kubectl exec -it'
alias kd='kubectl describe'
alias kaf='kubectl apply -f'

Contexts and Namespaces

kubectx and kubens are must-have tools. Quick switching between clusters and namespaces. You’ll avoid accidentally deploying to production when you meant staging.

JSONPath and Custom Columns

# Just pod names and their nodes
kubectl get pods -o custom-columns=NAME:.metadata.name,NODE:.spec.nodeName

# Pods with restarts > 0
kubectl get pods -o json | jq '.items[] | select(.status.containerStatuses[].restartCount > 0) | .metadata.name'

Debug Commands

  • kubectl top pods — resource usage
  • kubectl get events --sort-by=.lastTimestamp — what’s happening
  • kubectl port-forward svc/myservice 8080:80 — direct access
  • kubectl run debug --image=busybox -it --rm -- sh — debug pod
  • kubectl auth can-i create deployments — RBAC check

kubectl Plugins (krew)

krew is a package manager for kubectl plugins. Recommended: kubectl-tree (resource hierarchy), kubectl-neat (clean YAML output), kubectl-sniff (packet capture from a pod).

Investing in kubectl Productivity Pays Off

10 minutes setting up aliases and plugins will save you hours per week. kubectl is powerful — learn to use it to its full potential.

kubectlkubernetescliproductivity
Share:

CORE SYSTEMS

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.

Need help with implementation?

Our experts can help with design, implementation, and operations. From architecture to production.

Contact us