kubectl create -f "https://github.com/kubevirt/kubevirt/releases/download/v1.5.0/kubevirt-operator.yaml"
kubectl create -f "https://github.com/kubevirt/kubevirt/releases/download/v1.5.0/kubevirt-cr.yaml"
kubectl create -f "https://github.com/kubevirt/containerized-data-importer/releases/download/v1.61.2/cdi-operator.yaml"
kubectl create -f "https://github.com/kubevirt/containerized-data-importer/releases/download/v1.61.2/cdi-cr.yaml"
curl -L -o virtctl https://github.com/kubevirt/kubevirt/releases/download/v1.5.0/virtctl-v1.5.0-linux-amd64
chmod +x virtctl
cp virtctl ~/.local/bin/
cd normal_vm
kubectl apply -f vm-normal.yaml
kubectl get vm, vmi
kubectl get pods
virtctl console ubuntu-focal
(use ubuntu:ubuntu)
Create service:
kubectl apply -f svc-vm-ssh.yaml
Get node IP and port:
kubectl get nodes -o wide
kubectl get svc
kubectl get ep
SSH using the IP and port:
ssh ubuntu@172.18.0.2 -p 31028
From VM:
df -h
free -h
From VM definition:
kubectl get vmi ubuntu-focal -o jsonpath='{.status.memory}'
In vm:
sudo apt update
sudo apt install nginx -y
There is not enough space to install anything in the VM.
df -h
Use virtctl to stop the VM:
virtctl stop ubuntu-focal
kubectl delete -f vm-normal.yaml
kubectl delete -f svc-vm-ssh.yaml
cd use_cdi
kubectl apply -f dv-ubuntu-containerdisk.yaml
kubectl get dv
kubectl get pv,pvc
kubectl get pods
kubectl logs importer-dv-ubuntu-focal -f
kubectl apply -f vm-ubuntu-dv.yaml
kubectl get pods
kubectl get vm, vmi
Create service:
kubectl apply -f svc-vm-ssh.yaml
Get node IP and port:
kubectl get nodes -o wide
kubectl get svc
kubectl get ep
SSH using the IP and port:
ssh ubuntu@172.18.0.2 -p 31028
From VM:
df -h
free -h
Install nginx in VM:
sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl status nginx
curl -I http://localhost:80
Access that nginx externally from client machine:
kubectl get vmi
virtctl port-forward ubuntu-focal 8080:80
curl -I http://localhost:8080
- Configure kubevirt: https://kubevirt.io/quickstart_kind/
- Configure CDI: https://kubevirt.io/labs/kubernetes/lab2.html
- Ubuntu container disk images: https://hub.docker.com/r/tedezed/ubuntu-container-disk/tags