7.2. How to use the MicroShift health check command
The microshift healthcheck command checks whether a workload of the provided type exists and verifies its status for the specified timeout duration. The number of ready replicas, that is, pods, must match the expected amount.
To run the microshift healthcheck command successfully, use the following prerequisites:
- Execute commands from a root user account.
- Enable the MicroShift service.
You can add the following actions to the microshift healthcheck command:
-
-v=2to increase verbosity of the output -
--timeout="${WAIT_TIMEOUT_SECS}s"to override default 600s timeout value -
--namespace `<namespace>to specify the namespace of the workloads --deployments `<application-deployment>to check the readiness of a specific deploymentExample command
$ sudo microshift healthcheck -v=2 --timeout="300s" --namespace busybox --deployments busybox-deploymentExample output
??? I0410 08:54:03.766578 5898 service.go:29] microshift.service is enabled ??? I0410 08:54:03.766699 5898 service.go:31] Waiting 5m0s for microshift.service to be ready ??? I0410 08:54:03.768794 5898 service.go:38] microshift.service is ready ??? I0410 08:54:03.770585 5898 utils.go:34] Waiting for 1 goroutines ??? I0410 08:54:03.770955 5898 workloads.go:94] Waiting 5m0s for deployment/busybox-deployment in busybox ??? I0410 08:54:03.777830 5898 workloads.go:132] Deployment/busybox-deployment in busybox is ready ??? I0410 08:54:03.777858 5898 healthcheck.go:75] Workloads are ready
The microshift healthcheck command also accepts the following additional parameters to specify other kinds of workloads:
-
--daemonsets -
--statefulsets -
These options take a comma-delimited list of resources, for example,
--daemonsets ovnkube-master,ovnkube-node.
Alternatively, a --custom option can be used with a JSON string, for example:
$ sudo microshift healthcheck --custom '{"openshift-storage":{"deployments":
["lvms-operator"], "daemonsets": ["vg-manager"]}, "openshift-ovn-kubernetes":
{"daemonsets": ["ovnkube-master", "ovnkube-node"]}}'
Example output
??? I0410 08:54:25.291059 5979 service.go:29] microshift.service is enabled
??? I0410 08:54:25.291167 5979 service.go:31] Waiting 5m0s for microshift.service to be ready
??? I0410 08:54:25.293188 5979 service.go:38] microshift.service is ready
??? I0410 08:54:25.294331 5979 workloads.go:58] Waiting 5m0s for daemonset/ovnkube-node in openshift-ovn-kubernetes
??? I0410 08:54:25.294351 5979 workloads.go:58] Waiting 5m0s for daemonset/ovnkube-master in openshift-ovn-kubernetes
??? I0410 08:54:25.294331 5979 workloads.go:58] Waiting 5m0s for daemonset/vg-manager in openshift-storage
??? I0410 08:54:25.294341 5979 workloads.go:94] Waiting 5m0s for deployment/lvms-operator in openshift-storage
??? I0410 08:54:25.309739 5979 workloads.go:89] Daemonset/ovnkube-node in openshift-ovn-kubernetes is ready
??? I0410 08:54:25.310213 5979 workloads.go:89] Daemonset/vg-manager in openshift-storage is ready
??? I0410 08:54:25.310731 5979 workloads.go:132] Deployment/lvms-operator in openshift-storage is ready
??? I0410 08:54:25.311017 5979 workloads.go:89] Daemonset/ovnkube-master in openshift-ovn-kubernetes is ready
??? I0410 08:54:25.311189 5979 healthcheck.go:52] Workloads are ready