Customizing nodes

Although directly making changes to OKD 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 OKD 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 OKD 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.

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.

About Butane

Butane is a command-line utility that OKD 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.

Installing Butane

You can install the Butane tool (butane) to create OKD 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

  1. Navigate to the Butane image download page at https://mirror.openshift.com/pub/openshift-v4/clients/butane/.

  2. Get the butane binary:

    1. For the newest version of Butane, save the latest butane image to your current directory:

      1. $ curl https://mirror.openshift.com/pub/openshift-v4/clients/butane/latest/butane --output butane
    2. Optional: For a specific type of architecture you are installing Butane on, such as aarch64 or ppc64le, indicate the appropriate URL. For example:

      1. $ curl https://mirror.openshift.com/pub/openshift-v4/clients/butane/latest/butane-aarch64 --output butane
  3. Make the downloaded binary file executable:

    1. $ chmod +x butane
  4. Move the butane binary file to a directory on your PATH.

    To check your PATH, open a terminal and execute the following command:

    1. $ echo $PATH

Verification steps

  • You can now use the Butane tool by running the butane command:

    1. $ butane <butane_file>

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 butane utility.

Procedure

  1. 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:

    1. variant: openshift
    2. version: 4.9.0
    3. metadata:
    4. name: 99-worker-custom
    5. labels:
    6. machineconfiguration.openshift.io/role: worker
    7. openshift:
    8. kernel_arguments:
    9. - loglevel=7
    10. storage:
    11. files:
    12. - path: /etc/chrony.conf
    13. mode: 0644
    14. overwrite: true
    15. contents:
    16. inline: |
    17. pool 0.rhel.pool.ntp.org iburst
    18. driftfile /var/lib/chrony/drift
    19. makestep 1.0 3
    20. rtcsync
    21. logdir /var/log/chrony

    The 99-worker-custom.bu file is set to create a machine config for worker nodes. To deploy on control plane nodes, change the role from worker to master. To do both, you could repeat the whole procedure using different file names for the two types of deployments.

  2. Create a MachineConfig object by giving Butane the file that you created in the previous step:

    1. $ butane 99-worker-custom.bu -o ./99-worker-custom.yaml

    A MachineConfig object YAML file is created for you to finish configuring your machines.

  3. Save the Butane config in case you need to update the MachineConfig object in the future.

  4. 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:

    1. $ oc create -f 99-worker-custom.yaml

Additional resources

Adding day-1 kernel arguments

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.

  • 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 OKD installation.

Procedure

  1. Change to the directory that contains the installation program and generate the Kubernetes manifests for the cluster:

    1. $ ./openshift-install create manifests --dir <installation_directory>
  2. Decide if you want to add kernel arguments to worker or control plane nodes.

  3. 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:

    1. $ cat << EOF > 99-openshift-machineconfig-master-kargs.yaml
    2. apiVersion: machineconfiguration.openshift.io/v1
    3. kind: MachineConfig
    4. metadata:
    5. labels:
    6. machineconfiguration.openshift.io/role: master
    7. name: 99-openshift-machineconfig-master-kargs
    8. spec:
    9. kernelArguments:
    10. - loglevel=7
    11. 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.

Adding kernel modules to nodes

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 OKD 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.

Building and testing the kernel module container

Before deploying kernel modules to your OKD 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:

