Skip to content

runlevel5/kubernetes-cluster-libvirt-vagrant

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Kubernetes Cluster with libvirt/kvm

Have you just picked up k8s? Well firstly you should look into minikube if you are after a simple one-node cluster for learning.

If you fail to get minikube to work on your machine, you could set up a local cluster with libvirt. DO NOT USE it for production.

This cluster consists of 1 master and 2 worker nodes that are configured with:

  • CRI: containerd
  • CNI: calico
  • SMI: none

Prerequisites

  • Linux (amd64|ppc64le|arm64)
  • qemu
  • vagrant
  • vagrant-libvirt

Get started

  1. Orchestrate cluster:
cd [alpine|ubuntu] && vagrant up
  1. Verify that you could ssh into either master or worker:
vagrant ssh kmaster
vagrant ssh kworker1
vagrant ssh kworker2
  1. Check the health of the cluster:
vagrant ssh kmaster
kubectl cluster-info
kubectl get cs # should show everything healthy
  1. Setting up connection to cluster from your host:
vagrant ssh-config >> ~/.ssh/config
scp kmaster:/home/ubuntu/.kube/config ~/.kube/
config
kubectl cluster-info

Issues

If Vagrant gets stuck at "waiting to get IP address" part, it is likely that libvirt VM fail to assign IP address. The workaround is to Ctrl-C to cancel the operation, then vagrant destroy && vagrant up again.

Credits

Codes are based on:

About

A simple way to bring up a K8S with libvirt/vagrant for learning purpose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages