DEV Community

Sid
Sid

Posted on • Edited on

2

Kubernetes - All things kubectl

First things first - how do we pronounce "kubectl" :) Based on what I heard right now, it's now (and officially) called as "Kube Control"

List Nodes

# Usual Output
kubectl get nodes

# Wide variant (provided more fields w.r.t. node like internal & external IP, OS Image, Kernel version and container runtime etc.
kubectl get nodes -o wide

# Machine friendly output
kubectl get nodes -o yaml
kubectl get nodes -o json

# Awesome node monitoring and all other node info, also lists all pods across all namespaces running on that node
kubectl describe node/<node-name-from-nodes-command>

kubectl describe basically works with all resources in format as follows

kubectl describe "<resource-kind>/<resource-name>"

Get Services

Get's all deployed services that someone can "talk" to

kubectl get svc

Namespaces

# Get all namespaces
kubectl get ns

Most commands can take -n or -A (for all namespaces) as a modifier to run command on

Get Pods

# Gets all pods across all namespaces
kubectl get pods -A

# Gets all pods in a specific namespace
kubectl get pods -n "<namespace-name>"

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay