Enabling VM Runtime
- Preparations
- Download kubectl and kubeconfig.
- Download the client kubectl and user configuration file kubeconfig from the cluster console and copy them to the /home directory on the client.
- Log in to your client and configure kubectl.
cd /home chmod +x kubectl mv -f kubectl /usr/local/bin mkdir -p $HOME/.kube mv -f kubeconfig.json $HOME/.kube/config kubectl config use-context internal
- View the Kubernetes cluster information.
kubectl cluster-info
- Obtain the latest KubeVirt version.
export VERSION=v1.5.0
- Download kubectl and kubeconfig.
- Add aggregation layer certificate forwarding on the API server of the cluster.
Access the /var/paas/kubernetes/manifests directory on a master node in the cluster and add the following parameters to the kube-apiserver.manifest file to modify the API server configuration:
--proxy-client-key-file=/srv/kubernetes/aggregation-tls.key --proxy-client-cert-file=/srv/kubernetes/aggregation-tls.crt
- Install kubevirt-operator.
Run the following command in the /home directory on the client:
kubectl create -f "https://github.com/kubevirt/kubevirt/releases/download/${VERSION}/kubevirt-operator.yaml"
If the installation is successful, the following information is displayed:namespace/kubevirt created customresourcedefinition.apiextensions.k8s.io/kubevirts.kubevirt.io created priorityclass.scheduling.k8s.io/kubevirt-cluster-critical created clusterrole.rbac.authorization.k8s.io/kubevirt.io:operator created serviceaccount/kubevirt-operator created role.rbac.authorization.k8s.io/kubevirt-operator created rolebinding.rbac.authorization.k8s.io/kubevirt-operator-rolebinding created clusterrole.rbac.authorization.k8s.io/kubevirt-operator created clusterrolebinding.rbac.authorization.k8s.io/kubevirt-operator created deployment.apps/virt-operator created
- Install the KubeVirt CR.
- Download and modify the CR file of KubeVirt.
- Download the CR file of KubeVirt.
curl -L https://github.com/kubevirt/kubevirt/releases/download/${VERSION}/kubevirt-cr.yaml -o kubevirt-cr-cce.yaml
- Add the following content to the kubevirt-cr-cce.yaml file:
apiVersion: kubevirt.io/v1 kind: KubeVirt metadata: name: kubevirt namespace: kubevirt spec: certificateRotateStrategy: {} configuration: developerConfiguration: {} customizeComponents: patches: - resourceType: DaemonSet resourceName: virt-handler patch: '{"spec": {"template": {"spec": { "volumes": [ {"name": "kubelet-pods", "hostPath": {"path": "/mnt/paas/kubernetes/kubelet/pods"}}, {"name": "kubelet-pods-shortened", "hostPath": {"path": "/mnt/paas/kubernetes/kubelet/pods"}}, {"name": "device-plugin", "hostPath": {"path": "/mnt/paas/kubernetes/kubelet/device-plugins"}} ], "containers": [{ "name": "virt-handler", "volumeMounts": [ {"name": "kubelet-pods", "mountPath": "/mnt/paas/kubernetes/kubelet/pods", "mountPropagation": "Bidirectional"}, {"name": "device-plugin", "mountPath": "/mnt/paas/kubernetes/kubelet/device-plugins"} ] }] }}}}' type: strategic flags: handler: kubelet-pods-dir: /mnt/paas/kubernetes/kubelet/pods kubelet-root: /mnt/paas/kubernetes/kubelet
- Save the modification and run the following command:
kubectl create -f ./kubevirt-cr-cce.yaml
If the command is executed successfully, the following information is displayed:kubevirt.kubevirt.io/kubevirt created kubevirt.kubevirt.io/kubevirt created
- Download the CR file of KubeVirt.
- Wait for the installation is successful.
watch -n 1 kubectl get kubevirt.kubevirt.io/kubevirt -n kubevirt -o=jsonpath="{.status.phase}"
If the status changes from Deploying to Deployed, the installation is successful.
- Download and modify the CR file of KubeVirt.
- Confirm the support for hardware virtualization.
- Install libvirt-client.
sudo apt-get install libvirt-client
- Check whether the server supports virtualization.
virt-host-validate qemu
- If the following information is displayed, the server does not support hardware virtualization:
QEMU: Checking for hardware virtualization: FAIL (Only emulated CPUs are available, performance will be significantly limited)
- If FAIL is displayed, you can enable the KubeVirt software simulation. Note that the performance will deteriorate significantly.
kubectl -n kubevirt patch kubevirt kubevirt --type=merge --patch '{"spec":{"configuration":{"developerConfiguration":{"useEmulation":true}}}}'
- If the following information is displayed, the server does not support hardware virtualization:
- Install libvirt-client.
- Install virtctl.
Install the KubeVirt command line tool virtctl.
VERSION=$(kubectl get kubevirt.kubevirt.io/kubevirt -n kubevirt -o=jsonpath="{.status.observedKubeVirtVersion}") ARCH=$(uname -s | tr A-Z a-z)-$(uname -m | sed 's/x86_64/amd64/') || windows-amd64.exe echo ${VERSION}-${ARCH} curl -L -o virtctl https://github.com/kubevirt/kubevirt/releases/download/${VERSION}/virtctl-${VERSION}-${ARCH} chmod +x virtctl sudo install virtctl /usr/local/bin
You can take the preceding steps to enable VM Runtime in on-premises clusters. If you encounter any problems during the installation, see the official documents of KubeVirt or contact Huawei Cloud technical support.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot