查看pods
kubectl get pods --all-namespaces

查看node
kubectl get node

强制删除pod
kubectl delete pod kubernetes-dashboard-67484c44f6-ztdht -n kube-system --force --grace-period=0
删除处于Terminating状态的pod
sudo kubectl delete po NAME -n NAMESPACE --force --grace-period=0

查看k8s日志
journalctl -u kubelet -f

查看某个pod 的日志及其运行情况
kubectl describe pod coredns-7f6cbbb7b8-j8n7s -n kube-system

查看某个pod的端口运行情况
kubectl get pod,svc -o wide -n kubernetes-dashboard

查看所需k8s的镜像列表
kubeadm config images list

安装kubernetes-dashboard
kubectl create -f recommended.yaml
kubectl apply -f recommended.yaml

删除kubernetes-dashboard
kubectl delete -f recommended.yaml --grace-period=0 --force

拉去镜像修改镜像

docker pull mirrorgooglecontainers/kube-apiserver-amd64:v1.16.1
docker pull mirrorgooglecontainers/kube-controller-manager-amd64:v1.16.1
docker pull mirrorgooglecontainers/kube-scheduler-amd64:v1.16.1
docker pull mirrorgooglecontainers/kube-proxy-amd64:v1.16.1
docker pull mirrorgooglecontainers/pause:3.1
docker pull mirrorgooglecontainers/etcd-amd64:3.3.15-0
docker pull coredns/coredns:1.6.2

docker tag docker.io/mirrorgooglecontainers/kube-apiserver-amd64:v1.16.1 k8s.gcr.io/kube-apiserver:v1.16.1
docker tag docker.io/mirrorgooglecontainers/kube-controller-manager-amd64:v1.16.1 k8s.gcr.io/kube-controller-manager:v1.16.1
docker tag docker.io/mirrorgooglecontainers/kube-scheduler-amd64:v1.16.1 k8s.gcr.io/kube-scheduler:v1.16.1
docker tag docker.io/mirrorgooglecontainers/kube-proxy-amd64:v1.16.1 k8s.gcr.io/kube-proxy:v1.16.1
docker tag docker.io/mirrorgooglecontainers/pause:3.1  k8s.gcr.io/pause:3.1
docker tag docker.io/mirrorgooglecontainers/etcd-amd64:3.3.15-0  k8s.gcr.io/etcd:3.3.15-0
docker tag docker.io/coredns/coredns:1.6.2  k8s.gcr.io/coredns:1.6.2

docker rmi mirrorgooglecontainers/kube-proxy-amd64:v1.16.1
docker rmi mirrorgooglecontainers/kube-apiserver-amd64:v1.16.1
docker rmi mirrorgooglecontainers/kube-controller-manager-amd64:v1.16.1
docker rmi mirrorgooglecontainers/kube-scheduler-amd64:v1.16.1
docker rmi mirrorgooglecontainers/etcd-amd64:3.3.15-0
docker rmi mirrorgooglecontainers/pause:3.1
docker rmi coredns/coredns:1.6.2

获取token
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk ‘{print $1}’)

查看pods 详细日志
kubectl describe pods xx -n xx
kubectl describe pods kubernetes-dashboard-67484c44f6-ppgqw -n kubernetes-dashboard

关闭
swapoff -a

关闭防火墙
systemctl stop firewalld.service

master的代理情况
kubectl cluster-info

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