Procedure

  1. Register a RHEL 8 system:

    1. # subscription-manager register
  2. Attach a subscription to the RHEL 8 system:

    1. # subscription-manager attach --auto
  3. Install software that is required to build the software and container:

    1. # yum install podman make git -y
  4. Clone the kmod-via-containers repository:

    1. Create a folder for the repository:

      1. $ mkdir kmods; cd kmods
    2. Clone the repository:

      1. $ git clone https://github.com/kmods-via-containers/kmods-via-containers
  5. 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:

    1. Change to the kmod-via-containers directory:

      1. $ cd kmods-via-containers/
    2. Install the KVC framework instance:

      1. $ sudo make install
    3. Reload the systemd manager configuration:

      1. $ sudo systemctl daemon-reload
  6. 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:

    1. $ cd .. ; git clone https://github.com/kmods-via-containers/kvc-simple-kmod
  7. Edit the configuration file, simple-kmod.conf file, in this example, and change the name of the Dockerfile to Dockerfile.rhel:

    1. Change to the kvc-simple-kmod directory:

      1. $ cd kvc-simple-kmod
    2. Rename the Dockerfile:

      1. $ cat simple-kmod.conf

      Example Dockerfile

      1. KMOD_CONTAINER_BUILD_CONTEXT="https://github.com/kmods-via-containers/kvc-simple-kmod.git"
      2. KMOD_CONTAINER_BUILD_FILE=Dockerfile.rhel
      3. KMOD_SOFTWARE_VERSION=dd1a7d4
      4. KMOD_NAMES="simple-kmod simple-procfs-kmod"
  8. Create an instance of kmods-via-containers@.service for your kernel module, simple-kmod in this example:

    1. $ sudo make install
  9. Enable the kmods-via-containers@.service instance:

    1. $ sudo kmods-via-containers build simple-kmod $(uname -r)
  10. Enable and start the systemd service:

    1. $ sudo systemctl enable kmods-via-containers@simple-kmod.service --now
    1. Review the service status:

      1. $ sudo systemctl status kmods-via-containers@simple-kmod.service

      Example output

      1. kmods-via-containers@simple-kmod.service - Kmods Via Containers - simple-kmod
      2. Loaded: loaded (/etc/systemd/system/kmods-via-containers@.service;
      3. enabled; vendor preset: disabled)
      4. Active: active (exited) since Sun 2020-01-12 23:49:49 EST; 5s ago...
  11. To confirm that the kernel modules are loaded, use the lsmod command to list the modules:

    1. $ lsmod | grep simple_

    Example output

    1. simple_procfs_kmod 16384 0
    2. simple_kmod 16384 0
  12. 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:

      1. $ dmesg | grep 'Hello world'

      Example output

      1. [ 6420.761332] Hello world from simple_kmod.
    • Check the value of simple-procfs-kmod in /proc:

      1. $ sudo cat /proc/simple-procfs-kmod

      Example output

      1. simple-procfs-kmod number = 0
    • Run the spkut command to get more information from the module:

      1. $ sudo spkut 44

      Example output

      1. KVC: wrapper simple-kmod for 4.18.0-147.3.1.el8_1.x86_64
      2. Running userspace wrapper using the kernel module container...
      3. + podman run -i --rm --privileged
      4. simple-kmod-dd1a7d4:4.18.0-147.3.1.el8_1.x86_64 spkut 44
      5. simple-procfs-kmod number = 0
      6. 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.

Provisioning a kernel module to OKD

Depending on whether or not you must have the kernel module in place when OKD 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.

Provision kernel modules via a MachineConfig object

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.

