kubeadm init --image-repository registry.aliyuncs.com/google_containers --apiserver-advertise-address=192.168.106.130 --service-cidr=192.168.200.0/21 --pod-network-cidr=10.10.0.0/16 --ignore-preflight-errors=all --v=5 kubeadm join 192.168.106.130:6443 --token g3iu6f.v54vkceghrtktuxb --discovery-token-ca-cert-hash sha256:53f12ff7a46e0ec8dcfe4f53f7f49b6b84302eb4d138c57dea1c7a913ebd2166 --ignore-preflight-errors=all --v=5 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml kubectl proxy --address='0.0.0.0' --accept-hosts='^*$' --port=8009 # 给主节点加标签 kubectl label node k8s-master type=master # 删除之前创建的资源 kubectl delete all --all -n kubernetes-dashboard kubectl apply -f recommended.yaml http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ kubectl get pods --all-namespaces -o wide kubectl cluster-info kubectl get svc,pods -n kubernetes-dashboard kubectl get nodes kubectl get pods -n kube-system kubectl get namespaces kubectl get ns kubectl get pod --all-namespaces kubectl get pod -A kubectl create namespace dream21th-one kubectl create ns dream21th-two kubectl delete namespace dream21th-one docker pull tomcat:9.0.20-jre8-alpine kubectl run tomcat9-test --image=tomcat:9.0.20-jre8-alpine --port=8080 扩容成3个 kubectl scale --replicas=3 deployment/tomcat9-test kubectl get pod -o wide kubectl get deployment kubectl get deployment -o wide kubectl get svc kubectl cluster-info kubectl get cs kubectl get nodes kubectl get rc,services kubectl describe nodes k8s-master kubectl describe pods tomcat9-test-569b5bf455-9bvzs # 使用 pod.yaml 文件中指定的类型和名称删除 pod。 kubectl delete -f pod.yaml # 删除标签名= <label-name> 的所有 pod 和服务。 kubectl delete pods,services -l name=<label-name> # 删除所有具有标签名称= <label-name> 的 pod 和服务,包括未初始化的那些。 kubectl delete pods,services -l name=<label-name> --include-uninitialized # 删除所有 pod,包括未初始化的 pod。 kubectl delete pods --all kubectl exec <pod-name> date # 从 pod 返回日志快照。 kubectl logs <pod-name> # 从 pod <pod-name> 开始流式传输日志。这类似于 'tail -f' Linux 命令。 kubectl logs -f <pod-name> kubectl describe pods -n kube-system coredns-6d8c4cb4d-78kn2 kubeadm token create --print-join-command kubectl get pods --all-namespaces -o wide kubectl get services --all-namespaces http://192.168.106.130:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login kubectl -n kubernetes-dashboard edit service kubernetes-dashboard kubectl -n kubernetes-dashboard get secret $(kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath="{.secrets[0].name}") -o go-template="{{.data.token | base64decode}}"