Skip to content

Instantly share code, notes, and snippets.

@goffinet
Last active December 10, 2024 19:23
Show Gist options
  • Save goffinet/accc183783a7cf0a6ec62135d047dea2 to your computer and use it in GitHub Desktop.
Save goffinet/accc183783a7cf0a6ec62135d047dea2 to your computer and use it in GitHub Desktop.
Kubitect how to

KVM/Libvirt Host: Ubuntu 22.04.5 LTS (Jammy Jellyfish)

Create a sudo user

username=labuser
groupadd ${username}
useradd -s /bin/bash -d /home/${username} -m -g ${username} ${username}
echo "${username} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${username}

Install requirements

apt install qemu-kvm libvirt-clients libvirt-daemon libvirt-daemon-system mkisofs virtualenv python3 git
usermod -aG kvm ${username}
sed -i 's/#security_driver.*/security_driver = "none"/g' /etc/libvirt/qemu.conf
systemctl restart libvirtd

Install Kubitect

https://kubitect.io/latest/getting-started/installation/

Connect into a sudo user session and follow the quick start

Just before check if you have minimal resources for this quick start : 4 cpu 12G ram (https://kubitect.io/latest/getting-started/getting-started/#step-33-cluster-nodes)

Quick Start Step 1: https://kubitect.io/latest/getting-started/quick-start/#step-1-create-a-kubernetes-cluster

As sudo user

sudo kubitect export preset --name getting-started > cluster.yaml
sudo kubitect apply --config cluster.yaml

Get Kubectl

curl -LO "https://dl.k8s.io/release/$(grep version cluster.yaml | awk '{print $2}')/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
sudo kubitect export kubeconfig --cluster k8s-cluster > > ~/.kube/config

Quick Start Step 2: https://kubitect.io/latest/getting-started/quick-start/#step-2-test-the-cluster

kubectl --context k8s-cluster get nodes

Destroy the lab

sudo kubitect destroy --cluster k8s-lab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment