Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 1.04 KB

kubectl.md

File metadata and controls

59 lines (44 loc) · 1.04 KB

Aliases

alias k=kubectl
alias kdy="kubectl --dry-run=client -o yaml"

context

k config get-contexts
k config use-context <context-name>

Get pods from all namespaces: k get po -A

kdy run pod-name --image=some-image > somefile.yaml
k apply -f somefile.yaml

sudo vim /etc/hosts

rollback: k rollout undo deployment/<deployment-name>

cpu usage (pods):
k top po

logs:
k logs <podname>

events:
k get events -n <namespace> -o wide

check service:
curl <worker-node>:<IP>

show pod labels:
k -n <namespace> get po --show-labels

networkpolicy:

k -n <namespace> get networkpolicy
k -n <namespace> describe networkpolicy <networkpolicy-name>

Abbreviations:

Abbreviation full name
svc service
sa service-account
deploy deployment
po pod
cm config-map
ns namespace
cj cronjob