Ansible playbook to list kubernetes pods with ip

9/19/2019

I am trying to write get Kubernetes pods with IP using ansible script/playbook. I followed the instruction from Ansible documentation where they have shown following example

name: Get a list of all pods from any namespace
  k8s_facts:
    kind: Pod
  register: pod_list

But this is returning list without ip and node name.

Using kubectl it is possible to get ip and name detail by running following command :

kubectl get pods --output=wide --namespace=mynamespace

If I have to implement this what should I modify? Meanwhile, I tried passing "output" parameter but the result didn't change (no ip and name listed in the result)

-- NRA
ansible
kubernetes

0 Answers