kubernetes_slave
Kubernetes Minnion (Slave)
This role installs a Kubernetes Minnion node (you can install multiple nodes... it's supported, that's the point :) ) using the new kubeadm
utility that Kubernetes provides.
This role expects the cluster token to be passed in as a variable. you may either pass in the variable k8s_cluster_token
via a playbook entry or else consume the fact generated by our sister role: https://galaxy.ansible.com/digital-realms/kubernetes-master/ (bit of self advertising never hurt I guess :) )
Requirements
The master node has the following Requirements:
Running CentOS 7 (or any other equivalent from the RHEL family should be just as fine)
A bare minimum of 1GB RAM, ideally a minimum of 1.5GB (or whatever your containers will consume)
Full network connectivity with any other box in the cluster (both minnions and the master).
NOTE: Last but not least, please do remember to run this role with become: yes
to grant privileged access during the installation process.
Role Variables
Role Variables
The minnions have the following variables which are available to be consumed:
k8s_cluster_token:
(Required) - this variable is used to know what token to present when joining the cluster.k8s_master_node:
(Required) - this is the Master node which controls the cluster, provide it, please, so it will know who it should talk to.k8s_join_xtrargs:
(Optional) - this is useful if you wish to pass further parameters when joining the cluster (you picky person...)
--skip-preflight-checks
- this is used if you're a rebel, never flew a plane and decided you want to wing it... telling it to commit into the cluster without any sanity checks. you rebel.
Dependencies
This role really just depends on knowing what the token is and who the master is. you can either hardcode these values in your playbook (either var files etc.) or else you can use some level of intelligence to keep matters dynamic. Below we'll cover some case scenarios.
Example Playbook
A line of code speaks a thousand words.
Sample basic profile, invoking the role and using become: yes
for elevated privileges. this is assuming that your cluster token (k8s_cluster_token:
) and your master node (k8s_master_node:
) are declared in your playbook structure.
- hosts: k8s-minnions
roles:
- { role: digital-realms.kubernetes-minnion, become: yes }
Should you wish to be a little bit more adventurous and would like to pass in further parameters, something of the sort would work:
- hosts: k8s-minnions
roles:
- { role: digital-realms.kubernetes-master, become: yes, k8s_cluster_token: '<6 character string>.<16 character string>', k8s_master_node: 'master1.example.local' }
If you're a geek (like us) and love dynamic stuff (hi, we're friends :) ), and you're awesome enough to be using our Master role too https://galaxy.ansible.com/digital-realms/kubernetes-master/, then give this a shot:
- hosts: k8s-minnions
roles:
- { role: digital-realms.kubernetes-master, become: yes, k8s_cluster_token: "{{ hostvars[groups['k8s_master'][0]]['k8s_cluster_token']}}", k8s_master_node: "{{ groups['k8s_master'][0] }}" }
The above will look for the exported cluster token which is exported from our sister role, and also, finding who the master node is by querying the inventory for a node address. Enjoy! :)
License
MIT
Author Information
This role has been written by Digital Realms. feel free to contact info@digital-realms.net or visit http://www.digital-realms.net. The authors who contributed to this role are (in no particular order):
- Steve Azzopardi
- Edward Midolo
- Marco Lenzo
An Ansible role to install and configure the Kubernetes Minnion (Slave) node(s) using kubeadm
ansible-galaxy install digital-realms/ansible_role_kubernetes_slave