Procedure

  1. Register a RHEL 8 system:

    1. # subscription-manager register
  2. Attach a subscription to the RHEL 8 system:

    1. # subscription-manager attach --auto
  3. Install software needed to build the software:

    1. # yum install podman make git -y
  4. Create a directory to host the kernel module and tooling:

    1. $ mkdir kmods; cd kmods
  5. Get the kmods-via-containers software:

    1. Clone the kmods-via-containers repository:

      1. $ git clone https://github.com/kmods-via-containers/kmods-via-containers
    2. Clone the kvc-simple-kmod repository:

      1. $ git clone https://github.com/kmods-via-containers/kvc-simple-kmod
  6. Get your module software. In this example, kvc-simple-kmod is used.

  7. Create a fakeroot directory and populate it with files that you want to deliver via Ignition, using the repositories cloned earlier:

    1. Create the directory:

      1. $ FAKEROOT=$(mktemp -d)
    2. Change to the kmod-via-containers directory:

      1. $ cd kmods-via-containers
    3. Install the KVC framework instance:

      1. $ make install DESTDIR=${FAKEROOT}/usr/local CONFDIR=${FAKEROOT}/etc/
    4. Change to the kvc-simple-kmod directory:

      1. $ cd ../kvc-simple-kmod
    5. Create the instance:

      1. $ make install DESTDIR=${FAKEROOT}/usr/local CONFDIR=${FAKEROOT}/etc/
  8. Clone the fakeroot directory, replacing any symbolic links with copies of their targets, by running the following command:

    1. $ cd .. && rm -rf kmod-tree && cp -Lpr ${FAKEROOT} kmod-tree
  9. 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.

    1. variant: openshift
    2. version: 4.9.0
    3. metadata:
    4. name: 99-simple-kmod
    5. labels:
    6. machineconfiguration.openshift.io/role: worker (1)
    7. storage:
    8. trees:
    9. - local: kmod-tree
    10. systemd:
    11. units:
    12. - name: kmods-via-containers@simple-kmod.service
    13. enabled: true
    1To 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.
  10. Use Butane to generate a machine config YAML file, 99-simple-kmod.yaml, containing the files and configuration to be delivered:

    1. $ butane 99-simple-kmod.bu --files-dir . -o 99-simple-kmod.yaml
  11. 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:

    1. $ 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.

  12. 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:

    1. $ lsmod | grep simple_

    Example output

    1. simple_procfs_kmod 16384 0
    2. simple_kmod 16384 0

Encrypting and mirroring disks during installation

During an OKD installation, you can enable boot disk encryption and mirroring on the cluster nodes.

About disk encryption

You can enable encryption for the boot disks on the control plane and compute nodes at installation time. OKD 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 Fedora CoreOS (FCOS), disk encryption was configured by specifying /etc/clevis.json in the Ignition config. That file is not supported in clusters created with OKD 4.7 or above, and disk encryption should be configured by using the following procedure.

When the TPM v2 or Tang encryption modes are enabled, the FCOS boot disks are encrypted using the LUKS2 format.

This feature:

  • Is available for installer-provisioned infrastructure and user-provisioned infrastructure deployments

  • Is supported on Fedora CoreOS (FCOS) 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

Configuring an encryption threshold

In OKD, 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:

Example Butane configuration for disk encryption

  1. variant: openshift
  2. version: 4.9.0
  3. metadata:
  4. name: worker-storage
  5. labels:
  6. machineconfiguration.openshift.io/role: worker
  7. boot_device:
  8. layout: x86_64
  9. luks:
  10. tpm2: true (1)
  11. tang: (2)
  12. - url: http://tang1.example.com:7500
  13. thumbprint: jwGN5tRFK-kF6pIX89ssF3khxxX
  14. - url: http://tang2.example.com:7500
  15. thumbprint: VCJsvZFjBSIHSldw78rOrq7h2ZF
  16. threshold: 2 (3)
  17. openshift:
  18. fips: true
1Include this field if you want to use a Trusted Platform Module (TPM) to encrypt the root file system.
2Include this section if you want to use one or more Tang servers.
3Specify the minimum number of TPM v2 and Tang encryption conditions that must be met for decryption to occur.

The default threshold value is 1. If you include multiple encryption conditions in your configuration but do not specify a threshold, decryption can occur if any of the conditions are met.

If you require both TPM v2 and Tang for decryption, the value of the threshold attribute must equal the total number of stated Tang servers plus one. If the threshold value is lower, it is possible for the threshold to be reached by using one of the encryption modes only. For example, if tpm2 is set to true and you specify two Tang servers, a threshold of 2 can be met by accessing the two Tang servers even if the TPM secure cryptoprocessor is not available.

About disk mirroring

During OKD 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.

During OKD installation on control plane and compute nodes, you can enable mirroring of the boot disk 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 FCOS systems. Mirroring support is available on x86_64 nodes booted with BIOS or UEFI and on ppc64le nodes.

Configuring disk encryption and mirroring

You can enable and configure encryption and mirroring during an OKD installation.

Prerequisites

  • You have downloaded the OKD installation program on your installation node.

  • You installed Butane on your installation node.

    Butane is a command-line utility that OKD 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 Fedora 8 machine that can be used to generate a thumbprint of the Tang exchange key.

