# 查看命名空间 # 或者 kubectl get namespace $ kubectl get ns NAME STATUS AGE default Active 6d1h kube-node-lease Active 6d1h kube-public Active 6d1h kube-system Active 6d1h testapp Active 90s
# 一般在查看所有 all 的时候,默认查看的是 default 的命名空间 $ kubectl get all -n default NAME READY STATUS RESTARTS AGE pod/mongodb-client 1/1 Running 0 35m pod/my-mongo-mongodb-0 1/1 Running 0 52m pod/my-mongo-mongodb-1 1/1 Running 0 52m pod/my-mongo-mongodb-arbiter-0 1/1 Running 0 52m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 6d1h service/my-mongo-mongodb-arbiter-headless ClusterIP None <none> 27017/TCP 52m service/my-mongo-mongodb-headless ClusterIP None <none> 27017/TCP 52m
NAME READY AGE statefulset.apps/my-mongo-mongodb 2/2 52m statefulset.apps/my-mongo-mongodb-arbiter 1/1 52m