Skip to content

Commit b24570e

Browse files
committed
OSDOCS-12976: updates greenboot scripts MicroShift
1 parent 21a925a commit b24570e

21 files changed

+230
-219
lines changed

_topic_maps/_topic_map_ms.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ Topics:
223223
File: microshift-embed-apps-offline-use
224224
- Name: Embedding applications tutorial
225225
File: microshift-embedding-apps-tutorial
226-
- Name: Creating application or workload health check scripts
227-
File: microshift-greenboot-workload-scripts
226+
- Name: Using greenboot for workload health checks
227+
File: microshift-greenboot-workload-health-checks
228228
- Name: Automating application management with GitOps
229229
File: microshift-gitops
230230
- Name: Pod security authentication and authorization

microshift_install_get_ready/microshift-greenboot.adoc

+5-10
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ include::_attributes/attributes-microshift.adoc[]
66

77
toc::[]
88

9-
Greenboot is the generic health check framework for the `systemd` service on `rpm-ostree` systems such as {op-system-ostree-first}. This framework is included in {microshift-short} installations with the `microshift-greenboot` and `greenboot-default-health-checks` RPM packages.
9+
Learn about how greenboot health checks are used with {microshift-short}.
1010

11-
Greenboot health checks run at various times to assess system health and automate a rollback on `rpm-ostree` systems to the last healthy state in cases of software trouble, for example:
12-
13-
* Default health check scripts run each time the system starts.
14-
* In addition the to the default health checks, you can write, install, and configure application health check scripts to also run every time the system starts.
15-
* Greenboot can reduce your risk of being locked out of edge devices during updates and prevent a significant interruption of service if an update fails.
16-
* When a failure is detected, the system boots into the last known working configuration using the `rpm-ostree` rollback capability. This feature is especially useful automation for edge devices where direct serviceability is either limited or non-existent.
17-
18-
A {microshift-short} application health check script is included in the `microshift-greenboot` RPM. The `greenboot-default-health-checks` RPM includes health check scripts verifying that DNS and `ostree` services are accessible. You can create your own health check scripts for the workloads you are running. You can write one that verifies that an application has started, for example.
11+
include::modules/microshift-greenboot-dir-use-for-scripts.adoc[leveloffset=+1]
1912

2013
include::modules/microshift-greenboot-dir-structure.adoc[leveloffset=+1]
2114

15+
include::modules/microshift-greenboot-included-health-checks.adoc[leveloffset=+1]
16+
2217
include::modules/microshift-greenboot-microshift-health-script.adoc[leveloffset=+1]
2318

2419
include::modules/microshift-greenboot-systemd-journal-data.adoc[leveloffset=+1]
@@ -40,4 +35,4 @@ include::modules/microshift-greenboot-check-update.adoc[leveloffset=+1]
4035
[id="additional-resources_microshift-greenboot_{context}"]
4136
[role="_additional-resources_microshift-greenboot"]
4237
== Additional resources
43-
* xref:../microshift_running_apps/microshift-greenboot-workload-scripts.adoc#microshift-greenboot-workload-scripts[Greenboot workload health check scripts]
38+
* xref:../microshift_running_apps/microshift-greenboot-workload-health-checks.adoc#microshift-greenboot-workload-health-checks[Greenboot workload health checks]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
[id="microshift-greenboot-workload-health-checks"]
3+
= Using greenboot for application and workload health checks
4+
include::_attributes/attributes-microshift.adoc[]
5+
:context: microshift-greenboot-workload-health-checks
6+
7+
toc::[]
8+
9+
You can use greenboot health checks to assess the health of your workloads and applications.
10+
11+
include::modules/microshift-greenboot-how-workload-health-checks-work.adoc[leveloffset=+1]
12+
13+
include::modules/microshift-greenboot-health-check-command.adoc[leveloffset=+1]
14+
15+
include::modules/microshift-greenboot-app-health-check-script.adoc[leveloffset=+1]
16+
17+
include::modules/microshift-greenboot-workload-health-script-ex.adoc[leveloffset=+2]
18+
19+
include::modules/microshift-greenboot-testing-workload-script.adoc[leveloffset=+2]
20+
21+
[role="_additional-resources"]
22+
== Additional resources
23+
24+
* xref:../microshift_install_get_ready/microshift-greenboot.adoc#microshift-greenboot[The greenboot health check]
25+
26+
* xref:../microshift_running_apps/microshift-applications.adoc#microshift-applying-manifests-example_applications-microshift[Auto applying manifests]

