For detailed instructions visit our GitHub.

 

StorageClass

 
 
 
kubevirt-manager controls and manages disks, so a StorageClass is needed in order for the solution to work. allowVolumeExpansion feature needs to be enabled on the StorageClass that you plan to use:

    allowVolumeExpansion: true
              
If you are using hostpath-provisioner or some local storage you may also need:

    volumeBindingMode: WaitForFirstConsumer
              
 

CDI

 
 
 
Containerized Data Importer is used by kubevirt-manager to control DataVolume operations for Virtual Machines and Virtual Machine Pools:

    config:
        featureGates:
        - HonorWaitForFirstConsumer
                
 

kubevirt-manager

 
 
 
To install kubevirt-manager simply apply the chart below:

    kubectl apply -f https://raw.githubusercontent.com/kubevirt-manager/kubevirt-manager/main/kubernetes/bundled.yaml
                
 

Prometheus Metrics

 
 
 
kubevirt-manager supports integration with Prometheus to display a few metrics in the main dashboard. Note that you need Prometheus running with kube-state-metrics and KubeVirt metrics available. To integrate adjust and apply the following YAML. Remember to restart your kubevirt-manager after applying it:

            apiVersion: v1
            kind: ConfigMap
            metadata:
              name: prometheus-config
              namespace: kubevirt-manager
              labels:
                app: kubevirt-manager
                kubevirt-manager.io/version: 1.4.1
                kubevirt-manager.io/managed: "true"
            data:
              prometheus.conf: |
                location /api {
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header X-Forwarded-Proto $scheme;
                    proxy_set_header Authorization "";
                    proxy_pass_request_body on;
                    proxy_pass_request_headers on;
                    client_max_body_size 5g;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection $connection_upgrade;
                    proxy_pass http://prometheus-service.prometheus-namespace.svc:9090;
                }
              
 

Nginx Authentication

 
 
 
kubevirt-manager supports usage of Ngnix Basic Authentication to protect the tool. To enable adjust and apply the following ConfigMap YAML.

            apiVersion: v1
            kind: ConfigMap
            metadata:
              name: auth-config
              namespace: kubevirt-manager
              labels:
                app: kubevirt-manager
                kubevirt-manager.io/version: 1.4.1
                kubevirt-manager.io/managed: "true"
            data:
              basicauth.conf: |
                auth_basic "Restricted Content";
                auth_basic_user_file /etc/nginx/secret.d/.htpasswd;
                

You also need to provide the htpasswd file through a secret. In the example below, the username/password combination is admin/admin. Remember to restart your kubevirt-manager after applying it:

            apiVersion: v1
            kind: Secret
            metadata:
              name: auth-secret
              namespace: kubevirt-manager
              labels:
                app: kubevirt-manager
                kubevirt-manager.io/version: 1.4.1
                kubevirt-manager.io/managed: "true"
            data:
              .htpasswd: YWRtaW46JGFwcjEkMk53ckdFZVkkZmtPZkZldVR4Rm5pZzBsc2NaV3c1MQo=
                
 

Cluster API

 
 
 
kubevirt-manager supports usage of Kubevirt Cluster API provider to provision tenant Kubernetes clusters inside your Kubevirt cluster. To enable this integration you must install Cluster API following the documentation. The documentation is available here.
ClusterResourceSet feature must be enabled in order for the integration to work, as kubevirt-manager uses this feature to automatically provision CNI and Features inside Standard clusters. To enable it you must export the following env var before running clusterctl generate:

            export EXP_CLUSTER_RESOURCE_SET=true  
              
If you already have the Controller running, you can enable it by editing your deployment and adding the following gate to the command line arguments configuration:

            ClusterResourceSet=true
              
To edit your running Controller use:

            $ kubectl edit -n capi-system deployment.apps/capi-controller-manager