# use ansible to work with pods and volumes in kubernetes

**URL:** <https://forum.ansible.com/t/use-ansible-to-work-with-pods-and-volumes-in-kubernetes/27803>\
**Category:** Ansible Project\
**Tags:** kubernetes\
**Created:** [June 15, 2018, 4:05am UTC](https://forum.ansible.com/t/use-ansible-to-work-with-pods-and-volumes-in-kubernetes/27803 "2018-06-15T04:05:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Steffen](https://avatars.discourse-cdn.com/v4/letter/d/94ad74/32.png) [@Dan\_Steffen](https://forum.ansible.com/u/Dan_Steffen)\
**Post date:** [June 15, 2018, 4:05am UTC](https://forum.ansible.com/t/use-ansible-to-work-with-pods-and-volumes-in-kubernetes/27803/1 "2018-06-15T04:05:53Z")

</div>

Hello,

some days ago I start to run my first kubernetes cluster with heketi (and glusterfs) on some VMs. Now the cluster is running and I would like to deploy some pods and a new volume to this cluster, but I didn’t find any useful example how I can use ansible to deploy (a pod, service, deployment, pvc) to the cluster and specially if there is a way to access a volume I create by ansible.  
Maybe I am just blind or too stupid to use google right, but can someone give me some example how I can automate the usage of kubernetes with ansible?  
best regards  
Dan

---

<div class="post-metadata">

**Author:** ![Kevin\_Faulkner](https://avatars.discourse-cdn.com/v4/letter/k/ecb155/32.png) [@Kevin\_Faulkner](https://forum.ansible.com/u/Kevin_Faulkner)\
**Post date:** [June 15, 2018, 5:08pm UTC](https://forum.ansible.com/t/use-ansible-to-work-with-pods-and-volumes-in-kubernetes/27803/2 "2018-06-15T17:08:38Z")

</div>

Hi Dan, lets dispel something real quick, you aren’t stupid, I hope it  
was just self deprecating humor 🙂 But I just wanted to reaffirm that  
you are clearly working with complex systems and seem to doing well  
with them.

Unfortunately I can’t provide an example I think it depends on what you  
are trying to do, but Ansible does have a kubernetes and helm modules  
additionally kubernetes inventory modules. Try to manage the resources  
using the inline\_data parameter, you can make most of those as  
variables and you should be all set. Unless I’m not understanding what  
you are seeking to do. As for Heketi, you could utilize the uri module  
since Heketi has a REST API.

You might also want to take a look at Ansible Playbook Bundles, I  
recently saw a presentation at SouthEast LinuxFest and it looks  
promising, but might require some more reading.

I hope this helps,  
-Kevin
