This is an Ansible playbook that deploys a Kubernetes cluster using kubeadm.
You will need update the kitchen-hosts
and set IP Addresses or FQDN's accordingly. You can define a kubernetes master (k8smaster) or a kubernete node (k8snodes)
Also you will need to install the ruby dependencies from Gemfile by running:
bundle install
Thanks to Test kitchen framework you will easily get running a Kubernetes cluster.
In order to get running Kubernetes master and get nodes joined into the master you will need a token in this playbook you can generate a token by your own by running generate_token.sh shell script:
$ ./generate_token.sh
This playbook is using Test Kitchen framework for automation testing, you can run either:
kitchen test
or
kitchen create
kitchen converge
kitchen verify
If you take a look into .kitchen.yml
you will find that Kitchen will run 2 centos7.2 servers: a kubernete master and a kubernete node1 demo.
You can also run this playbook directly on the servers by using ansible command line commands.
There is a ansible.cfg
file already pointing to kitchen-hosts
as Inventory, all you need to run is:
ansible-playbook master.yml
ansible-playbook node.yml
- Run Docker under docker group for security purposes