kubectl
can be replaced with k
by using an alias
kubectl
makes calls to the kube-apiserver
behind the scenes
Get or List Resources
- List all K8s objects -
k get all
- List nodes -
k get nodes
- List pods -
k get pods
- List pods with additional info -
k get pods -o wide
- List services -
k get services
or k get svc
- List deployments -
k get deployments
- List replica sets -
k get replicasets
- List replica sets with additional information -
k get replicasets -o wide
- List deployments in another namespace -
k get deployments --namespace=<namespace>
- List pods in all the namespaces -
k get pods --all-namespaces
- List service accounts -
k get serviceaccount
- List pods with label filter -
k get pod --selector key=value
- Get pods with multiple label filters -
k get pods --selector env=prod,bu=finance,tier=frontend
- List all jobs -
k get jobs
- List all cron jobs -
k get cronjobs
- List all network policies -
k get networkpolicies
- List all ingress resources -
k get ingress