Procedure

  1. 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.

  2. If you want to use Tang to encrypt your cluster, follow these preparatory steps:

    1. Set up a Tang server or access an existing one. See Network-bound disk encryption for instructions.

    2. Install the clevis package on a Fedora 8 machine, if it is not already installed:

      1. $ sudo yum install clevis
    3. On the Fedora 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:

      1. $ clevis-encrypt-tang '{"url":"http://tang.example.com:7500"}' < /dev/null > /dev/null (1)
      1In this example, tangd.socket is listening on port 7500 on the Tang server.

      The clevis-encrypt-tang command is used in this step only to generate a thumbprint of the exchange key. No data is being passed to the command for encryption at this point, so /dev/null is provided as an input instead of plain text. The encrypted output is also sent to /dev/null, because it is not required for this procedure.

      Example output

      1. The advertisement contains the following signing keys:
      2. PLjNyRdGw03zlRoGjQYMahSZGu9 (1)
      1The thumbprint of the exchange key.

      When the Do you wish to trust these keys? [ynYN] prompt displays, type Y.

      Fedora 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 Fedora CoreOS (FCOS) on your OKD cluster nodes.

    4. If the nodes are configured with static IP addressing, use the coreos-installer --append-karg option when installing FCOS nodes to set the IP address of the installed system. Append the ip= and other arguments needed for your network.

      Some methods for configuring static IPs do not affect the initramfs after the first boot and will not work with Tang encryption. These include the coreos-installer —copy-network option, as well as adding ip= arguments to the kernel command line of the live ISO or PXE image during installation. Incorrect static IP configuration causes the second boot of the node to fail.

  3. On your installation node, change to the directory that contains the installation program and generate the Kubernetes manifests for the cluster:

    1. $ ./openshift-install create manifests --dir <installation_directory> (1)
    1Replace <installation_directory> with the path to the directory that you want to store the installation files in.
  4. Create a Butane config that configures disk encryption, mirroring, or both. For example, to configure storage for compute nodes, create a $HOME/clusterconfig/worker-storage.bu file.

    Butane config example for a boot device

    1. variant: openshift
    2. version: 4.9.0
    3. metadata:
    4. name: worker-storage (1)
    5. labels:
    6. machineconfiguration.openshift.io/role: worker (1)
    7. boot_device:
    8. layout: x86_64 (2)
    9. luks: (3)
    10. tpm2: true (4)
    11. tang: (5)
    12. - url: http://tang.example.com:7500 (6)
    13. thumbprint: PLjNyRdGw03zlRoGjQYMahSZGu9 (7)
    14. threshold: 1 (8)
    15. mirror: (9)
    16. devices: (10)
    17. - /dev/sda
    18. - /dev/sdb
    19. openshift:
    20. fips: true (11)
    1For control plane configurations, replace worker with master in both of these locations.
    2On ppc64le nodes, set this field to ppc64le. On all other nodes, this field can be omitted.
    3Include this section if you want to encrypt the root file system. For more details, see the About disk encryption section.
    4Include this field if you want to use a Trusted Platform Module (TPM) to encrypt the root file system.
    5Include this section if you want to use one or more Tang servers.
    6Specify the URL of a Tang server. In this example, tangd.socket is listening on port 7500 on the Tang server.
    7Specify the exchange key thumbprint, which was generated in a preceding step.
    8Specify the minimum number of TPM v2 and Tang encryption conditions that must be met for decryption to occur. The default value is 1. For more information on this topic, see the Configuring an encryption threshold section.
    9Include this section if you want to mirror the boot disk. For more details, see About disk mirroring.
    10List all disk devices that should be included in the boot disk mirror, including the disk that FCOS will be installed onto.
    11Include this directive to enable FIPS mode on your cluster.

    If you are configuring nodes to use both disk encryption and mirroring, both features must be configured in the same Butane config. In addition, if you are configuring disk encryption on a node with FIPS mode enabled, you must include the fips directive in the same Butane config, even if FIPS mode is also enabled in a separate manifest.

  5. Create a control plane or compute node manifest from the corresponding Butane config and save it to the <installation_directory>/openshift directory. For example, to create a manifest for the compute nodes, run the following command:

    1. $ butane $HOME/clusterconfig/worker-storage.bu -o <installation_directory>/openshift/99-worker-storage.yaml

    Repeat this step for each node type that requires disk encryption or mirroring.

  6. Save the Butane configs in case you need to update the manifests in the future.

  7. Continue with the remainder of the OKD installation.

    You can monitor the console log on the FCOS nodes during installation for error messages relating to disk encryption or mirroring.

    If you configure additional data partitions, they will not be encrypted unless encryption is explicitly requested.

