We have created deployments which in turns creates pod. I need to get the Pod names created by my deployment file.
kubectl get -f deployment.yml
The above command list the deployment names. If i type kubectl get pod
it displays the pod names which is having some random extra strings added with deployment names.
Even if i use the -o json
option still unable to get the pod names.
How to get all the pods created by deployment? Even a shell script way would be fine.
Usually, we label deployment's pods.
template:
metadata:
labels:
app: my-app
So, we can get all pod filter by label
kubectl get pod -l app=my-app