Go to file
2022-03-27 12:37:54 -05:00
.github Readme updates (#4) 2022-03-27 11:18:45 -05:00
collections initial commit 2022-03-27 10:05:37 -05:00
example initial commit 2022-03-27 10:05:37 -05:00
inventory fix(vars): Removed args 2022-03-27 12:20:56 -05:00
roles initial commit 2022-03-27 10:05:37 -05:00
.ansible-lint initial commit 2022-03-27 10:05:37 -05:00
.gitignore initial commit 2022-03-27 10:05:37 -05:00
.yamllint initial commit 2022-03-27 10:05:37 -05:00
ansible.cfg initial commit 2022-03-27 10:05:37 -05:00
deploy.sh Readme updates (#4) 2022-03-27 11:18:45 -05:00
LICENSE initial commit 2022-03-27 10:05:37 -05:00
README.md chore(README): Updating Readme 2022-03-27 12:37:54 -05:00
reset.sh Readme updates (#4) 2022-03-27 11:18:45 -05:00
reset.yml initial commit 2022-03-27 10:05:37 -05:00
site.yml initial commit 2022-03-27 10:05:37 -05:00

Automated build of HA k3s Cluster

Fully Automated K3S etcd High Availability Install

This playbook will build an HA Kubernetes cluster with k3s, kube-vip and MetalLB via ansible.

It is based on the work from this fork which is based on the work from k3s-io/k3s-ansible. It uses kube-vip to create a load balancer for control plane, and metal-lb for its service LoadBalancer.

If you want more context on how this works, see:

📄 Documentation (including example commands)

📺 Video

📖 k3s Ansible Playbook

Build a Kubernetes cluster using Ansible with k3s. The goal is easily install a HA Kubernetes cluster on machines running:

  • Debian
  • Ubuntu
  • CentOS

on processor architecture:

  • x64
  • arm64
  • armhf

System requirements

  • Deployment environment must have Ansible 2.4.0+
  • server and agent nodes should have passwordless SSH access, tf not you can supply arguments to provide credentials -ask-pass --ask-become-pass to ach command.

🚀 Getting Started

First create a new directory based on the sample directory within the inventory directory:

cp -R inventory/sample inventory/my-cluster

Second, edit inventory/my-cluster/hosts.ini to match the system information gathered above. For example:

[master]
192.168.30.38
192.168.30.39
192.168.30.40

[node]
192.168.30.41
192.168.30.42

[k3s_cluster:children]
master
node

If multiple hosts are in the master group, the playbook will automatically setup k3s in HA mode with etcd.

This requires at least k3s version 1.19.1

If needed, you can also edit inventory/my-cluster/group_vars/all.yml to match your environment.

Start provisioning of the cluster using the following command:

ansible-playbook site.yml -i inventory/my-cluster/hosts.ini

After deployment control plane will be accessible via virtual ip-address which is defined in inventory/group_vars/all.yml as apiserver_endpoint

Remove k3s cluster

ansible-playbook reset.yml -i inventory/my-cluster/hosts.ini

⚙️ Kube Config

To copy your kube config locally so that you can access your Kubernetes cluster run:

scp debian@master_ip:~/.kube/config ~/.kube/config