Verification

After installing OKD, you can verify if boot disk encryption or mirroring is enabled on the cluster nodes.

  1. From the installation host, access a cluster node by using a debug pod:

    1. Start a debug pod for the node. The following example starts a debug pod for the compute-1 node:

      1. $ oc debug node/compute-1
    2. Set /host as the root directory within the debug shell. The debug pod mounts the root file system of the node in /host within the pod. By changing the root directory to /host, you can run binaries contained in the executable paths on the node:

      1. # chroot /host

      OKD cluster nodes running Fedora CoreOS (FCOS) are immutable and rely on Operators to apply cluster changes. Accessing cluster nodes using SSH is not recommended. However, if the OKD API is not available, or kubelet is not properly functioning on the target node, oc operations will be impacted. In such situations, it is possible to access nodes using ssh core@<node>.<cluster_name>.<base_domain> instead.

  2. If you configured boot disk encryption, verify if it is enabled:

    1. From the debug shell, review the status of the root mapping on the node:

      1. # cryptsetup status root

      Example output

      1. /dev/mapper/root is active and is in use.
      2. type: LUKS2 (1)
      3. cipher: aes-xts-plain64 (2)
      4. keysize: 512 bits
      5. key location: keyring
      6. device: /dev/sda4 (3)
      7. sector size: 512
      8. offset: 32768 sectors
      9. size: 15683456 sectors
      10. mode: read/write
      1The encryption format. When the TPM v2 or Tang encryption modes are enabled, the FCOS boot disks are encrypted using the LUKS2 format.
      2The encryption algorithm used to encrypt the LUKS2 volume. The aes-cbc-essiv:sha256 cipher is used if FIPS mode is enabled.
      3The device that contains the encrypted LUKS2 volume. If mirroring is enabled, the value will represent a software mirror device, for example /dev/md126.
    2. List the Clevis plug-ins that are bound to the encrypted device:

      1. # clevis luks list -d /dev/sda4 (1)
      1Specify the device that is listed in the device field in the output of the preceding step.

      Example output

      1. 1: sss '{"t":1,"pins":{"tang":[{"url":"http://tang.example.com:7500"}]}}' (1)
      1In the example output, the Tang plug-in is used by the Shamir’s Secret Sharing (SSS) Clevis plug-in for the /dev/sda4 device.
  3. If you configured mirroring, verify if it is enabled:

    1. From the debug shell, list the software RAID devices on the node:

      1. # cat /proc/mdstat

      Example output

      1. Personalities : [raid1]
      2. md126 : active raid1 sdb3[1] sda3[0] (1)
      3. 393152 blocks super 1.0 [2/2] [UU]
      4. md127 : active raid1 sda4[0] sdb4[1] (2)
      5. 51869632 blocks super 1.2 [2/2] [UU]
      6. unused devices: <none>
      1In the example, the /dev/md126 software RAID mirror device uses the /dev/sda3 and /dev/sdb3 disk devices on the cluster node.
      2In the example, the /dev/md127 software RAID mirror device uses the /dev/sda4 and /dev/sdb4 disk devices on the cluster node.
    2. Review the details of each of the software RAID devices listed in the output of the preceding command. The following example lists the details of the /dev/md126 device:

      1. # mdadm --detail /dev/md126

      Example output

      1. /dev/md126:
      2. Version : 1.0
      3. Creation Time : Wed Jul 7 11:07:36 2021
      4. Raid Level : raid1 (1)
      5. Array Size : 393152 (383.94 MiB 402.59 MB)
      6. Used Dev Size : 393152 (383.94 MiB 402.59 MB)
      7. Raid Devices : 2
      8. Total Devices : 2
      9. Persistence : Superblock is persistent
      10. Update Time : Wed Jul 7 11:18:24 2021
      11. State : clean (2)
      12. Active Devices : 2 (3)
      13. Working Devices : 2 (3)
      14. Failed Devices : 0 (4)
      15. Spare Devices : 0
      16. Consistency Policy : resync
      17. Name : any:md-boot (5)
      18. UUID : ccfa3801:c520e0b5:2bee2755:69043055
      19. Events : 19
      20. Number Major Minor RaidDevice State
      21. 0 252 3 0 active sync /dev/sda3 (6)
      22. 1 252 19 1 active sync /dev/sdb3 (6)
      1Specifies the RAID level of the device. raid1 indicates RAID 1 disk mirroring.
      2Specifies the state of the RAID device.
      3States the number of underlying disk devices that are active and working.
      4States the number of underlying disk devices that are in a failed state.
      5The name of the software RAID device.
      6Provides information about the underlying disk devices that are used by the software RAID device.
    3. List the file systems that are mounted on the software RAID devices:

      1. # mount | grep /dev/md

      Example output

      1. /dev/md127 on / type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      2. /dev/md127 on /etc type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      3. /dev/md127 on /usr type xfs (ro,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      4. /dev/md127 on /sysroot type xfs (ro,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      5. /dev/md127 on /var type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      6. /dev/md127 on /var/lib/containers/storage/overlay type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      7. /dev/md127 on /var/lib/kubelet/pods/e5054ed5-f882-4d14-b599-99c050d4e0c0/volume-subpaths/etc/tuned/1 type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      8. /dev/md127 on /var/lib/kubelet/pods/e5054ed5-f882-4d14-b599-99c050d4e0c0/volume-subpaths/etc/tuned/2 type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      9. /dev/md127 on /var/lib/kubelet/pods/e5054ed5-f882-4d14-b599-99c050d4e0c0/volume-subpaths/etc/tuned/3 type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      10. /dev/md127 on /var/lib/kubelet/pods/e5054ed5-f882-4d14-b599-99c050d4e0c0/volume-subpaths/etc/tuned/4 type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      11. /dev/md127 on /var/lib/kubelet/pods/e5054ed5-f882-4d14-b599-99c050d4e0c0/volume-subpaths/etc/tuned/5 type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,prjquota)
      12. /dev/md126 on /boot type ext4 (rw,relatime,seclabel)

      In the example output, the /boot file system is mounted on the /dev/md126 software RAID device and the root file system is mounted on /dev/md127.

  4. Repeat the verification steps for each OKD node type.

Additional resources

Configuring a RAID-enabled data volume

You can enable software RAID partitioning to provide an external data volume. OKD supports RAID 0, RAID 1, RAID 4, RAID 5, RAID 6, and RAID 10 for data protection and fault tolerance. See “About disk mirroring” for more details.

  1. Create a Butane config that configures a data volume by using software RAID.

    • To configure a data volume with RAID 1 on the same disks that are used for a mirrored boot disk, create a $HOME/clusterconfig/raid1-storage.bu file, for example:

      RAID 1 on mirrored boot disk

      1. variant: openshift
      2. version: 4.9.0
      3. metadata:
      4. name: raid1-storage
      5. labels:
      6. machineconfiguration.openshift.io/role: worker
      7. boot_device:
      8. mirror:
      9. devices:
      10. - /dev/sda
      11. - /dev/sdb
      12. storage:
      13. disks:
      14. - device: /dev/sda
      15. partitions:
      16. - label: root-1
      17. size_mib: 25000 (1)
      18. - label: var-1
      19. - device: /dev/sdb
      20. partitions:
      21. - label: root-2
      22. size_mib: 25000 (1)
      23. - label: var-2
      24. raid:
      25. - name: md-var
      26. level: raid1
      27. devices:
      28. - /dev/disk/by-partlabel/var-1
      29. - /dev/disk/by-partlabel/var-2
      30. filesystems:
      31. - device: /dev/md/md-var
      32. path: /var
      33. format: xfs
      34. wipe_filesystem: true
      35. with_mount_unit: true
      1When adding a data partition to the boot disk, a minimum value of 25000 mebibytes is recommended. If no value is specified, or if the specified value is smaller than the recommended minimum, the resulting root file system will be too small, and future reinstalls of FCOS might overwrite the beginning of the data partition.
    • To configure a data volume with RAID 1 on secondary disks, create a $HOME/clusterconfig/raid1-alt-storage.bu file, for example:

      RAID 1 on secondary disks

      1. variant: openshift
      2. version: 4.9.0
      3. metadata:
      4. name: raid1-alt-storage
      5. labels:
      6. machineconfiguration.openshift.io/role: worker
      7. storage:
      8. disks:
      9. - device: /dev/sdc
      10. wipe_table: true
      11. partitions:
      12. - label: data-1
      13. - device: /dev/sdd
      14. wipe_table: true
      15. partitions:
      16. - label: data-2
      17. raid:
      18. - name: md-var-lib-containers
      19. level: raid1
      20. devices:
      21. - /dev/disk/by-partlabel/data-1
      22. - /dev/disk/by-partlabel/data-2
      23. filesystems:
      24. - device: /dev/md/md-var-lib-containers
      25. path: /var/lib/containers
      26. format: xfs
      27. wipe_filesystem: true
      28. with_mount_unit: true
  2. Run Butane to create a RAID manifest from the Butane config you created in the previous step, for example:

    1. $ butane $HOME/clusterconfig/<butane_file> -o ./<manifest_name>.yaml (1)
    1Replace <butane_file> and <manifest_name> with the file names from the previous step. For example, raid1-alt-storage.bu and raid1-alt-storage.yaml for secondary disks.
  3. Apply the manifest to your cluster by running the following command:

    1. $ oc create -f <manifest_name>.yaml
  4. Save the Butane config in case you need to update the manifest in the future.

Configuring chrony time service

You can set the time server and related settings used by the chrony time service (chronyd) by modifying the contents of the chrony.conf file and passing those contents to your nodes as a machine config.

Procedure

  1. Create a Butane config including the contents of the chrony.conf file. For example, to configure chrony on worker nodes, create a 99-worker-chrony.bu file.

    See “Creating machine configs with Butane” for information about Butane.

    1. variant: openshift
    2. version: 4.9.0
    3. metadata:
    4. name: 99-worker-chrony (1)
    5. labels:
    6. machineconfiguration.openshift.io/role: worker (1)
    7. storage:
    8. files:
    9. - path: /etc/chrony.conf
    10. mode: 0644
    11. overwrite: true
    12. contents:
    13. inline: |
    14. pool 0.rhel.pool.ntp.org iburst (2)
    15. driftfile /var/lib/chrony/drift
    16. makestep 1.0 3
    17. rtcsync
    18. logdir /var/log/chrony
    1On control plane nodes, substitute master for worker in both of these locations.
    2Specify any valid, reachable time source, such as the one provided by your DHCP server. Alternately, you can specify any of the following NTP servers: 1.rhel.pool.ntp.org, 2.rhel.pool.ntp.org, or 3.rhel.pool.ntp.org.
  2. Use Butane to generate a MachineConfig object file, 99-worker-chrony.yaml, containing the configuration to be delivered to the nodes:

    1. $ butane 99-worker-chrony.bu -o 99-worker-chrony.yaml
  3. Apply the configurations in one of two ways:

    • If the cluster is not running yet, after you generate manifest files, add the MachineConfig object file to the <installation_directory>/openshift directory, and then continue to create the cluster.

    • If the cluster is already running, apply the file:

      1. $ oc apply -f ./99-worker-chrony.yaml

Additional resources