Kubernetes初心者です。随時追加・整理していきます。
Referrence
display list of contexts
kubectl config get-contextsset the default context to my-cluster-name
kubectl config use-context my-cluster-nameCheck pods in particular namespace.
kubectl get pods -n <namespace名>Check all pods.
kubectl get pods -AList all pods in the current namespace, with more details
kubectl get pods -o wideCreate pod with yaml file.
kubectl apply -f xxx.yamlCreate pod with kubectl run.
kubectl run nginx --image=nginxCreate base yaml file.
kubectl create deploy mysql --image=mysql:5.7 --dry-run=client -o yaml > file名.yamlCreate and delete namespace with only command.
kubectl create namespace <namespace名>
kubectl delete ns <namespace名>Keep watching the number of pods ※prerequisite: watch command must be preinstalled
watch kubectl get podStream pod Logs
kubectl logs -f <pod名>Interactive shell access to a running pod
kubectl exec -it <pod名> -- /bin/sh