cloudymax / kubevirt-community-stack

Get started using Kubevirt with Helm3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kubevirt Community Stack

A Collection of community-developed Helm3 charts for use with Kubevirt
(Work In Progress)
cloudymax.github.io/kubevirt-community-stack


Install Charts via Helm

  • kubevirt: Installs the Kubevirt Operator.

    helm repo add kubevirt https://cloudymax.github.io/kubevirt-community-stack
    helm install kubevirt kubevirt/kubevirt \
      --namespace kubevirt \
      --create-namespace
  • Cluster API Operator: Installs the Cluster API Operator.

    helm repo add capi-operator https://kubernetes-sigs.github.io/cluster-api-operator
    helm install capi-operator capi-operator/cluster-api-operator \
      --create-namespace -n capi-operator-system \
      --set core=cluster-api:v1.7.2 \
      --set controlPlane=kubeadm:v1.7.2 \
      --set bootstrap=kubeadm:v1.7.2 \
      --set infrastructure=kubevirt:v0.1.8 \
      --wait --timeout 90s
  • kubevirt-cdi: Install the Containerized Data Importer.

    helm repo add kubevirt https://cloudymax.github.io/kubevirt-community-stack
    helm install kubevirt-cdi kubevirt/kubevirt-cdi \
      --namespace cdi \
      --create-namespace
  • cloud-init: Generate a standalone cloud-init configuration file for use with other tools.

    git clone https://github.com/cloudymax/kubevirt-community-stack.git
    cd kubevirt-charts/charts/cloud-init
    helm template . -f values.yaml > cloud-init.yaml
  • kubevirt-vm: Create virtual-machines and vm-pools with Kubevirt via helm

    # Customize your own values.yaml before deploying
    helm repo add kubevirt https://cloudymax.github.io/kubevirt-community-stack
    helm install kubevirt-cdi kubevirt/kubevirt-vm \
      --file values.yaml  \
      --create-namespace
  • kubevirt-manager: Deploy the Kubevirt-Manager UI

    # Customize your own values.yaml before deploying
    helm repo add kubevirt https://cloudymax.github.io/kubevirt-charts
    helm install kubevirt-cdi kubevirt/kubevirt-manager \
      --fnamespace kubevirt-manager \
      --create-namespace

Components

Kubevirt is made up of several pieces:

  1. Kubervirt Operator

    The operator controls virtual machine instances and provides the CRDs that define them

  2. Kubevirt CDI

    The Containerized Data Importer can pull virtual machine images, ISO files, and other types of bootable media from sources like S3, HTTP, or OCI images. This data is then written to PVCs which are mounted as disks. For examples of various ways to use the CDI, see the notes in the argocd-apps repo

  3. Kubevirt Manager

    This is a community-developed web-ui which allows users to create, manage, and interact with virtual machines running in Kubevirt. See their official docs at kubevirt-manager.io

Screenshot showing the default page of Kubevirt-manager. The screen is devided into 2 sections. On the left, there is a vertical navigation tab with a grey background. The options in this bar are Dashboard, Virtual Machines, VM Pools, Auto Scaling, Nodes, Data Volumes, Instance Types, and Load Balancers.  On the right, there is a grid of blue rectangular icons each representing one of the option in the navigation tab, but with an icon and text representing metrics about that option.

  1. Cluster API Operator + Kubevirt Provider

    Cluster API provides a standardised kubernetes-native interface for creating k8s clusters using a wide variety of providers. The Cluster API Operator can be installed via Helm and configured to bootstrap the Cluster API Kubevirt Provider which allows creating k8s clusters from the CLI or as YAML using Kubevirt VMs.

    Example:

    export CAPK_GUEST_K8S_VERSION="v1.23.10"
    export CRI_PATH="/var/run/containerd/containerd.sock"
    export NODE_VM_IMAGE_TEMPLATE="quay.io/capk/ubuntu-2004-container-disk:${CAPK_GUEST_K8S_VERSION}"
    
    clusterctl generate cluster capi-quickstart \
    --infrastructure="kubevirt:v0.1.8" \
    --flavor lb \
    --kubernetes-version ${CAPK_GUEST_K8S_VERSION} \
    --control-plane-machine-count=1 \
    --worker-machine-count=1 > capi-quickstart.yaml
    
    kubectl apply -f capi-quickstart.yaml

Utilities

  1. libvirt-clients

    This utility will audit a host machine and report what virtualisation capabilities are available

    • Installation

      sudo apt-get install -y libvirt-clients
    • Usage

      $ virt-host-validate qemu
      QEMU: Checking for hardware virtualization          : PASS
      QEMU: Checking if device /dev/kvm exists            : PASS
      QEMU: Checking if device /dev/kvm is accessible     : PASS
      QEMU: Checking if device /dev/vhost-net exists      : PASS
      QEMU: Checking if device /dev/net/tun exists        : PASS
  2. virtctl

    virtctl is the command-line utility for managing Kubevirt resources. It can be installed as a standalone CLI or as a Kubectl plugin via krew.

    • Standalone

      export VERSION=v0.41.0
      wget https://github.com/kubevirt/kubevirt/releases/download/${VERSION}/virtctl-${VERSION}-linux-amd64
    • Plugin

      kubectl krew install virt
  3. clusterctl

    The clusterctl CLI tool handles the lifecycle of a Cluster API management cluster.

    curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.7.2/clusterctl-linux-amd64 -o clusterctl
    sudo install -o root -g root -m 0755 clusterctl /usr/local/bin/clusterctl

Uninstall

In the event that Kubevirt does not uninstall gracefully, you may need to perform the following steps:

export RELEASE=v0.17.0

# --wait=true should anyway be default
kubectl delete -n kubevirt kubevirt kubevirt --wait=true

# this needs to be deleted to avoid stuck terminating namespaces
kubectl delete apiservices v1.subresources.kubevirt.io

# not blocking but would be left over
kubectl delete mutatingwebhookconfigurations virt-api-mutator

# not blocking but would be left over
kubectl delete validatingwebhookconfigurations virt-operator-validator

# not blocking but would be left over
kubectl delete validatingwebhookconfigurations virt-api-validator

kubectl delete -f https://github.com/kubevirt/kubevirt/releases/download/${RELEASE}/kubevirt-operator.yaml --wait=false

About

Get started using Kubevirt with Helm3

License:MIT License


Languages

Language:Smarty 100.0%