christianlempa-boilerplates/ansible/installation/inst-k8s
Christoph Schug 8a17193dd0 fix: add final newline character to text files
This makes text files compliant to POSIX which requires every line of a
text file to end with a newline character [1][2].

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_403
[2] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
2024-02-22 19:06:54 +01:00
..
ansible.cfg fix: add final newline character to text files 2024-02-22 19:06:54 +01:00
inst-k8s.yaml Install K8s 2023-09-06 15:17:48 +05:30
k8s_worker_node_connection.j2 fix: add final newline character to text files 2024-02-22 19:06:54 +01:00
README.md link update 2023-09-12 11:08:06 +02:00

Kubernetes (K8s) Installation Script

  • Introduction
  • Prerequisites
  • Execution Instructions

Introduction

The objective of this playbook is to automate the installation and setup of a kubernetes instance. The playbook consist of 3 main plays. For both controller and nodes, for controller only and for nodes only. It will ask user confirmation before moving on to each stage. By the end of the playbook two files will be created on the controller node named worker_conn_string and locally inside the playbook directory with the name Remote_Files/worker_conn_string. This will have the connection string. (Note:- If you want to join controllers or nodes manually later. For controllers use --control-plane flag)

References

Documentation - https://kubernetes.io/docs/setup/

Prerequisites

  • Atleast 2 VMs (1 For Control Node and 1 For Worker Node).
  • Static IPs should be set along with unique host names.
  • Inventory should be in this format
    [controllers]
    host_name ansible_ssh_host=<IP> ansible_user='<USERNAME>' ansible_become_pass='<PASSWORD>'

    [nodes]

    [instance:children]
    controllers
    nodes

(If you want to change this, don't forget to change the inst-k8s as well)

Execution Instructions

ansible-playbook -i <INVENTORY> <PLAYBOOK>

Optional Flags

Flag Use Case
--ask-vault-pass If the vault is encrypted
--start-at-task If you want to start from a specific task
--tags If you want to only run a specific group of tasks