# check kubernetes inner ip kubectl get svc kubernetes -n default # check api server kubectl get componentstatuses # check crd kubectl get crd | grep cert-manager # check all pods kubectl get pods -A
namespace
1 2 3 4
kubectl get namespaces
# delete all resource by specify namespace kubectl delete all --all -n <namespace>
node
label
1 2 3 4 5 6 7 8 9
# show all labels kubectl get nodes --show-labels # add label on node kubectl label node <node-name> <label-key>=<label-value> # remove label from node kubectl label node <node-name> <label-key>- # kubectl label nodes sd-shangdi-ceph17 dingofs-csi-node-
taint
1 2 3 4 5 6 7 8
# check node is taint or not kubectl describe node <nodeName> | grep -i taint # taint node print Taints: nodepool=fault:NoSchedule # normal node print Taints: <none>
All
1 2
# delete all resource kubectl delete all --all -n <namespace>
pod
basic
1 2 3 4 5
# list namespace's pod kubectl get pod -n {namespace} # describe kubectl describe pod {podName}
log
-c : Specify which container to retrieve logs from.
-f: Stream the logs in real-time.
–previous: Show logs from the last terminated container.
–since=: Return logs for the last period (e.g., 1h, 30m).
–tail=: Limit the number of log lines returned.
–all-containers=true: Get logs from all containers in the pod.
kubectl get pod <容器id> --kubeconfig=/path/to/configfile -o yaml > env-vq48.yaml # kubectl get -o yaml 这样的参数,会将指定的 Pod API 对象以 YAML 的方式展示出来。 # expose kubectl get pod <pod-name> -n <namespace> -o yaml > pod-config.yaml