- kubectl get nodes 查看nodes节点的状态
- kubectl get nodes -w 动态查看nodes节点的状态
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers: - name: nginx
image: nginx:1.14.2
ports: - containerPort: 80 生成yaml文件 vi simple-pod.yaml
kubectl apply -f simple-pod.yaml 创建pod
kubectl get pods; kubectl get pods -w 查看pod
kubectl get pods -o wide 查看pod的运行详情
kubectl describe pod nginx 查看pod详情
docker ps 查看容器运行情况
curl pod_ip 访问nginx对应的pod
kubectl delete -f simple-pod.yaml 删除pod
kubectl apply -f nginx-pv-pvc-demo.yaml 根据yaml文件创建资源:pod、pv、pvc
kubectl get pv,pvc 查看 pv pvc
kubectl get pods -o wide 动态查看所有的pods
kubectl describe pod nginx 查看pod详情 nginx
kubectl describe pv nginx-pv 查看pod详情 pv
kubectl describe pvc nginx-pvc 查看pod详情 pvc
echo "hello jack pv pvc pod." > jack.html 在master对应的nfs/data/nginx中新建jack.html
kubectl get pods -o wide docker exec -it containerid sh ls /usr/share/nginx/html cat /usr/share/nginx/html/jack.html 进入nginx容器查看/usr/share/nginx/html
kubectl get pods -o wide curl nginx_pod_ip/jack.html 查看nginx pod ip并访问资源
kubectl delete pod nginx-pod curl nginx-new-pod-ip/jack.html 删除nginx pod并查看新nginx pod的资源
kubectl get pods kube-proxy-9jgb6 -n kube-system -o yaml | grep kind 查看kube-proxy类型
kubernetes命令学习
于 2022-12-08 13:43:42 首次发布