-1

So, if we use

kubectl get pods -n namespace. 

we can easily view all pods in a particular namespaces.

my question is how can i view pods in a particular namespace which is associated with a particular service.

Dharmendra jha
  • 101
  • 2
  • 11

1 Answers1

1

You can use a selector corresponding to the selector that you have declared in your Service

E.g.

kubectl get pods --selector=app=cassandra

corresponds to this example Service

apiVersion: v1
kind: Service
metadata:
  name: cassandra-service
spec:
  selector:
    app: cassandra

# more lines
Jonas
  • 121,568
  • 97
  • 310
  • 388