1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/machine-config-node-disruption-example.adoc

167 lines
4.9 KiB
Plaintext

// Module included in the following assemblies:
//
// * post_installation_configuration/machine-configuration-tasks.adoc
:_mod-docs-content-type: PROCEDURE
[id="machine-config-node-disruption-example_{context}"]
= Example node disruption policies
The following example `MachineConfiguration` objects contain a node disruption policy.
[TIP]
====
A `MachineConfiguration` object and a `MachineConfig` object are different objects. A `MachineConfiguration` object is a singleton object in the MCO namespace that contains configuration parameters for the MCO operator. A `MachineConfig` object defines changes that are applied to a machine config pool.
====
The following example `MachineConfiguration` object shows no user defined policies. The default node disruption policy values are shown in the `status` stanza.
.Default node disruption policy
[source,yaml]
----
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
name: cluster
spec:
logLevel: Normal
managementState: Managed
operatorLogLevel: Normal
status:
nodeDisruptionPolicyStatus:
clusterPolicies:
files:
- actions:
- type: None
path: /etc/mco/internal-registry-pull-secret.json
- actions:
- type: None
path: /var/lib/kubelet/config.json
- actions:
- reload:
serviceName: crio.service
type: Reload
path: /etc/machine-config-daemon/no-reboot/containers-gpg.pub
- actions:
- reload:
serviceName: crio.service
type: Reload
path: /etc/containers/policy.json
- actions:
- type: Special
path: /etc/containers/registries.conf
- actions:
- reload:
serviceName: crio.service
type: Reload
path: /etc/containers/registries.d
- actions:
- type: None
path: /etc/nmstate/openshift
- actions:
- restart:
serviceName: coreos-update-ca-trust.service
type: Restart
- restart:
serviceName: crio.service
type: Restart
path: /etc/pki/ca-trust/source/anchors/openshift-config-user-ca-bundle.crt
sshkey:
actions:
- type: None
observedGeneration: 9
----
In the following example, when changes are made to the SSH keys, the MCO drains the cluster nodes, reloads the `crio.service`, reloads the systemd configuration, and restarts the `crio-service`.
.Example node disruption policy for an SSH key change
[source,yaml]
----
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
# ...
spec:
nodeDisruptionPolicy:
sshkey:
actions:
- type: Drain
- reload:
serviceName: crio.service
type: Reload
- type: DaemonReload
- restart:
serviceName: crio.service
type: Restart
# ...
----
In the following example, when changes are made to the `/etc/chrony.conf` file, the MCO reloads the `chronyd.service` on the cluster nodes. If files are added to or modified in the `/var/run` directory, the MCO applies the changes with no further action.
.Example node disruption policy for a configuration file change
[source,yaml]
----
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
# ...
spec:
nodeDisruptionPolicy:
files:
- actions:
- reload:
serviceName: chronyd.service
type: Reload
path: /etc/chrony.conf
- actions:
- type: None
path: /var/run
----
In the following example, when changes are made to the `auditd.service` systemd unit, the MCO drains the cluster nodes, reloads the `crio.service`, reloads the systemd manager configuration, and restarts the `crio.service`.
.Example node disruption policy for a systemd unit change
[source,yaml]
----
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
# ...
spec:
nodeDisruptionPolicy:
units:
- name: auditd.service
actions:
- type: Drain
- type: Reload
reload:
serviceName: crio.service
- type: DaemonReload
- type: Restart
restart:
serviceName: crio.service
----
In the following example, when changes are made to the `registries.conf` file, such as by editing an `ImageContentSourcePolicy` (ICSP) object, the MCO does not drain or reboot the nodes and applies the changes with no further action.
.Example node disruption policy for a registries.conf file change
[source,yaml]
----
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
# ...
spec:
nodeDisruptionPolicy:
files:
- actions:
- type: None
path: /etc/containers/registries.conf
----