49 lines
1.3 KiB
Markdown
49 lines
1.3 KiB
Markdown
# Kubernetes cluster setup using Ansible for Debian
|
|
|
|
## Description
|
|
|
|
The project configures a Kubernetes cluster on Debian machines with kubeadm.\
|
|
It uses systemd-networkd for interface configuraition, CRI-O for containerization, Calico as a CNI plugin, and stacked etcd for control-plane database.
|
|
|
|
## Configuration
|
|
|
|
- General node config: [*roles/node/defaults/main.yml*](roles/node/defaults/main.yml)
|
|
- Cluster config:
|
|
- [*roles/init-cluster/defaults/main.yml*](roles/init-cluster/defaults/main.yml)
|
|
- [*group_vars/main.yml*](group_vars/main.yml)
|
|
|
|
## Usage
|
|
|
|
### 1. Configure ssh on all nodes
|
|
|
|
1. ssh in and enable root login by editing */etc/ssh/sshd_conf*
|
|
2. `ssh-copy-key root@NODE`
|
|
3. `ssh-agent $SHELL`
|
|
4. `ssh-add`
|
|
|
|
### 2. Add nodes to inventory
|
|
|
|
Edit the *inventory* file.
|
|
|
|
### 3. Prepare nodes
|
|
|
|
`ansible-playbook -i inventory -u root node.yml`
|
|
|
|
### 4. Initalize cluster
|
|
|
|
Uses the `[first_master]` group from the *inventory* to select the first master.
|
|
|
|
`ansible-playbook -i inventory -u root init-cluster.yml`
|
|
|
|
### 5. Join other masters
|
|
|
|
Uses the `[other_masters]` group from the *inventory*.
|
|
|
|
`ansible-playbook -i inventory -u root join-control-plane.yml`
|
|
|
|
### 6. Join workers
|
|
|
|
Uses the `[workers]` group from the *inventory*.
|
|
|
|
`ansible-playbook -i inventory -u root join-workers.yml`
|