Managing Kubernetes with Ansible
We will assume that you have access to either a Kubernetes or OpenShift cluster for testing. Setting these up is out of the scope of this book, so you might want to look at a distribution such as Minikube or Minishift, both of which are designed to be quick and easy to set up so that you can start learning these technologies rapidly. We also need to have the kubectl
client or the oc
client, depending on whether we have deployed Kubernetes or OpenShift, properly configured.
Installing Ansible Kubernetes dependencies
First of all, you need to ensure you are running a fairly updated version of Python 3 (>=3.6) and install the required Python packages (you can install it either via PIP or your OS packaging system):
- Kubernetes >= 12.0.0
- PyYAML >= 3.11
jsonpatch
Since the kubernetes.core
collection is not generally shipped with Ansible, you’ll need to install it by running this:
$ ansible-galaxy collection install...