DEV Community


Posted on • Updated on

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


# 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)