Install Kubernetes cluster on vermin using ansible

Actually, I don’t think this is working, as I got some error:

fatal: [node1]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘kubernetes_join_command’ is ….

In a previous post, we see how to install Kubernetes using shell scripts using vermin.

Today, we will see how to use Ansible to install Kubernetes on 3 nodes.

Three machines

First, we will need 3 machines, 1 master and 2 workers:

Note, the master node needs at least 2 cpus

Let’s list the machines:

Install Ansible Roles:

Now let’s create ansible.cfg :

Now let’s install docker and Kubernetes Ansible roles:

Build Ansible inventory

Next, let’s configure the inventory file, but before let’s get IP addresses for the VMs:

Now let’s write the inventory file (inventory):

Now let’s ping the 3 servers:

The Playbook

And finally, let’s create the playbook (k8s.playbook.yaml):

Now let’s run the playbook:

Now, the playbook starts running:

Software Developer/Architect

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store