k8s 相关的命令

查看node信息

kubectl describe node k8s-node-1

查看dashboard token

kubectl describe pod  kubernetes-dashboard-admin-token-hz9bm -n kube-system

查看pod相信信息

kubectl get pods -o wide -n kube-system

查看pods namepaces

kubectl get pods --all-namespaces

查看容器信息

kubectl -n monitoring describe pods/isddc-elk-elasticsearch-0

查看容器日志

kubectl -n monitoring logs isddc-elk-elasticsearch-0

查看部署到哪个节点中

kubectl get pods  -o wide

更新images 

kubectl set image deployment/test '*=10.121.8.113/test/test:v2

重置k8s环境

#set ip_forward 1
echo 1 > /proc/sys/net/ipv4/ip_forward

#set iptables
iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X

#reset k8s
kubeadm reset --force

#init k8s env
kubeadm init --kubernetes-version=v1.13.2 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address= 10.121.125.61 -v6

#mkdir .kube  dir
mkdir -p /root/.kube
 
#cp config file to .kube
cp -i /etc/kubernetes/admin.conf /root/.kube/config

#set config file group owner
 chown root.root /root/.kube/config
 
#running  flannel.yml
 kubectl apply -f /root/flannel.yml

 

posted @ 2019-12-09 18:10  扛把子修BUG  阅读(399)  评论(0编辑  收藏  举报