Kubernetes 基本命令
kubectl get nodes # 查看当前master连接的可用nodes数
kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 #基于远程的image 创建本地app
kubectl get deployments #查看本地部署的deployment
kubectl get rs #查看deployments的副本数 ReplicaSet
kubectl scale deployments/kubernetes-bootcamp --replicas=4 #scale 扩展或者减少副本数
kubectl apply -f example-redis-config.yaml kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml # 基于本地或者远程yaml文件创建pod
kubectl delete pod redis #删除pod
kubectl cluster-info 查看cluster的信息
kubectl config file cat ~/.kube/config #kubectl 通过读取配置文件信息与 kubernetes 集群交互,默认配置文件路径是 ~/.kube/config
kubectl cordon <node name> #设置node不承载用户容器
kubectl label pod nginx-646b46d648-hbwg2 app=v1 -n tutorial #修改或者添加pod/svc的label
kubectl get pods nginx-646b46d648-7c457 -n tutorial -o yaml #查看已部署pod的yaml文件