$ curl https://mirror.openshift.com/pub/openshift-v4/clients/butane/latest/butane --output butane
Although directly making changes to OpenShift Container Platform nodes is discouraged, there are times when it is necessary to implement a required low-level security, redundancy, networking, or performance feature. Direct changes to OpenShift Container Platform nodes can be done by:
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.
Creating an Ignition config that is passed to coreos-installer
when installing bare-metal nodes.
The following sections describe features that you might want to configure on your nodes in this way.
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.
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.
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). |
Navigate to the Butane image download page at https://mirror.openshift.com/pub/openshift-v4/clients/butane/.
Get the butane
binary:
For the newest version of Butane, save the latest butane
image to your current directory:
$ curl https://mirror.openshift.com/pub/openshift-v4/clients/butane/latest/butane --output butane
Optional: 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 butane
Move the butane
binary file to a directory on your PATH
.
To check your PATH
, open a terminal and execute the following command:
$ echo $PATH
You can now use the Butane tool by running the butane
command:
$ butane <butane_file>
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.
You have installed the butane
utility.
Create a Butane config file. The following example creates a file named 99-worker-custom.bu
that configures the system console to show kernel debug messages and specifies custom settings for the chrony time service:
variant: openshift
version: 4.10.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 |
Create a MachineConfig
object by giving Butane the file that you created in the previous step:
$ butane 99-worker-custom.bu -o ./99-worker-custom.yaml
A MachineConfig
object YAML file is created for you to finish configuring your machines.
Save the Butane config in case you need to update the MachineConfig
object in the future.
If the cluster is not running yet, generate manifest files and add the MachineConfig
object YAML file to the openshift
directory. If the cluster is already running, apply the file as follows:
$ oc create -f 99-worker-custom.yaml
Although it is often preferable to modify kernel arguments as a day-2 activity, you might want to add kernel arguments to all master or worker nodes during initial cluster installation. Here are some reasons you might want to add kernel arguments during cluster installation so they take effect before the systems first boot up:
You want to disable a feature, such as SELinux, so it has no impact on the systems when they first come up.
Disabling SELinux on RHCOS is not supported. |
You need to do some low-level network configuration before the systems start.
To add kernel arguments to master or worker nodes, you can create a MachineConfig
object
and inject that object into the set of manifest files used by Ignition during
cluster setup.
For a listing of arguments you can pass to a RHEL 8 kernel at boot time, see Kernel.org kernel parameters. It is best to only add kernel arguments with this procedure if they are needed to complete the initial OpenShift Container Platform installation.
Change to the directory that contains the installation program and generate the Kubernetes manifests for the cluster:
$ ./openshift-install create manifests --dir <installation_directory>
Decide if you want to add kernel arguments to worker or control plane nodes.
In the openshift
directory, create a file (for example,
99-openshift-machineconfig-master-kargs.yaml
) to define a MachineConfig
object to add the kernel settings.
This example adds a loglevel=7
kernel argument to control plane nodes:
$ cat << EOF > 99-openshift-machineconfig-master-kargs.yaml
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: master
name: 99-openshift-machineconfig-master-kargs
spec:
kernelArguments:
- loglevel=7
EOF
You can change master
to worker
to add kernel arguments to worker nodes instead.
Create a separate YAML file to add to both master and worker nodes.
You can now continue on to create the cluster.
For most common hardware, the Linux kernel includes the device driver modules needed to use that hardware when the computer starts up. For some hardware, however, modules are not available in Linux. Therefore, you must find a way to provide those modules to each host computer. This procedure describes how to do that for nodes in an OpenShift Container Platform cluster.
When a kernel module is first deployed by following these instructions, the module is made available for the current kernel. If a new kernel is installed, the kmods-via-containers software will rebuild and deploy the module so a compatible version of that module is available with the new kernel.
The way that this feature is able to keep the module up to date on each node is by:
Adding a systemd service to each node that starts at boot time to detect if a new kernel has been installed and
If a new kernel is detected, the service rebuilds the module and installs it to the kernel
For information on the software needed for this procedure, see the kmods-via-containers github site.
A few important issues to keep in mind:
This procedure is Technology Preview.
Software tools and examples are not yet available in official RPM form
and can only be obtained for now from unofficial github.com
sites noted in the procedure.
Third-party kernel modules you might add through these procedures are not supported by Red Hat.
In this procedure, the software needed to build your kernel modules is
deployed in a RHEL 8 container. Keep in mind that modules are rebuilt
automatically on each node when that node gets a new kernel. For that
reason, each node needs access to a yum
repository that contains the
kernel and related packages needed to rebuild the module. That content
is best provided with a valid RHEL subscription.
Before deploying kernel modules to your OpenShift Container Platform cluster, you can test the process on a separate RHEL system. Gather the kernel module’s source code, the KVC framework, and the kmod-via-containers software. Then build and test the module. To do that on a RHEL 8 system, do the following:
Register a RHEL 8 system:
# subscription-manager register
Attach a subscription to the RHEL 8 system:
# subscription-manager attach --auto
Install software that is required to build the software and container:
# yum install podman make git -y
Clone the kmod-via-containers
repository:
Create a folder for the repository:
$ mkdir kmods; cd kmods
Clone the repository:
$ git clone https://github.com/kmods-via-containers/kmods-via-containers
Install a KVC framework instance on your RHEL 8 build host to test the module.
This adds a kmods-via-container
systemd service and loads it:
Change to the kmod-via-containers
directory:
$ cd kmods-via-containers/
Install the KVC framework instance:
$ sudo make install
Reload the systemd manager configuration:
$ sudo systemctl daemon-reload
Get the kernel module source code. The source code might be used to
build a third-party module that you do not
have control over, but is supplied by others. You will need content
similar to the content shown in the kvc-simple-kmod
example that can
be cloned to your system as follows:
$ cd .. ; git clone https://github.com/kmods-via-containers/kvc-simple-kmod
Edit the configuration file, simple-kmod.conf
file, in this example, and
change the name of the Dockerfile to Dockerfile.rhel
:
Change to the kvc-simple-kmod
directory:
$ cd kvc-simple-kmod
Rename the Dockerfile:
$ cat simple-kmod.conf
KMOD_CONTAINER_BUILD_CONTEXT="https://github.com/kmods-via-containers/kvc-simple-kmod.git"
KMOD_CONTAINER_BUILD_FILE=Dockerfile.rhel
KMOD_SOFTWARE_VERSION=dd1a7d4
KMOD_NAMES="simple-kmod simple-procfs-kmod"
Create an instance of kmods-via-containers@.service
for your kernel module,
simple-kmod
in this example:
$ sudo make install
Enable the kmods-via-containers@.service
instance:
$ sudo kmods-via-containers build simple-kmod $(uname -r)
Enable and start the systemd service:
$ sudo systemctl enable kmods-via-containers@simple-kmod.service --now
Review the service status:
$ sudo systemctl status kmods-via-containers@simple-kmod.service
● kmods-via-containers@simple-kmod.service - Kmods Via Containers - simple-kmod
Loaded: loaded (/etc/systemd/system/kmods-via-containers@.service;
enabled; vendor preset: disabled)
Active: active (exited) since Sun 2020-01-12 23:49:49 EST; 5s ago...
To confirm that the kernel modules are loaded, use the lsmod
command to list the modules:
$ lsmod | grep simple_
simple_procfs_kmod 16384 0
simple_kmod 16384 0
Optional. Use other methods to check that the simple-kmod
example is working:
Look for a "Hello world" message in the kernel ring buffer with dmesg
:
$ dmesg | grep 'Hello world'
[ 6420.761332] Hello world from simple_kmod.
Check the value of simple-procfs-kmod
in /proc
:
$ sudo cat /proc/simple-procfs-kmod
simple-procfs-kmod number = 0
Run the spkut
command to get more information from the module:
$ sudo spkut 44
KVC: wrapper simple-kmod for 4.18.0-147.3.1.el8_1.x86_64
Running userspace wrapper using the kernel module container...
+ podman run -i --rm --privileged
simple-kmod-dd1a7d4:4.18.0-147.3.1.el8_1.x86_64 spkut 44
simple-procfs-kmod number = 0
simple-procfs-kmod number = 44
Going forward, when the system boots this service will check if a new kernel is running. If there is a new kernel, the service builds a new version of the kernel module and then loads it. If the module is already built, it will just load it.
Depending on whether or not you must have the kernel module in place when OpenShift Container Platform cluster first boots, you can set up the kernel modules to be deployed in one of two ways:
Provision kernel modules at cluster install time (day-1):
You can create the content as a MachineConfig
object and provide it to openshift-install
by including it with a set of manifest files.
Provision kernel modules via Machine Config Operator (day-2): If you can wait until the cluster is up and running to add your kernel module, you can deploy the kernel module software via the Machine Config Operator (MCO).
In either case, each node needs to be able to get the kernel packages and related software packages at the time that a new kernel is detected. There are a few ways you can set up each node to be able to obtain that content.
Provide RHEL entitlements to each node.
Get RHEL entitlements from an existing RHEL host, from the /etc/pki/entitlement
directory
and copy them to the same location as the other files you provide
when you build your Ignition config.
Inside the Dockerfile, add pointers to a yum
repository containing the kernel and other packages.
This must include new kernel packages as they are needed to match newly installed kernels.
By packaging kernel module software with a MachineConfig
object, you can
deliver that software to worker or control plane nodes at installation time
or via the Machine Config Operator.
Register a RHEL 8 system:
# subscription-manager register
Attach a subscription to the RHEL 8 system:
# subscription-manager attach --auto
Install software needed to build the software:
# yum install podman make git -y
Create a directory to host the kernel module and tooling:
$ mkdir kmods; cd kmods
Get the kmods-via-containers
software:
Clone the kmods-via-containers
repository:
$ git clone https://github.com/kmods-via-containers/kmods-via-containers
Clone the kvc-simple-kmod
repository:
$ git clone https://github.com/kmods-via-containers/kvc-simple-kmod
Get your module software. In this example, kvc-simple-kmod
is used.
Create a fakeroot directory and populate it with files that you want to deliver via Ignition, using the repositories cloned earlier:
Create the directory:
$ FAKEROOT=$(mktemp -d)
Change to the kmod-via-containers
directory:
$ cd kmods-via-containers
Install the KVC framework instance:
$ make install DESTDIR=${FAKEROOT}/usr/local CONFDIR=${FAKEROOT}/etc/
Change to the kvc-simple-kmod
directory:
$ cd ../kvc-simple-kmod
Create the instance:
$ make install DESTDIR=${FAKEROOT}/usr/local CONFDIR=${FAKEROOT}/etc/
Clone the fakeroot directory, replacing any symbolic links with copies of their targets, by running the following command:
$ cd .. && rm -rf kmod-tree && cp -Lpr ${FAKEROOT} kmod-tree
Create a Butane config file, 99-simple-kmod.bu
, that embeds the kernel module tree and enables the systemd service.
See "Creating machine configs with Butane" for information about Butane. |
variant: openshift
version: 4.10.0
metadata:
name: 99-simple-kmod
labels:
machineconfiguration.openshift.io/role: worker (1)
storage:
trees:
- local: kmod-tree
systemd:
units:
- name: kmods-via-containers@simple-kmod.service
enabled: true
1 | To deploy on control plane nodes, change worker to master . To deploy on both control plane and worker nodes, perform the remainder of these instructions once for each node type. |
Use Butane to generate a machine config YAML file, 99-simple-kmod.yaml
, containing the files and configuration to be delivered:
$ butane 99-simple-kmod.bu --files-dir . -o 99-simple-kmod.yaml
If the cluster is not up yet, generate manifest files and add this file to the
openshift
directory. If the cluster is already running, apply the file as follows:
$ oc create -f 99-simple-kmod.yaml
Your nodes will start the kmods-via-containers@simple-kmod.service
service and the kernel modules will be loaded.
To confirm that the kernel modules are loaded, you can log in to a node
(using oc debug node/<openshift-node>
, then chroot /host
).
To list the modules, use the lsmod
command:
$ lsmod | grep simple_
simple_procfs_kmod 16384 0
simple_kmod 16384 0
During an OpenShift Container Platform installation, you can enable boot disk encryption and mirroring on the cluster nodes.
You can enable encryption for the boot disks on the control plane and compute nodes at installation time. OpenShift Container Platform supports the Trusted Platform Module (TPM) v2 and Tang encryption modes.
TPM v2: This is the preferred mode. TPM v2 stores passphrases in a secure cryptoprocessor contained within a server. You can use this mode to prevent the boot disk data on a cluster node from being decrypted if the disk is removed from the server.
Tang: Tang and Clevis are server and client components that enable network-bound disk encryption (NBDE). You can bind the boot disk data on your cluster nodes to one or more Tang servers. This prevents the data from being decrypted unless the nodes are on a secure network where the Tang servers can be accessed. Clevis is an automated decryption framework that is used to implement the decryption on the client side.
The use of the Tang encryption mode to encrypt your disks is only supported for bare metal and vSphere installations on user-provisioned infrastructure. |
On previous versions of Red Hat Enterprise Linux CoreOS (RHCOS), disk encryption was configured by specifying |
When the TPM v2 or Tang encryption modes are enabled, the RHCOS boot disks are encrypted using the LUKS2 format.
This feature:
Is available for installer-provisioned infrastructure and user-provisioned infrastructure deployments
Is supported on Red Hat Enterprise Linux CoreOS (RHCOS) systems only
Sets up disk encryption during the manifest installation phase so all data written to disk, from first boot forward, is encrypted
Requires no user intervention for providing passphrases
Uses AES-256-XTS encryption, or AES-256-CBC if FIPS mode is enabled
In OpenShift Container Platform, you can specify a requirement for more than one Tang server. You can also configure the TPM v2 and Tang encryption modes simultaneously, so that the boot disk data can be decrypted only if the TPM secure cryptoprocessor is present and the Tang servers can be accessed over a secure network.
You can use the threshold
attribute in your Butane configuration to define the minimum number of TPM v2 and Tang encryption conditions that must be met for decryption to occur. The threshold is met when the stated value is reached through any combination of the declared conditions. For example, the threshold
value of 2
in the following configuration can be reached by accessing the two Tang servers, or by accessing the TPM secure cryptoprocessor and one of the Tang servers:
variant: openshift
version: 4.10.0
metadata:
name: worker-storage
labels:
machineconfiguration.openshift.io/role: worker
boot_device:
layout: x86_64
luks:
tpm2: true (1)
tang: (2)
- url: http://tang1.example.com:7500
thumbprint: jwGN5tRFK-kF6pIX89ssF3khxxX
- url: http://tang2.example.com:7500
thumbprint: VCJsvZFjBSIHSldw78rOrq7h2ZF
threshold: 2 (3)
openshift:
fips: true
1 | Include this field if you want to use a Trusted Platform Module (TPM) to encrypt the root file system. |
2 | Include this section if you want to use one or more Tang servers. |
3 | Specify the minimum number of TPM v2 and Tang encryption conditions that must be met for decryption to occur. |
The default |
If you require both TPM v2 and Tang for decryption, the value of the |
During OpenShift Container Platform installation on control plane and worker nodes, you can enable mirroring of the boot and other disks to two or more redundant storage devices. A node continues to function after storage device failure as long as one device remains available.
Mirroring does not support replacement of a failed disk. To restore the mirror to a pristine, non-degraded state, reprovision the node.
Mirroring is available only for user-provisioned infrastructure deployments on RHCOS systems. Mirroring support is available on x86_64 nodes booted with BIOS or UEFI and on ppc64le nodes. |
You can enable and configure encryption and mirroring during an OpenShift Container Platform installation.
You have downloaded the OpenShift Container Platform installation program on your installation node.
You installed Butane on your installation node.
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. For more information, see the Creating machine configs with Butane section. |
You have access to a Red Hat Enterprise Linux (RHEL) 8 machine that can be used to generate a thumbprint of the Tang exchange key.
If you want to use TPM v2 to encrypt your cluster, check to see if TPM v2 encryption needs to be enabled in the BIOS on each node. This is required on most Dell systems. Check the manual for your computer.
If you want to use Tang to encrypt your cluster, follow these preparatory steps:
Set up a Tang server or access an existing one. See Network-bound disk encryption for instructions.
Install the clevis
package on a RHEL 8 machine, if it is not already installed:
$ sudo yum install clevis
On the RHEL 8 machine, run the following command to generate a thumbprint of the exchange key. Replace http://tang.example.com:7500
with the URL of your Tang server:
$ clevis-encrypt-tang '{"url":"http://tang.example.com:7500"}' < /dev/null > /dev/null (1)
1 | In this example, tangd.socket is listening on port 7500 on the Tang server. |
The |
The advertisement contains the following signing keys:
PLjNyRdGw03zlRoGjQYMahSZGu9 (1)
1 | The thumbprint of the exchange key. |
When the Do you wish to trust these keys? [ynYN]
prompt displays, type Y
.
RHEL 8 provides Clevis version 15, which uses the SHA-1 hash algorithm to generate thumbprints. Some other distributions provide Clevis version 17 or later, which use the SHA-256 hash algorithm for thumbprints. You must use a Clevis version that uses SHA-1 to create the thumbprint, to prevent Clevis binding issues when you install Red Hat Enterprise Linux CoreOS (RHCOS) on your OpenShift Container Platform cluster nodes. |
If the nodes are configured with static IP addressing, run coreos-installer iso customize --dest-karg-append
or use the coreos-installer
--append-karg
option when installing RHCOS nodes to set the IP address of the installed system. Append the ip=
and other arguments needed for your network.