christianlempa-boilerplates/ansible/installation/inst-k8s/README.md

47 lines
1.6 KiB
Markdown
Raw Normal View History

2023-09-06 11:47:48 +02:00
# Kubernetes (K8s) Installation Script
- Introduction
- Prerequisites
- Execution Instructions
## Introduction
2023-09-12 11:06:06 +02:00
2023-09-06 11:47:48 +02:00
> 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
2023-09-12 11:08:06 +02:00
**Documentation** - [https://kubernetes.io/docs/setup/](https://kubernetes.io/docs/setup/)
2023-09-06 11:47:48 +02:00
## Prerequisites
2023-09-12 11:06:06 +02:00
- 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
2023-09-06 11:47:48 +02:00
```ini
[controllers]
host_name ansible_ssh_host=<IP> ansible_user='<USERNAME>' ansible_become_pass='<PASSWORD>'
[nodes]
[instance:children]
controllers
nodes
```
2023-09-12 11:06:06 +02:00
2023-09-06 11:47:48 +02:00
(If you want to change this, don't forget to change the `inst-k8s` as well)
## Execution Instructions
```bash
ansible-playbook -i <INVENTORY> <PLAYBOOK>
```
2023-09-12 11:06:06 +02:00
2023-09-06 11:47:48 +02:00
### Optional Flags
2023-09-12 11:06:06 +02:00
2023-09-06 11:47:48 +02:00
| 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|