Basics
Publish date: Feb 4, 2023
Last updated: Feb 5, 2023
Last updated: Feb 5, 2023
Alias kubectl to kc for easy typing
alias kc="kubectl"
List all the available namespaces
kc get namespace
Get all pods running in namespace
kc get pods -n namespace
Get all pods running in namespace
kc logs <pod> -n namespace
Get all resource running in namespace
kc logs resource/<resource_name> -n namespace
Eg: kc logs services/xyz -n namespace
Alias: List all the pods and see the logs of selected (requires fzf)
alias kcl='kubectl get pods -n <namespace> | fzf | awk '\''{print $1}'\'' | xargs kubectl logs -n <namespace>'
Alias: List all contexts and switch between them (requires fzf)
alias kx='kubectl config get-contexts | awk '\''{print $2}'\'' | fzf | xargs kubectl config use-context'