List pods that are servicing a service

久未见 提交于 2020-11-29 10:21:32

问题


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

There are 3 pods associated with my service.

I tried to execute the below command

oc describe svc my-svc-1

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.


回答1:


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>


来源:https://stackoverflow.com/questions/57635036/list-pods-that-are-servicing-a-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!