Skip to content

Titof974/kubevirt-manager

 
 

Repository files navigation

kubevirt-manager.io

Website: kubevirt-manager.io
Maintainers: feitnomore
Feedback/Feature Request: form

Simple Angular Frontend Web UI Interface to operate Kubevirt. This tools lets you perform basic operations around Virtual Machines, Virtual Machine Instances, Virtual Machine Pools and Disks. As the tool grew, other features got added like Load Balancing, Auto Scaling, Monitoring and Cluster API support. This tool was built initially based on requirements I had for my own environment at home and started growing as needed.
For a Quick Start, go to our website https://kubevirt-manager.io/

If you are using the tool, please help us by providing feedback here.

WARNING: Use it at your own risk.

INTRODUCTION

I've created this Frontend for KubeVirt while I was trying to learn a little bit of Angular. Basically this tool uses kubectl proxy to proxy API requests to kubeapiserver. To handle the Disk/Volume part, the tool works through CDI. As the time passed by, support for other features like HPA, Services, Prometheus and Cluster API were added.
For a Quick Start, go to our website https://kubevirt-manager.io/ as we provide a bundled.yaml file that has the basic setup.

REQUIREMENTS

These are the minimum requirements to have the system running.
Kubevirt featureGate ExpandDisks is required.

CDI is required with featureGate HonorWaitForFirstConsumer active:

  config:
    featureGates:
    - HonorWaitForFirstConsumer

StorageClass feature allowVolumeExpansion is required:

allowVolumeExpansion: true

If you are using hostpath-provisioner or any other local node storage, you will need to use WaitForFirstConsumer:

volumeBindingMode: WaitForFirstConsumer

Note: These settings are required to work with a hostpath csi driver, in order to prevent virtual machine instances from being started in a node different from the node in which the disk/volume resides.

HOW TO INSTALL IT

Create the Namespace

$ kubectl apply -f kubernetes/ns.yaml

Create the Service Account and RBAC

$ kubectl apply -f kubernetes/rbac.yaml

Create the FrontEnd Deployment

$ kubectl apply -f kubernetes/deployment.yaml

Create the Priority Classes

$ kubectl apply -f kubernetes/pc.yaml

Create the FrontEnd Service

kubectl apply -f kubernetes/service.yaml

PROMETHEUS INTEGRATION

To integrate kubevirt-manager with prometheus, you need to edit kubernetes/prometheus-config.yaml and adjust your endpoint on line 21. After adjusting the endpoint, apply the configmap:

$ kubectl apply -f kubernetes/prometheus-config.yaml

This integration was tested using prometheus-operator. A ServiceMonitor descriptor to integrate KubeVirt with prometheus-operator has been provided as an example at kubernetes/servicemonitor.yaml. Note that you need to set the namespace on the ServiceMonitor accordingly and you need to update your KubeVirt resource to reflect the namespace as well:

spec:
  monitorNamespace: monitoring

You will need to restart (delete) the Pod or redeploy the solution for the changes to take effect.

Note: The tool assumes Prometheus is exposing the following metrics: kubevirt_vmi_storage_write_traffic_bytes_total, kubevirt_vmi_storage_read_traffic_bytes_total, kubevirt_vmi_network_transmit_bytes_total, kubevirt_vmi_network_receive_bytes_total, kube_pod_container_resource_requests and kubevirt_vmi_memory_domain_total_bytes. These metrics are exposed by KubeVirt and kube-state-metrics.
Note: Due to the introduction of NGINX Authentication support, the configmap changed a bit, make sure you review it.

CLUSTER-API INTEGRATION

To use kubevirt-manager with cluster-api-provider for KubeVirt you must install Cluster API.
Check Cluster API Introduction for more information.
Feature ClusterResourceSet is required by the tool to automate CNI and Add-ons fuctionality on Standard clusters. Either enable it before installing Cluster API by following the documentation on ClusterResourceSet and export EXP_CLUSTER_RESOURCE_SET=true before running clusterctl generate, or enable it by adding ClusterResourceSet=true to the feature-gates argument line of your already running capi-controller-manager Deployment. Don't forget to wait for capi-controller-manager pods to restart or restart it manually if needed. The following can be done with a command like the below:

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

