使用kubectl describe pod命令来获取特定Pod的详细信息,包括IP地址、容器信息等: sh kubectl describe pod <pod_name> 在输出信息中找到“IP:”这一行,后面跟着的就是该Pod的IP地址。 通过JSONPath表达式提取IP地址: 如果你想要提取所有Pod的IP地址,可以使用JSONPath表达式来过滤输出: sh kubectl get pods...
selector=app=cassandra rc -o \ jsonpath='{.items[*].metadata.labels.version}' # 获取所有节点的 ExternalIP$ kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}' # 列出属于某个 PC 的Pod 的名字# “jq”命令用于转换复杂的 jsonpath,参考 https:/...
# 获取名字为web-pod-13je7的pod的信息,并以json格式输出 kubectl get -o json pod web-pod-13je7 # 根据pod文件查找pod,并以json格式输出 kubectl get -f pod.yaml-o json # 获取pod容器的状态 kubectl get -o template pod/kube-dns-795f5f6f9c-ldxxs --template {{.status.phase}} # 同时获取...
查询Pod IP:kubectl get pod <pod-name> -o jsonpath='{.status.podIP}' 容器内执行命令:kubectl exec -ti <pod-name> sh 容器日志:kubectl logs [-f] <pod-name> 导出服务:kubectl expose deploy <name> --port=80 Base64 解码: kubectl get secret SECRET -o go-template='{{ .data.KEY | base...
kubectl get pod,svc -o wide kubectl get pod <pod-name> -o yaml 1. 2. 3. 显示Node 的详细信息 kubectl describe node 192.168.0.212 #可以跟Node 或者IP或者主机名 1. 显示Pod 的详细信息, 特别是查看 pod 无法创建的时候的日志 kubectl describe pod <pod-name> ...
kubectlgetpod-lapp=web#查看标签为app=web的Pod kubectlgetpod-oname#获取Pod的名字 kubectlgetrc,service#查看RC和Service列表 kubectlgetendpoints#查看Endpoint列表 kubectlgetpod-nkube-system-w#动态查看pod kubectlgetcs#查看Master组件状态 kubectl api-resources#列出K8s所有资源 ...
{"name":"IP","type":"string","format":"","description":"IP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.","priority":1},{"name":"Node","type":"string","format":"","description":"NodeName is a request to schedule this pod ...
该标志只接受 IP 地址和localhost关键字。后者被解释为包含127.0.0.1and ,当省略::1时匹配命令的默认值。–address 概括 端口转发是访问 Kubernetes 集群内的私有应用程序的有用技术。Kubectl 将流量从本地网络传输到特定 Pod 上的特定端口。它是一种相对底层的机制,可以处理任何 TCP 连接。尚不支持UDP 端口转发。
这里会从Node Status的address 中选一个地址做url的host,一般是InternalIP,显然是一个内网IP,当这个IP 从云端可达的时候,我们去执行kubectl logs或者kubectlexec的时候会用这个IP 和 kubeletEndpoint(默认是10250) 拼接出目的kubelet server 的地址。 但是当Pod 运行在Edge Node 上时,这个IP是不可达的,那么kubeedge ...
进入kubectl文件存放的目录,运行kubectl.exe get node可以查看集群的节点。 在同一个目录下,创建dashboard.yaml文件,其内容是前文中的dashboard.yaml,例如可以用记事本创建: 然后输入kubectl.exe create -f dashboard.yaml创建dashboard 通过kubectl.exe get pod --all-namespaces命令可以查看是否创建成功 输入kubectl...