Created
April 30, 2020 11:31
-
-
Save maiqueb/9c19361a20ab719b9c3a55bb731e4134 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create the VMI | |
| kubectl apply -f examples/vmi-masquerade.yaml | |
| virtualmachineinstance.kubevirt.io/vmi-masquerade created | |
| # install guest agent in VMI | |
| ./_out/cmd/virtctl/virtctl console vmi-masquerade | |
| Successfully connected to vmi-masquerade console. The escape sequence is ^] | |
| vmi-masquerade login: fedora | |
| Password: | |
| [fedora@vmi-masquerade ~]$ curl http://cdi-http-import-server.kubevirt/qemu-ga > qemu-ga | |
| [fedora@vmi-masquerade ~]$ sudo chmod +x qemu-ga | |
| [fedora@vmi-masquerade ~]$ sudo mv qemu-ga /usr/local/bin/ | |
| [fedora@vmi-masquerade ~]$ sudo setenforce 0 | |
| [fedora@vmi-masquerade ~]$ sudo systemd-run --unit=guestagent /usr/local/bin/qemu-ga | |
| # update the VMs time | |
| [fedora@vmi-masquerade ~]$ date | |
| Thu 30 Apr 2020 11:08:08 AM UTC | |
| [fedora@vmi-masquerade ~]$ sudo date +%T -s 10:00:00 | |
| 10:00:00 | |
| [fedora@vmi-masquerade ~]$ date | |
| Thu 30 Apr 2020 10:00:29 AM UTC | |
| # check guest agent works; leave the VMI | |
| $ kubectl get vmi vmi-masquerade -oyaml | |
| apiVersion: kubevirt.io/v1alpha3 | |
| kind: VirtualMachineInstance | |
| metadata: | |
| ... | |
| name: vmi-masquerade | |
| namespace: default | |
| resourceVersion: "39954" | |
| selfLink: /apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachineinstances/vmi-masquerade | |
| uid: d8abc804-a1b8-42f8-adc6-bbf917018310 | |
| spec: | |
| ... | |
| status: | |
| activePods: | |
| 8b053859-76f7-44e3-806f-ef2362dea00d: node02 | |
| conditions: | |
| - lastProbeTime: null | |
| lastTransitionTime: null | |
| status: "True" | |
| type: LiveMigratable | |
| - lastProbeTime: null | |
| lastTransitionTime: "2020-04-30T11:01:56Z" | |
| status: "True" | |
| type: Ready | |
| - lastProbeTime: "2020-04-30T11:05:28Z" | |
| lastTransitionTime: null | |
| status: "True" | |
| type: AgentConnected | |
| - lastProbeTime: "2020-04-30T11:05:28Z" | |
| lastTransitionTime: null | |
| status: "True" | |
| type: AgentVersionNotSupported | |
| guestOSInfo: | |
| id: fedora | |
| kernelRelease: 5.6.0-0.rc5.git0.2.fc32.x86_64 | |
| kernelVersion: '#1 SMP Tue Mar 10 19:09:42 UTC 2020' | |
| name: Fedora | |
| prettyName: Fedora 32 (Cloud Edition) | |
| version: "32" | |
| versionId: "32" | |
| ... | |
| # migrate the vmi, using the example - must update the name | |
| $ git diff | |
| diff --git a/examples/migration-job.yaml b/examples/migration-job.yaml | |
| index 6c1f24473..909148047 100644 | |
| --- a/examples/migration-job.yaml | |
| +++ b/examples/migration-job.yaml | |
| @@ -4,4 +4,4 @@ kind: VirtualMachineInstanceMigration | |
| metadata: | |
| name: migration-job | |
| spec: | |
| - vmiName: vmi-migratable | |
| + vmiName: vmi-masquerade | |
| $ kubectl apply -f examples/migration-job.yaml | |
| virtualmachineinstancemigration.kubevirt.io/migration-job created | |
| $ kubectl get vmi -w | |
| NAME AGE PHASE IP NODENAME | |
| vmi-masquerade 8m25s Running 10.244.1.39 node02 | |
| vmi-masquerade 8m27s Running 10.244.1.39 node02 | |
| vmi-masquerade 8m27s Running 10.244.1.39 node02 | |
| vmi-masquerade 8m27s Running 10.244.1.39 node02 | |
| vmi-masquerade 8m28s Running 10.244.1.39 node02 | |
| vmi-masquerade 8m41s Running 10.244.1.39 node01 # OK, it moved to the other node. | |
| vmi-masquerade 8m41s Running 10.244.1.39 node01 | |
| vmi-masquerade 8m42s Running 10.244.1.39 node01 | |
| $ ./_out/cmd/virtctl/virtctl console vmi-masquerade | |
| Successfully connected to vmi-masquerade console. The escape sequence is ^] | |
| [fedora@vmi-masquerade ~]$ date | |
| Thu 30 Apr 2020 10:02:35 AM UTC # time is not updated. | |
| # let's check the pod's perspective ... | |
| $ kubectl get pods | |
| NAME READY STATUS RESTARTS AGE | |
| local-volume-provisioner-zf5kz 1/1 Running 0 3h14m | |
| local-volume-provisioner-zhqzg 1/1 Running 0 3h14m | |
| virt-launcher-vmi-masquerade-44v2x 2/2 Running 0 2m15s | |
| virt-launcher-vmi-masquerade-dp6kb 0/2 Completed 0 10m | |
| $ kubectl exec -it virt-launcher-vmi-masquerade-44v2x bash | |
| [root@virt-launcher-vmi-masquerade-44v2x /]# virsh domtime 1 --pretty | |
| Time: 2020-04-30 10:04:20 | |
| [root@virt-launcher-vmi-masquerade-44v2x /]# virsh domtime 1 --sync | |
| error: internal error: unable to execute QEMU agent command 'guest-set-time': hwclock failed to set hardware clock to system time | |
| [root@virt-launcher-vmi-masquerade-44v2x /]# virsh domtime 1 --now | |
| [root@virt-launcher-vmi-masquerade-44v2x /]# virsh domtime 1 --pretty | |
| Time: 2020-04-30 11:15:45 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment