-
Notifications
You must be signed in to change notification settings - Fork 0
kubevirt on datacenter
kubectl -n vms create secret generic lab-0-public-key --from-file=key1=/Users/allanreid/.ssh/id_ecdsa.pub
kubectl delete virtualmachine.kubevirt.io/ubuntu-cloud-base-lab-0 -n vms cat << EOF > ubuntu-cloud-base-lab-0.yaml apiVersion: kubevirt.io/v1 kind: VirtualMachine metadata: labels: min.io/vm: ubuntu-cloud-base-lab-0 name: ubuntu-cloud-base-lab-0 namespace: vms spec: running: false template: metadata: labels: min.io/vm: ubuntu-cloud-base-lab-0 spec: architecture: amd64 domain: devices: disks: - disk: bus: virtio name: os resources: requests: memory: 4096M terminationGracePeriodSeconds: 0 accessCredentials: - sshPublicKey: source: secret: secretName: lab-0-public-key propagationMethod: qemuGuestAgent: users: - ubuntu volumes: - dataVolume: name: ubuntu-cloud-base-disk name: os - cloudInitNoCloud: userData: | #cloud-config ssh_authorized_keys: - ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNAP5+uJ/C0zBiUZ/UrvRf/+hyhliApW+J3bjH2g521MoceVPyAgEjCOhJWfXEFcUisIySDIVqpuMUh7Q2J/aKU= allanreid@Allans-MBP user: ubuntu password: ubuntu chpasswd: { expire: False } ssh_pwauth: True name: cloudinitdisk dataVolumeTemplates:
- metadata: name: ubuntu-cloud-base-disk spec: pvc: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi sourceRef: kind: DataSource name: ubuntu-2204 EOF kubectl create -f ubuntu-cloud-base-lab-0.yaml
-- virtctl VERSION=$(kubectl get kubevirt.kubevirt.io/kubevirt -n vms -o=jsonpath="{.status.observedKubeVirtVersion}") VERSION=v1.2.0 ARCH=$(uname -s | tr A-Z a-z)-$(uname -m | sed 's/x86_64/amd64/') || windows-amd64.exe echo ${ARCH} echo https://github.com/kubevirt/kubevirt/releases/download/$VERSION/virtctl-$VERSION-$ARCH curl -L -o virtctl https://github.com/kubevirt/kubevirt/releases/download/${VERSION}/virtctl-${VERSION}-${ARCH} mv virtctl-v1.2.0-darwin-arm64 virtctl mv virtctl-v1.1.0-darwin-arm64 virtctl chmod +x virtctl
--
kubectl describe datavolume ubuntu-cloud-base-disk -n vms kubectl -n vms get datavolume ubuntu-cloud-base-disk kubectl get pvc -n vms
./virtctl -n vms start ubuntu-cloud-base-lab-0 kubectl -n vms get vm/ubuntu-cloud-base-lab-0 -w ./virtctl -n vms console ubuntu-cloud-base-lab-0
Access using ssh cat << EOF > ubuntu-cloud-base-lab-0-nodeport.yaml apiVersion: v1 kind: Service metadata: name: ubuntu-cloud-base-lab-0 namespace: vms spec: ports:
- name: ssh nodePort: 30022 port: 22 protocol: TCP targetPort: 22 selector: min.io/vm: ubuntu-cloud-base-lab-0 sessionAffinity: None type: NodePort EOF kubectl create -f ubuntu-cloud-base-lab-0-nodeport.yaml kubectl -n vms get svc
ssh -i /Users/allanreid/.ssh/id_ecdsa.pub ubuntu@64.71.151.78 -p 30022 ./virtctl -n vms ssh -i /Users/allanreid/.ssh/id_ecdsa.pub ubuntu@ubuntu-cloud-base-lab-0 -p 22