14.8.3. Defining a guest agent ping probe
You can define a guest agent ping probe by setting the spec.readinessProbe.guestAgentPing field of the virtual machine (VM) configuration.
Prerequisites
- The QEMU guest agent must be installed and enabled on the virtual machine.
-
You have installed the OpenShift CLI (
oc).
Procedure
Include details of the guest agent ping probe in the VM configuration file. For example:
apiVersion: kubevirt.io/v1 kind: VirtualMachine metadata: annotations: name: fedora-vm namespace: example-namespace # ... spec: template: spec: readinessProbe: guestAgentPing: {} initialDelaySeconds: 120 periodSeconds: 20 timeoutSeconds: 10 failureThreshold: 3 successThreshold: 3 # ...-
spec.template.spec.readinessProbe.guestAgentPingdefines the guest agent ping probe to connect to the VM. -
spec.template.spec.readinessProbe.initialDelaySecondsdefines the time, in seconds, after the VM starts before the guest agent probe is initiated. This value is optional. -
spec.template.spec.readinessProbe.periodSecondsdefines the delay, in seconds, between performing probes. The default delay is 10 seconds. This value must be greater thantimeoutSeconds. This value is optional -
spec.template.spec.readinessProbe.timeoutSecondsdefines the number of seconds of inactivity after which the probe times out and the VM is assumed to have failed. The default value is 1. This value must be lower thanperiodSeconds. This value is optional. -
spec.template.spec.readinessProbe.failureThresholddefines the number of times that the probe is allowed to fail. The default is 3. After the specified number of attempts, the pod is markedUnready. This value is optional. -
spec.template.spec.readinessProbe.successThresholddefines the number of times that the probe must report success, after a failure, to be considered successful. The default is 1. This value is optional.
-
Create the VM by running the following command:
$ oc create -f <file_name>.yaml