[root@k8smaster ~]# kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATESnginx-f89759699-nvjv6 1/1 Running 2 23d 10.244.1.4 k8snode1 <none> <none> 1. 影响调度的属性 总图 对node1节点 起标签名 kubectl label node node1 env_role dev 1. [root...
kubectl describe pod my-pod | grep "Node:" | awk '{print $2}' 这个命令会输出 Pod 所在的 Node 名称(假设输出格式是标准的,并且 "Node:" 后面紧跟着的是 Node 名称)。 综上所述,通过 kubectl get pods -o wide 命令可以快速查看 Pod 及其 Node 的概览信息,而通过 kubectl describe pod 命令则可...
kubectl get pods/podname -n namespace -o json 查看所有daemonset kubectl get daemonset --all-namespaces kubectl describe ds calico-node -n kube-system //查看daemonset的日志 kubectl get rc,services List one or more resources by their type and names. kubectl get rc/web service/frontend pods/web...
2、TYPE:指定资源类型(如:pod、node、services、deployments等)。资源类型大小写敏感,可以指定单数、复数或缩写形式。例如,以下命令生成相同的输出: 1 kubectl get pod -n kubernetes-dashboard 2 kubectl get pods -n kubernetes-dashboard 3 kubectl get po -n kubernetes-dashboard 3、NAME:指定资源的名称。名称...
kubectl get node --selector='!http://node-role.kubernetes.io/control-plane' # 获取当前命名空间中正在运行的 Pods kubectl get pods --field-selector=status.phase=Running # 获取全部节点的 ExternalIP 地址 kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")]....
kubectl get daemonset --all-namespaces kubectl describe ds calico-node -n kube-system //查看daemonset的日志 kubectl get rc,services List one or more resources by their type and names. kubectl get rc/web service/frontend pods/web-pod-13je7 ...
kubectl get pods --selector=app=cassandra rc -o jsonpath='{.items[*].metadata.labels.version}' # 获取所有具有 app=cassandra 的 pod 中的 version 标签 describe describe命令同样用于查看资源信息,但相比与get只输出资源本身的信息,describe聚合了相关资源的信息并输出。比如,在describe node信息时,同时会输...
1. 获取特定节点上运行的 Pod 列表:kubectl get pods --field-selector spec.nodeName=-n 资源配额和限制: 1. 列出命名空间中的资源配额:kubectl get resourcequotas -n 2. 查看一个资源配额详情:kubectl describe resourcequota-n 自定义资源定义 (CRD) 诊断: ...
$ kubectl get ns NAME STATUS AGE charts Active 8d default Active 9d kube-node-lease Active 9d kube-public Active 9d kube-system Active 9d 每个get 命令都可以使用 –namespace 或 -n 参数指定对应的命名空间。这点对于查看 kube-system 中的 Pods 会非常有用,因为这些 Pods 是 Kubernetes 自身运行...
#查询包含指定label的node节点 kubectl get nodes --show-labels -l "unhealthy=true" #查询不包含指定label的pod资源 kubectl get pod -l '!unhealthy' #给名为foo的Pod添加label unhealthy=true。 kubectl label pods foo unhealthy=true #给名为foo的Pod修改label 为 'status' / value 'unhealthy',且覆盖现...