8000 GitHub - madson7/deployment-k3s: Create a k3s cluster on vagrant + libvirt + qemu/kvm
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jan 28, 2024. It is now read-only.

madson7/deployment-k3s

 
 

Repository files navigation

k3s-kvm

Create a Kubernetes cluster based on Rancher's k3s project with distinct hosts for the control plane and worker nodes on a bare metal machine running Linux and libvirt + qemu/kvm.

Getting started

Prerequisites

  • A bare metal machine with
    • at least 16GB memory (for 1 master, 2 worker nodes), 32GB recommended)
    • a CPU with at least 4 physical cores
    • with any Linux distro (this guide assumes Ubuntu 18.04)
  • Install libvirt, qemu/kvm. E.g., on Ubuntu:
    apt-get install -qy qemu-kvm libvirt-bin virtinst python3 vagrant
  • Start the libvirt daemon. Using either virsh or virt-manager, create a virtual network:
    virsh -c qemu:///system net-create libvirt/default_network.xml
  • Install the vagrant-libvirt plugin:
    vagrant plugin install vagrant-libvirt
  • Initialize and install the virtualenv:
    python -m venv venv
    pip install -r requirements.txt

Creating the VMs

./generate_inventory_local.sh

Provisioning the K3s

ansible-playbook -i hosts_vagrant.ini create-k3s-cluster.yml

Configure local kubectl

  • Install kubectl on the local machine
  • Configure it
    mkdir -p ~/.kube && vagrant ssh master01 -c 'sudo cat .kube/config' > ~/.kube/config
  • Run kubectl
    # kubectl cluster-info
    Kubernetes master is running at https://192.168.122.127:6443
    CoreDNS is running at https://192.168.122.127:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
    Metrics-server is running at https://192.168.122.127:6443/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
    
    To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
    
    # kubectl get nodes
    NAME       STATUS   ROLES    AGE    VERSION
    master     Ready    master   149m   v1.19.3+k3s2
    worker-3   Ready    <none>   139m   v1.19.3+k3s2
    worker-2   Ready    <none>   139m   v1.19.3+k3s2
    worker-1   Ready    <none>   139m   v1.19.3+k3s2

About

Create a k3s cluster on vagrant + libvirt + qemu/kvm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 50.4%
  • Jinja 49.6%
0