K8s 日常操作
1、获取所有Pods
kubectl get pods --namespace=default
2、获取所有Deployments
kubectl get deployments --namespace=default
3、获取所有Services
kubectl get services --namespace=default
4、查看POD日志
kubectl describe pod <pod-name> --namespace=defualt
5、让master也运行pod(默认master不运行pod)
kubectl taint nodes --all node-role.kubernetes.io/master-
6、动态扩容deployment
kubectl scale deployment nginx-deployment --replicas 10
7、更新image
kubectl set image deployment/nginx-deployment nginx=nginx:1.9.1
8、获取ETCD、Scheduler、Controller-Manager组件状态
[root@node01 ~]# kubectl get componentstatus NAME STATUS MESSAGE ERROR scheduler Healthy ok controller-manager Healthy ok etcd-0 Healthy {"health": "true"} etcd-1 Healthy {"health": "true"} etcd-2 Healthy {"health": "true"}
9、查看网络link详细属性
ip -d link show
10、进入POD内部
kubectl exec -it redis-master-6b556f4c5f-7rddd /bin/sh