mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
125 lines
3.7 KiB
Plaintext
125 lines
3.7 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * machine_configuration/machine-config-node-disruption_machine-configs-configure.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="machine-config-node-disruption-config_{context}"]
|
|
= Configuring node restart behaviors upon machine config changes
|
|
|
|
[role="_abstract"]
|
|
You can create a node disruption policy to define the machine configuration changes that cause a disruption to your cluster, and which changes do not.
|
|
|
|
You can control how your nodes respond to changes in the files in the `/var` or `/etc` directory, the systemd units, the SSH keys, and the `registries.conf` file.
|
|
|
|
include::snippets/machine-config-node-disruption-actions.adoc[]
|
|
|
|
.Procedure
|
|
|
|
. Edit the `machineconfigurations.operator.openshift.io` object to define the node disruption policy:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc edit MachineConfiguration cluster -n openshift-machine-config-operator
|
|
----
|
|
|
|
. Add a node disruption policy similar to the following:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operator.openshift.io/v1
|
|
kind: MachineConfiguration
|
|
metadata:
|
|
name: cluster
|
|
# ...
|
|
spec:
|
|
nodeDisruptionPolicy: <1>
|
|
files: # <2>
|
|
- actions: # <3>
|
|
- restart: # <4>
|
|
serviceName: chronyd.service # <5>
|
|
type: Restart
|
|
path: /etc/chrony.conf # <6>
|
|
sshkey: # <7>
|
|
actions:
|
|
- type: Drain
|
|
- reload:
|
|
serviceName: crio.service
|
|
type: Reload
|
|
- type: DaemonReload
|
|
- restart:
|
|
serviceName: crio.service
|
|
type: Restart
|
|
units: # <8>
|
|
- actions:
|
|
- type: Drain
|
|
- reload:
|
|
serviceName: crio.service
|
|
type: Reload
|
|
- type: DaemonReload
|
|
- restart:
|
|
serviceName: crio.service
|
|
type: Restart
|
|
name: sshd.service
|
|
----
|
|
<1> Specifies the node disruption policy.
|
|
<2> Specifies a list of machine config file definitions and actions to take to changes on those paths. This list supports a maximum of 50 entries.
|
|
<3> Specifies the series of actions to be executed upon changes to the specified files. Actions are applied in the order that they are set in this list. This list supports a maximum of 10 entries.
|
|
<4> Specifies that the listed service is to be reloaded upon changes to the specified files.
|
|
<5> Specifies the full name of the service to be acted upon.
|
|
<6> Specifies the location of a file that is managed by a machine config. The actions in the policy apply when changes are made to the file in `path`.
|
|
<7> Specifies a list of service names and actions to take upon changes to the SSH keys in the cluster.
|
|
<8> Specifies a list of systemd unit names and actions to take upon changes to those units.
|
|
|
|
.Verification
|
|
|
|
* View the `MachineConfiguration` object file that you created:
|
|
+
|
|
----
|
|
$ oc get MachineConfiguration/cluster -o yaml
|
|
----
|
|
+
|
|
.Example output
|
|
[source,yaml]
|
|
----
|
|
apiVersion: operator.openshift.io/v1
|
|
kind: MachineConfiguration
|
|
metadata:
|
|
labels:
|
|
machineconfiguration.openshift.io/role: worker
|
|
name: cluster
|
|
# ...
|
|
status:
|
|
nodeDisruptionPolicyStatus: <1>
|
|
clusterPolicies:
|
|
files:
|
|
# ...
|
|
- actions:
|
|
- restart:
|
|
serviceName: chronyd.service
|
|
type: Restart
|
|
path: /etc/chrony.conf
|
|
sshkey:
|
|
actions:
|
|
- type: Drain
|
|
- reload:
|
|
serviceName: crio.service
|
|
type: Reload
|
|
- type: DaemonReload
|
|
- restart:
|
|
serviceName: crio.service
|
|
type: Restart
|
|
units:
|
|
- actions:
|
|
- type: Drain
|
|
- reload:
|
|
serviceName: crio.service
|
|
type: Reload
|
|
- type: DaemonReload
|
|
- restart:
|
|
serviceName: crio.service
|
|
type: Restart
|
|
name: sshd.service
|
|
# ...
|
|
----
|
|
<1> Specifies the current cluster-validated policies.
|