# k8s\_facts just does not work

**URL:** <https://forum.ansible.com/t/k8s-facts-just-does-not-work/34984>\
**Category:** Ansible Project\
**Tags:** kubernetes\
**Created:** [April 14, 2021, 8:09pm UTC](https://forum.ansible.com/t/k8s-facts-just-does-not-work/34984 "2021-04-14T20:09:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nic\_H](https://avatars.discourse-cdn.com/v4/letter/n/d9b06d/32.png) [@Nic\_H](https://forum.ansible.com/u/Nic_H)\
**Post date:** [April 14, 2021, 8:09pm UTC](https://forum.ansible.com/t/k8s-facts-just-does-not-work/34984/1 "2021-04-14T20:09:59Z")

</div>

well another thing I try and just does not work as per the doc  
the example from the official doc does not even work :

ansibe 2.8 / python3.6 , openshift / kubernetes pip modules 0.11 (0.12 is broken too).

**- name: Search for all running pods**  
**k8s\_facts:**  
**kind: Pod**  
**field\_selectors:**  
**- status.phase = running**

returns:  
**Failure","message":"field label not supported: status.phase ","reason":"BadRequest","code":400}**

Why is that trying to get labels when we are talking fields ?

I am ultimately trying to get infos on Deployments , but same thing field\_selectors does not work at all .

anyone been using this module and the **field\_selectors** parameters successfully ?  
thanks

---

<div class="post-metadata">

**Author:** ![Nic\_H](https://avatars.discourse-cdn.com/v4/letter/n/d9b06d/32.png) [@Nic\_H](https://forum.ansible.com/u/Nic_H)\
**Post date:** [April 14, 2021, 10:01pm UTC](https://forum.ansible.com/t/k8s-facts-just-does-not-work/34984/2 "2021-04-14T22:01:13Z")

</div>

well it seems to be limited by k8s api itself , not sure field\_selectors is very useful then .  
json\_query is needed to filter out results from the whole output from facts .  
Maybe for now , it s better to use kubectl in the shell module

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [April 15, 2021, 5:46am UTC](https://forum.ansible.com/t/k8s-facts-just-does-not-work/34984/3 "2021-04-15T05:46:58Z")

</div>

Hi,

The example is correct. There is no space around `=` in the field selector and there is ‘R’ is running in your code.

- k8s\_info:  
kind: pod  
field\_selectors:
- status.phase=Running  
register: r
