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.
my deployment file looks below
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
ansible: test-2020-05-26-00-04-1590476651
podRef: pod-ansibles
name: rd-2020-05-26-00-04-1590476651
spec:
replicas: 2
selector:
matchLabels:
app: nginx
strategy:
type: Recreate
template:
metadata:
labels:
app: nginx
...
....
so is there any way that i can get all pods which has deployment label 'test-2020-05-26-00-04-1590476651' ?
when i tried 'kubectl get pod -l ansible=test-2020-05-26-00-04-1590476651' . it shows
'No resources found in default namespace.' seems it can only display deploy name 'kubectl get deploy -l ansible=test-2020-05-26-00-04-1590476651'
But i need all pod names which is under a deployment..
所有评论(0)