You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 查看集群状态
kubectl get cs
# 查看集群节点信息
kubectl get nodes
# 查看集群命名空间
kubectl get ns
# 查看指定命名空间的服务
kubectl get svc -n kube-system
# 查看Pod详细信息
kubectl get pod <pod-name> -o wide
# 以yaml格式查看Pod信息
kubectl get pod <pod-name> -o yaml
# 查看资源对象,查看所有Pod列表
kubectl get pods
# 查看资源对象,查看rc和service列表
kubectl get rc, service
# 查看pod,svc,ep能及标签信息
kubectl get pod,svc,ep --show-labels
# 查看所有的命名空间
kubectl get all --all-namespaces
查看集群信息
kubectl cluster-info
// 输出
Kubernetes master is running at https://172.xxx.xxx.145:6443
KubeDNS is running at https://172.xxx.xxx.145:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
在集群中运行一个指定镜像
kubectl run nginx --image=nginx --replicas=2 --port=80
// 输出
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
deployment.apps/nginx created