Giter VIP home page Giter VIP logo

deployment-k3s's Introduction

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

deployment-k3s's People

Contributors

demirole avatar madson7 avatar

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.