Guest Agent information

Guest Agent (GA) is an optional component that can run inside of Virtual Machines. The GA provides plenty of additional runtime information about the running operating system (OS). More technical detail about available GA commands is available here.

Guest Agent info in Virtual Machine status

GA presence in the Virtual Machine is signaled with a condition in the VirtualMachineInstance status. The condition tells that the GA is connected and can be used.

GA condition on VirtualMachineInstance

  1. status:
  2. conditions:
  3. - lastProbeTime: "2020-02-28T10:22:59Z"
  4. lastTransitionTime: null
  5. status: "True"
  6. type: AgentConnected

When the GA is connected, additional OS information is shown in the status. This information comprises:

  • guest info, which contains OS runtime data
  • interfaces info, which shows QEMU interfaces merged with GA interfaces info.

Below is the example of the information shown in the VirtualMachineInstance status.

GA info with merged into status

  1. status:
  2. guestOSInfo:
  3. id: fedora
  4. kernelRelease: 4.18.16-300.fc29.x86_64
  5. kernelVersion: '#1 SMP Sat Oct 20 23:24:08 UTC 2018'
  6. name: Fedora
  7. prettyName: Fedora 29 (Cloud Edition)
  8. version: "29"
  9. versionId: "29"
  10. interfaces:
  11. - infoSource: domain, guest-agent
  12. interfaceName: eth0
  13. ipAddress: 10.244.0.23/24
  14. ipAddresses:
  15. - 10.244.0.23/24
  16. - fe80::858:aff:fef4:17/64
  17. mac: 0a:58:0a:f4:00:17
  18. name: default

When the Guest Agent is not present in the Virtual Machine, the Guest Agent information is not shown. No error is reported because the Guest Agent is an optional component.

The infoSource field indicates where the info is gathered from. Valid values:

  • domain: the info is based on the domain spec
  • guest-agent: the info is based on Guest Agent report
  • domain, guest-agent: the info is based on both the domain spec and the Guest Agent report

Guest Agent info available through the API

The data shown in the VirtualMachineInstance status are a subset of the information available. The rest of the data is available via the REST API exposed in the Kubernetes kube-api server.

There are three new subresources added to the VirtualMachineInstance object:

  1. - guestosinfo
  2. - userlist
  3. - filesystemlist

The whole GA data is returned via guestosinfo subresource available behind the API endpoint.

  1. /apis/subresources.kubevirt.io/v1/namespaces/{namespace}/virtualmachineinstances/{name}/guestosinfo

GuestOSInfo sample data:

  1. {
  2. "fsInfo": {
  3. "disks": [
  4. {
  5. "diskName": "vda1",
  6. "fileSystemType": "ext4",
  7. "mountPoint": "/",
  8. "totalBytes": 0,
  9. "usedBytes": 0
  10. }
  11. ]
  12. },
  13. "guestAgentVersion": "2.11.2",
  14. "hostname": "testvmi6m5krnhdlggc9mxfsrnhlxqckgv5kqrwcwpgr5mdpv76grrk",
  15. "metadata": {
  16. "creationTimestamp": null
  17. },
  18. "os": {
  19. "id": "fedora",
  20. "kernelRelease": "4.18.16-300.fc29.x86_64",
  21. "kernelVersion": "#1 SMP Sat Oct 20 23:24:08 UTC 2018",
  22. "machine": "x86_64",
  23. "name": "Fedora",
  24. "prettyName": "Fedora 29 (Cloud Edition)",
  25. "version": "29 (Cloud Edition)",
  26. "versionId": "29"
  27. },
  28. "timezone": "UTC, 0"
  29. }

Items FSInfo and UserList are capped to the max capacity of 10 items, as a precaution for VMs with thousands of users.

Full list of Filesystems is available through the subresource filesystemlist which is available as endpoint.

  1. /apis/subresources.kubevirt.io/v1/namespaces/{namespace}/virtualmachineinstances/{name}/filesystemlist

Filesystem sample data:

  1. {
  2. "items": [
  3. {
  4. "diskName": "vda1",
  5. "fileSystemType": "ext4",
  6. "mountPoint": "/",
  7. "totalBytes": 3927900160,
  8. "usedBytes": 1029201920
  9. }
  10. ],
  11. "metadata": {}
  12. }

Full list of the Users is available through the subresource userlist which is available as endpoint.

  1. /apis/subresources.kubevirt.io/v1/namespaces/{namespace}/virtualmachineinstances/{name}/userlist

Userlist sample data:

  1. {
  2. "items": [
  3. {
  4. "loginTime": 1580467675.876078,
  5. "userName": "fedora"
  6. }
  7. ],
  8. "metadata": {}
  9. }

User LoginTime is in fractional seconds since epoch time. It is left for the consumer to convert to the desired format.