Objets with no imperative commands
persistent volume / persistent volume claim
Network Policy
Ingress
Job/ Cron Job is not working in KODEKLOUD but working in SG Server. 1.11 vs 1.16
Setup commandlines
source <(kubectl completion bash | sed 's/kubectl/k/g' )
Passing any of the two Kubernetes Exam
Imperative commands
Watch Command
# Watch command does not use ALIAS.
watch kubectl <command>
# W is watch
k get jobs -w
Change NS
k config set-context --current --namespace=ns-kim
Pod
#Create
k run pod-kim --generator=run-pod/v1 --image=busybox -r=3 --limits='cpu=100m,memory=256M'
#Replace
k replace --force -f pod-kim
Run command
k exec -it kim-pod -c kim-container -- /bin/sh
k run nginx --generator=run-pod/v1 --image=nginx -- sleep 3600
k run busybox --generator=run-pod/v1 --image=busybox -- sleep 3600
# Not working k run busybox --generator=run-pod/v1 --image=busybox -- /sh/bash -c ls
k run busybox --generator=run-pod/v1 --image=busybox -- /bin/sh -c 'i=0; while true; do echo "$i: $(date)"; i=$((i+1)); sleep 1; done'
# CrashLoopBackOff Error will occur if --generator=run-pod/v1 is added
# SH and Bash are for deploy object only.
kubectl run busybox [--generator=run-pod/v1 dont add] --image=busybox -- /bin/sh -c 'ls'
Config Map
k create cm cm-kim --from-literal=firstname=kim,lastname=chi
Secret
k create secret generic kim-secret --from-file=/tmp
Service
k expose deploy -n ingress-space ingress-controller --type=NodePort --tcp=<port>:<targetpot> --name=ingress-kim
Deploy
k run deploy-kim --image=busybox --expose --port=80