Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.
/ k8s-cheatsheet Public archive

Work with cluster and resources using kubectl

License

Notifications You must be signed in to change notification settings

lamoda/k8s-cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

k8s-cheatsheet

Work with cluster and resources using kubectl

Here i suggest different scenario with resources in cluster(cloud-managed, bare-metal and local such as minikube) Before starting work with cluster you can see on this article

Get all pods with same release

Usually metadata consists field labels and one of popular labels is release

$>kubectl get po -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.labels.release}{"\n"}{end}'

The expression selecting name of each pod and release from .metadata.labels

Get all pods with same release

$>kubectl get po -l release=<my-release>

Show all pods deployed on same node

$>kubectl get po --field-selector spec.nodeName=<node-name>

The expression selecting all pods deployed on node with name <node_name>

For determination all nodes in cluster you can run

$>kubectl get nodes

Often you can get error Error from server (Forbidden): nodes is forbidden: because user in kubeconfig doesn't have permissions on some commands

Show all pods with Failed phase

kubectl get po --field-selector status.phase=Failed --all-namespaces

About

Work with cluster and resources using kubectl

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published