freehck.k8s_join

freehck.k8s_join

=========

Join nodes to Kubernetes cluster

Description

This role is used to add nodes to a Kubernetes cluster. The master host must have k8s_join_is_master set to true.

Role Variables

  • k8s_join_command_filename: File name for storing the authentication token/command, defaults to k8s-join-command.
  • k8s_join_is_master: A boolean flag that should only be true for one host in the cluster, specifically the master; defaults to false.

Example

Inventory

k8s-node-0 ansible_host=10.118.19.10 k8s_is_master=true
k8s-node-1 ansible_host=10.118.19.11
k8s-node-2 ansible_host=10.118.19.12

[k8s_cluster]
k8s-node-0
k8s-node-1
k8s-node-2

Playbook.yml

- hosts: k8s_cluster
  become: true
  vars:
    # common parameters
    k8s_ver: "1.16.2-00"
    k8s_node_ip: "{{ ansible_host }}"
    # k8s_base is an implicit dependency
    k8s_base_node_ip: "{{ k8s_node_ip }}"
    k8s_base_ver: "{{ k8s_ver }}"
    # k8s_init is an implicit dependency
    k8s_init_cidr: "192.168.0.0/16"
    k8s_init_node_ip: "{{ ansible_host }}"
    k8s_init_node_name: "{{ inventory_hostname }}"
    # this role configuration
    k8s_join_is_master: "{{ k8s_is_master | default('false') }}"
  roles:
    - role: freehck.k8s_base
    - role: freehck.k8s_init
      when: k8s_join_is_master
    - role: freehck.k8s_join

Notes

This role is meant to be used on both the master and worker nodes. On the master node, it generates an authentication token and saves it to a file on the Ansible controller. Remember not to commit this file, as it eventually expires! On the worker nodes, the token is used for them to join the cluster.

Install

You can install this role from Ansible Galaxy:

ansible-galaxy install freehck.k8s_join

License

MIT

Author Information

Dmitrii Kashin, freehck@freehck.ru

Informazioni sul progetto

join nodes to kubernetes cluster

Installa
ansible-galaxy install freehck.k8s_join
Licenza
Unknown
Download
235
Proprietario