GithubHelp home page GithubHelp logo

iglak / k3s-ansible Goto Github PK

View Code? Open in Web Editor NEW

This project forked from techno-tim/k3s-ansible

0.0 0.0 0.0 130 KB

A fully automated HA k3s etcd install with kube-vip, MetalLB, and more

License: Apache License 2.0

Jinja 98.56% Shell 1.44%

k3s-ansible's Introduction

Build a Kubernetes HA-cluster using k3s & kube-vip & metal-lb via Ansible

Based on https://github.com/k3s-io/k3s-ansible

Forked from https://github.com/212850a/k3s-ansible

Kube-vip Control Plane is described -> https://kube-vip.io/control-plane/

Video here https://www.youtube.com/watch?v=CbkEWcUZ7zM

More docs here https://docs.technotim.live/posts/k3s-etcd-ansible/

K3s Ansible Playbook

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

  • Debian
  • Ubuntu
  • CentOS

on processor architecture:

  • x64
  • arm64
  • armhf

System requirements

Deployment environment must have Ansible 2.4.0+ Master and nodes must have passwordless SSH access

Usage

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. https://rancher.com/docs/k3s/latest/en/installation/ha-embedded/ 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

Note: add --ask-pass --ask-become-pass if you are using password logins over ssh

Kubeconfig

To get access to your Kubernetes cluster just

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

kube-vip

See https://kube-vip.chipzoller.dev/

MetalLB

see https://metallb.universe.tf/installation/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.