4.3. Configuring the container runtime


You can configure the container runtime used with new workloads on your nodes, based on which runtime you or your organization prefers. You can use either crun, which is considered a faster and more lightweight runtime, or runc, which is more widely used than crun.

For information on crun and runc, see "About the container engine and container runtime".

Starting in OpenShift Container Platform 4.18, crun is the default container runtime for new installations. You can change between the runtimes by using a ContainerRuntimeConfig object, as described in the following procedure. Changing the container runtime affects new workloads only. Existing workloads continue to use their existing container runtime.

If you updated your cluster from OpenShift Container Platform 4.17, the runc container runtime remains unchanged as the default. During the upgrade, two MachineConfig objects, one for the control plane nodes and one for the worker nodes, were created to override the new default runtime. You can migrate the container runtime to crun, on a schedule of your choosing, by removing either or both of the MachineConfig objects.

Procedure

  • If your cluster is updated from OpenShift Container Platform 4.17, you can use the crun container runtime by deleting the following MachineConfig objects:

    • Migrate your worker nodes to crun by running the following command:

      $ oc delete machineconfig 00-override-worker-generated-crio-default-container-runtime
    • Migrate your control plane nodes to crun by running the following command:

      $ oc delete machineconfig 00-override-master-generated-crio-default-container-runtime
  • For any OpenShift Container Platform 4.18 or greater cluster, you can configure crun or runc as the container runtime for specific nodes by creating a container runtime configuration:

    1. Create a YAML file for the ContainerRuntimeConfig CR:

      apiVersion: machineconfiguration.openshift.io/v1
      kind: ContainerRuntimeConfig
      metadata:
       name: configure-runc
      spec:
       machineConfigPoolSelector:
         matchLabels:
           pools.operator.machineconfiguration.openshift.io/worker: ''
       containerRuntimeConfig:
         defaultRuntime: "runc"

      where:

      • spec.machineConfigPoolSelector.matchLabels:: Specifies a label for the machine config pool that you want you want to modify.
      • spec.containerRuntimeConfig.defaultRuntime:: Specifies the container runtime to use with new workloads on the nodes in the specified machine config pool, either crun or runc.
    2. Create the ContainerRuntimeConfig CR:

      $ oc create -f <file_name>.yaml

Verification

  1. After the nodes return to a ready state, open an oc debug session to a node by running the following command:

    $ oc debug node/<node_name>
  2. Set /host as the root directory within the debug shell by running the following command:

    sh-5.1# chroot /host
  3. Check the container runtime by using the following command:

    sh-5.1# crio status config | grep default_runtime

    Example output

    INFO[2026-01-27 23:09:18.413462914Z] Starting CRI-O, version: 1.30.14-6.rhaos4.17.gitfa27f6f.el9, git: unknown(clean)
        default_runtime = "runc"

    The default_runtime parameter specifies the container runtime that OpenShift Container Platform uses for new workloads on this node, either crun or runc, depending on what you have configured.

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部