Note: Pre-baked images are provided from kubevirt-manager.online domain.
Note: Pre-baked images were created using image-builder project.
Note: Pre-baked images have qemu-guest-agent pre installed to provide instance details on dashboard.
Note: CNI files are also provided from kubevirt-manager.online domain.
Note: CNI files were mostly generated from original Helm Charts using helm template.
Note: CNI files have some value substituion before applying to the cluster in order to support user customization.
Note: The supported CNIs can be found here.
Note: Features are also provided as YAML files from kubevirt-manager.online domain.
Note: Features files were mostly generated from original Helm Charts using helm template.
Note: The supported features can be found here.

NGINX AUTHENTICATION

To add nginx with basic-auth, you need to edit kubernetes/auth_secret.yaml and add your htpasswd file contents in base64 to the secret. The provided example has a single entry which username is admin and password is admin. You are encouraged to create your own file and replace in the secret.
An example of how to get the base64 of your file is:

$ cat htpasswd-file | base64 -w0

After adjusting secret contents, apply the configmap and the secret:

$ kubectl apply -f kubernetes/auth-config.yaml
$ kubectl apply -f kubernetes/auth-secret.yaml

You will need to restart (delete) the Pod or redeploy the solution for the changes to take effect.

Note: If you had previous versions of Prometheus integration make sure proxy_set_header Authorization ""; is present on your Prometheus ConfigMap. You may use kubernetes/prometheus-config.yaml as a reference to make sure your ConfigMap looks ok.
Note: You may also want to check htpasswd documentation for extra help on creating and managing the file.

HOW TO USE IT

The recommended way to use this tool is through an Ingress or a Service.
You can also use kubectl port-forward on port 8080.

Note: As the tool needs Websocket support, if you are using an Ingress make sure you set it up accordingly.

Screenshots

To optimize the load of the main repo README, screenshots were removed from here. To see the screenshots, visit images directory.

Building

To build the tool simply run:

docker build -t your-repo/kubevirt-manager:version .
docker push your-repo/kubevirt-manager:version

Building & Running Locally

Please clone noVNC:

cd src/assets/
git clone https://github.com/novnc/noVNC.git

To build the tool run:

npm install
ng build

To run the tool:

kubectl proxy --www=./dist/kubevirtmgr-webui/ --accept-hosts=^.*$ --address=[::] --api-prefix=/k8s/ --www-prefix=

Access the tool at: http://localhost:8001/

Note: Make sure your kubectl is pointing to the right cluster.
Note: Make sure the account your kubectl is using has correct RBAC.
Note: This method doesn't like websocket VNC.
Note: This method doesn't support Prometheus integration.
Note: This method doesn't support NGINX basic_auth.

Testing

The tests implemented are pretty simple so far. To run the tests, simply execure:

npm test

References

  1. kubevirt-manager.io
  2. Kubernetes
  3. Kubectl
  4. CDI
  5. KubeVirt
  6. NodeJS
  7. Angular
  8. AdminLTE
  9. NoVNC
  10. Prometheus Operator
  11. kube-state-metrics
  12. KubeVirt Monitoring
  13. NGINX basic_auth
  14. Kubernetes Cluster API Provider for Kubevirt
  15. Cluster API Quick Start
  16. ClusterResourceSet
  17. image-builder
  18. capk-versions.json
  19. cni-versions.json
  20. features.json

License

kubevirt-manager.io is licensed under the Apache Licence, Version 2.0.

About

Kubevirt Web UI / Web Interface Manager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 85.3%
  • TypeScript 6.4%
  • CSS 5.9%
  • HTML 2.4%