microshift_running_apps/microshift-greenboot-workload-scripts.adoc

-25
This file was deleted.

microshift_updating/microshift-update-options.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ To begin a {microshift-short} update by embedding in a {op-system-ostree} image,
5151
To understand more about greenboot, see the following documentation:
5252

5353
* xref:../microshift_install_get_ready/microshift-greenboot.adoc#microshift-greenboot[The greenboot health check]
54-
* xref:../microshift_running_apps/microshift-greenboot-workload-scripts.adoc#microshift-greenboot-workload-scripts[Greenboot workload health check scripts]
54+
* xref:../microshift_running_apps/microshift-greenboot-workload-health-checks.adoc#microshift-greenboot-workload-health-checks[Greenboot workload health checks]
5555

5656
[id="microshift-update-options-manual-rpm-updates_{context}"]
5757
=== Manual RPM updates
@@ -91,4 +91,4 @@ You can update {op-system-ostree} or {op-system-base} and update {microshift-sho
9191
* xref:../microshift_updating/microshift-update-rpms-ostree.adoc#microshift-update-rpms-ostree[Applying updates on an OSTree system]
9292
* xref:../microshift_updating/microshift-update-rpms-manually.adoc#microshift-update-rpms-manually[Applying updates manually with RPMs]
9393
* xref:../microshift_install_get_ready/microshift-greenboot.adoc#microshift-greenboot[The greenboot system health check]
94-
* xref:../microshift_running_apps/microshift-greenboot-workload-scripts.adoc#microshift-greenboot-workload-scripts[Greenboot workload scripts]
94+
* xref:../microshift_running_apps/microshift-greenboot-workload-health-checks.adoc#microshift-greenboot-workload-health-checks[Greenboot workload health checks]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//Module included in the following assemblies:
2+
//
3+
//* microshift_running_apps/microshift-greenboot-workload-health-checks.adoc
4+
5+
:_mod-docs-content-type: CONCEPT
6+
[id="microshift-greenboot-app-health-check-script_{context}"]
7+
= How to create a health check script for your application
8+
9+
You can create workload or application health check scripts in the text editor of your choice. Save the scripts in the `/etc/greenboot/check/required.d` directory. When a script in the `/etc/greenboot/check/required.d` directory exits with an error, greenboot triggers a reboot in an attempt to heal the system.
10+
11+
[NOTE]
12+
====
13+
Any script in the `/etc/greenboot/check/required.d` directory triggers a reboot if it exits with an error.
14+
====
15+
16+
If your health check logic requires any post-check steps, you can also create additional scripts and save them in the relevant greenboot directories. For example:
17+
18+
* You can also place shell scripts you want to run after a boot has been declared successful in `/etc/greenboot/green.d`.
19+
* You can place shell scripts you want to run after a boot has been declared failed in `/etc/greenboot/red.d`. For example, if you have steps to heal the system before restarting, you can create scripts for your use case and place them in the `/etc/greenboot/red.d` directory.

modules/microshift-greenboot-check-update.adoc

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ Access the output of greenboot health check scripts in the system log after an u
1616
----
1717
$ sudo grub2-editenv - list | grep ^boot_success
1818
----
19-
19+
+
2020
.Example output for a successful update
2121
[source,terminal]
2222
----
23-
boot_success=1
23+
boot_success=1 <1>
2424
----
25-
26-
If your command returns `boot_success=0`, either the greenboot health check is still running, or the update is a failure.
25+
<1> If your command returns `boot_success=0`, either the greenboot health check is still running, or the update is a failure.

modules/microshift-greenboot-create-health-check-script.adoc

-113
This file was deleted.

modules/microshift-greenboot-dir-structure.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ If you customize the values of any environment variable in the `/etc/greenboot/g
4646
4747
* To retain customizations when building system images with {microshift-short}, add the `greenboot.conf` file to a blueprint.
4848
* To retain customizations when using an RPM installation, apply changes to the `greenboot.conf` file after you install {microshift-short} and greenboot RPMs.
49-
====
49+
====
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * microshift_install_get_ready/microshift-greenboot.adoc
4+
5+
:_mod-docs-content-type: CONCEPT
6+
[id="microshift-greenboot-dir-use-for-scripts_{context}"]
7+
= How greenboot uses directories to run scripts
8+
9+
Greenboot is the generic health check framework for the `systemd` service on `rpm-ostree` systems such as {op-system-ostree-first}. This framework is included in {microshift-short} installations with the `microshift-greenboot` and `greenboot-default-health-checks` RPM packages.
10+
11+
Greenboot health checks run at various times to assess system health and automate a rollback on `rpm-ostree` systems to the last healthy state in cases of software trouble, for example:
12+
13+
* Default health check scripts run each time the system starts.
14+
* In addition the to the default health checks, you can write, install, and configure application health check scripts to also run every time the system starts.
15+
* Greenboot can reduce your risk of being locked out of edge devices during updates and prevent a significant interruption of service if an update fails.
16+
* When a failure is detected, the system boots into the last known working configuration using the `rpm-ostree` rollback capability. This feature is especially useful automation for edge devices where direct serviceability is either limited or non-existent.
17+
18+
A {microshift-short} application health check script is included in the `microshift-greenboot` RPM. The `greenboot-default-health-checks` RPM includes health check scripts verifying that DNS and `ostree` services are accessible. You can create your own health check scripts for the workloads you are running. You can write one that verifies that an application has started, for example.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//Module included in the following assemblies:
2+
//
3+
//* microshift_running_apps/microshift-greenboot-workload-health-checks.adoc
4+
5+
:_mod-docs-content-type: REFERENCE
6+
[id="microshift-greenboot-microshift-health-check-command_{context}"]
7+
= How to use the {microshift-short} health check command
8+
9+
The `microshift healthcheck` command checks whether a workload of the provided type exists and verifies its
10+
status for the specified timeout duration. The number of ready replicas, that is, pods, must match the expected amount.
11+
12+
To run the `microshift healthcheck` command successfully, use the following prerequisites:
13+
14+
* Execute commands from a root user account.
15+
* Enable the {microshift-short} service.
16+
17+
You can add the following actions to the `microshift healthcheck` command:
18+
19+
* `-v=2` to increase verbosity of the output
20+
* `--timeout="${WAIT_TIMEOUT_SECS}s"` to override default 300s timeout value
21+
* `--namespace `_<namespace>_` to specify the namespace of the workloads
22+
* `--deployments `_<application-deployment>_` to check the readiness of a specific deployment
23+
24+
The `microshift healthcheck` command also accepts the following additional parameters to specify other kinds
25+
of workloads:
26+
27+
* `--daemonsets`
28+
* `--statefulsets`
29+
* These options take a comma-delimited list of resources, for example, `--daemonsets ovnkube-master,ovnkube-node`.
30+
31+
Alternatively, a `--custom` option can be used with a `JSON` string, for example:
32+
[source,terminal]
33+
----
34+
$ microshift healthcheck --custom '{"openshift-storage":{"deployments": ["lvms-operator"], "daemonsets": ["vg-manager"]}, "openshift-ovn-kubernetes":{"daemonsets": ["ovnkube-master", "ovnkube-node"]}}'
35+
----
36+
37+
[NOTE]
38+
====
39+
Restarting pods can indicate a crash loop.
40+
====

modules/microshift-greenboot-health-check-log.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ You can manually access the output of health checks in the system log by using t
1616
----
1717
$ sudo journalctl -o cat -u greenboot-healthcheck.service
1818
----
19-
19+
+
2020
.Example output of a failed health check
2121
[source,terminal]
2222
----
@@ -34,4 +34,4 @@ Waiting 300s for MicroShift service to be active and not failed
3434
FAILURE
3535
...
3636
...
37-
----
37+
----

modules/microshift-greenboot-how-workload-health-check-scripts-work.adoc

-26
This file was deleted.

0 commit comments

Comments
 (0)