kubernetes 에서 VM 생성하기 1
# 우분투에 microk8s를 이용하여 kubernetes 설치
--> 터미널 유지
$ sudo snap install microk8s --classic
$ microk8s enable dashboard dns helm3 ingress prometheus registry
$ sudo usermod -a -G microk8s user
$ sudo chown -f -R user ~/.kube $ newgrp microk8s
$ microk8s dashboard-proxy # 프록시 돌아가는 터미널 유지
-> config 넣어주기
# kubevirt 및 cdi 설치
-> 리소스들이 Running 상태에 오른것 확인
-> 리소스들이 Running 상태에 오른것 확인
$ sudo apt install libvirt-clients
$ microk8s kubectl create -f https://github.com/kubevirt/kubevirt/releases/download/v0.45.0/kubevirt-operator.yaml
$ microk8s kubectl create -f https://github.com/kubevirt/kubevirt/releases/download/v0.45.0/kubevirt-cr.yaml
$ watch microk8s kubectl get all -n kubevirt # 리소스들이 Running 상태에 오른것을 확인
$ microk8s kubectl create -f https://github.com/kubevirt/containerized-data-importer/releases/download/v1.39.0/cdi-operator.yaml
$ microk8s kubectl create -f https://github.com/kubevirt/containerized-data-importer/releases/download/v1.39.0/cdi-cr.yaml
$ microk8s kubectl get all -n cdi
# virtctl 설치
$ sudo apt install curl
$ curl -L -o virtctl https://github.com/kubevirt/kubevirt/releases/download/v0.45.0/virtctl-v0.45.0-linux-amd64
$ sudo mv virtctl /bin/
$ chmod 750 /bin/virtctl
# fedora 클라우드 이미지 업로드
https://alt.fedoraproject.org/cloud/
-> qcow2 이미지 다운로드
cdi-uploadproxy-599649dcdc-hqd6d 1/1 Running 0 19m 10.1.38.88
$ sudo microk8s kubectl get pod -n cdi -o wide
$ sudo virtctl image-upload pvc vmdisk --size 6G --image-path=/images/fedora34.qcow2 --access-mode ReadWriteMany --insecure --uploadproxy-url https://10.1.38.88:8443
https://daaa0555.tistory.com/455