列出为服务提供服务的 Pod [英] List pods that are servicing a service

查看:22
本文介绍了列出为服务提供服务的 Pod的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取为特定服务提供服务的 pod 列表

I am trying to get the list of pods that are servicing a particular service

有 3 个 Pod 与我的服务相关联.

There are 3 pods associated with my service.

我尝试执行以下命令

oc 描述 svc my-svc-1

我期待看到与此服务关联的 Pod.但这并没有出现.什么命令只为我提供与服务关联的 pod 列表.

I am expecting to see the pods associated with this service. but that does not show up. What command gets me just the list of pods associated with the service.

推荐答案

服务使用选择器选择 Pod.查看服务的选择器,并使用该选择器获取 pod.对于 kubectl,命令如下所示:

A service chooses the pods using the selector. Look at the selector for the service, and get the pods using that selector. For kubectl, the command looks like:

kubectl get pods --selector <selector>

这篇关于列出为服务提供服务的 Pod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