kubernetes command summary Set
-
Turn off virtual memory
swapoff -a vim /etc/fstabl #/dev/mapper/centos-swap swap
-
View docker environment variables
systemctl show --property=Environment docker
-
Set agent cancel agent
export http_proxy="http://127.0.0.1:8123/" unset http_proxy
-
View token
kubeadm token list
-
Get token command in SA
kubectl -n kube-system get secret admin-token-nwphb -o jsonpath={.data.token}|base64 -d kubectl -n kube-system describe secret `kubectl -n kube-system get secret|grep admin-token|cut -d " " -f1`|grep "token:"|tr -s " "|cut -d " " -f2
-
Generate token
head -c 16 /dev/urandom | od -An -t x | tr -d ' '
-
Regenerate the token added to the node
kubeadm token create --print-join-command
-
View the reason for node noready
journalctl -f -u kubelet
-
View software version
yum search --showduplicates xxx
-
Install a specific version of software
apt-get install -y kubelet=1.11.3-00 kubeadm=1.11.3-00 kubectl=1.11.3-00 yum install -y kubelet-1.11.3 kubeadm-1.11.3 kubectl-1.11.3
-
kubernetes cluster initialization
kubeadm reset
-
View the required images for a specific version of kubernetes
kubeadm --kubernetes-version=1.11.0 config images list
-
Force deletion of pod that always belongs to terminating
kubectl delete pod $POD_ID --force --grace-period=0
-
Deploy pod, deployment, daemonset, etc
Kubectl create -f xxx kubectl apply -f xx
-
Deploy pod, deployment, daemonset, etc
kubectl set image deployment/nginx-deployment nginx=nginx:1.91 --record kubectl apply -f xx(Must pass xx Create)
-
Tail the node
kubectl taint nodes <node_name> <key>=<value>:NoSchedule
-
Restore nodes from taint
kubectl taint nodes <node_name> <key>=<value>:NoSchedule-
-
Isolate and expel the node s
kubectl cordon <node> kubectl drain <node>
-
Restore a node from an isolated state
kubectl uncordon <node>
-
Add node label
kubectl label pod redis role=backend
-
Delete node label
kubectl label pod redis role-
Summary record, continue to add!