# kubectl get node NAME STATUS ROLES AGE VERSION edge-node Ready <none> 15m v1.17.0 edge-node2 Ready <none> 16m v1.17.0 ubuntu Ready master 67d v1.17.0
# kubectl get pod NAME READY STATUS RESTARTS AGE busybox-gng75 0/1 ContainerCreating 0 6s busybox-wh9g5 0/1 ContainerCreating 0 6s
# kubectl get pod NAME READY STATUS RESTARTS AGE busybox-gng75 1/1 Running 0 24s busybox-wh9g5 1/1 Running 0 24s
另外有命令:
1 2 3 4
kubectl get pod -o wide # 有pod运行的节点 kubectl get pod -o yaml # 更详细的信息 kubectl get pod -l app=busybox # 标签配套 kubectl get rc # 获取RC信息,可加 -o wide 或 -o yaml,注:rc为replicationcontrollers缩写
测试:可删除其中一个pod,会自动创建,保持2个副本。
获取RC:
1 2 3
# kubectl get rc -o wide NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR busybox 2 2 2 9m41s busybox latelee/busybox name=busybox
Command "rolling-update" is deprecated, use "rollout" instead Created busybox-1ccc8111eb780500bbe058944dc46e2e Scaling up busybox-1ccc8111eb780500bbe058944dc46e2e from 0 to 2, scaling down busybox from 2 to 0 (keep 2 pods available, don't exceed 3 pods) Scaling busybox-1ccc8111eb780500bbe058944dc46e2e up to 1