1장. Customizing nodes
OpenShift Container Platform supports both cluster-wide and per-machine configuration via Ignition, which allows arbitrary partitioning and file content changes to the operating system. In general, if a configuration file is documented in Red Hat Enterprise Linux (RHEL), then modifying it via Ignition is supported.
There are two ways to deploy machine config changes:
-
Creating machine configs that are included in manifest files to start up a cluster during
openshift-install. - Creating machine configs that are passed to running OpenShift Container Platform nodes via the Machine Config Operator.
Additionally, modifying the reference config, such as the Ignition config that is passed to coreos-installer when installing bare-metal nodes allows per-machine configuration. These changes are currently not visible to the Machine Config Operator.
The following sections describe features that you might want to configure on your nodes in this way.
1.1. Creating machine configs with Butane 링크 복사링크가 클립보드에 복사되었습니다!
Machine configs are used to configure control plane and worker machines by instructing machines how to create users and file systems, set up the network, install systemd units, and more.
Because modifying machine configs can be difficult, you can use Butane configs to create machine configs for you, thereby making node configuration much easier.
1.1.1. About Butane 링크 복사링크가 클립보드에 복사되었습니다!
Butane is a command-line utility that OpenShift Container Platform uses to provide convenient, short-hand syntax for writing machine configs, as well as for performing additional validation of machine configs. The format of the Butane config file that Butane accepts is defined in the OpenShift Butane config spec.
1.1.2. Installing Butane 링크 복사링크가 클립보드에 복사되었습니다!
You can install the Butane tool (butane) to create OpenShift Container Platform machine configs from a command-line interface. You can install butane on Linux, Windows, or macOS by downloading the corresponding binary file.
Butane releases are backwards-compatible with older releases and with the Fedora CoreOS Config Transpiler (FCCT).
Procedure
- Navigate to the Butane image download page at https://mirror.openshift.com/pub/openshift-v4/clients/butane/.
Get the
butanebinary:For the newest version of Butane, save the latest
butaneimage to your current directory:$ curl https://mirror.openshift.com/pub/openshift-v4/clients/butane/latest/butane --output butaneOptional: For a specific type of architecture you are installing Butane on, such as aarch64 or ppc64le, indicate the appropriate URL. For example:
$ curl https://mirror.openshift.com/pub/openshift-v4/clients/butane/latest/butane-aarch64 --output butane
Make the downloaded binary file executable:
$ chmod +x butaneMove the
butanebinary file to a directory on yourPATH.To check your
PATH, open a terminal and execute the following command:$ echo $PATH
Verification steps
You can now use the Butane tool by running the
butanecommand:$ butane <butane_file>
1.1.3. Creating a MachineConfig object by using Butane 링크 복사링크가 클립보드에 복사되었습니다!
You can use Butane to produce a MachineConfig object so that you can configure worker or control plane nodes at installation time or via the Machine Config Operator.
Prerequisites
-
You have installed the
butaneutility.
Procedure
Create a Butane config file. The following example creates a file named
99-worker-custom.buthat configures the system console to show kernel debug messages and specifies custom settings for the chrony time service:variant: openshift version: 4.21.0 metadata: name: 99-worker-custom labels: machineconfiguration.openshift.io/role: worker openshift: kernel_arguments: - loglevel=7 storage: files: - path: /etc/chrony.conf mode: 0644 overwrite: true contents: inline: | pool 0.rhel.pool.ntp.org iburst driftfile /var/lib/chrony/drift makestep 1.0 3 rtcsync logdir /var/log/chrony참고The
99-worker-custom.bufile is set to create a machine config for worker nodes. To deploy on control plane nodes, change the role fromworkertomaster. To do both, you could repeat the whole procedure using different file names for the two types of deployments.Create a
MachineConfigobject by giving Butane the file that you created in the previous step:$ butane 99-worker-custom.bu -o ./99-worker-custom.yamlA
MachineConfigobject YAML file is created for you to finish configuring your machines.-
Save the Butane config in case you need to update the
MachineConfigobject in the future. If the cluster is not running yet, generate manifest files and add the
MachineConfigobject YAML file to theopenshiftdirectory. If the cluster is already running, apply the file as follows:$ oc create -f 99-worker-custom.yaml