<button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">Version 1.8 (unsupported)</button>

- [Latest](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/latest/installing/runtime)
- [Version 1.16](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/1.16/installing/runtime.md.txt)
- [Earlier versions (unsupported)](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/1.8/getting-support.md.txt#version-support)

<br />

Google Distributed Cloud adds the optional `containerRuntime` configuration field to the
cluster configuration file. Use this field to configure the
container runtime that cluster nodes use to schedule containers for Kubernetes
pods.

You can have `kubelet` call the
[Container Runtime Interface](https://kubernetes.io/blog/2016/12/container-runtime-interface-cri-in-kubernetes/)
directly. This option allows you to decouple `kubelet` from Docker by removing
the need for the Docker daemon.

This change is needed due to Kubernetes' goals to deprecate the use of the
Docker daemon and make containerd the default. Kubernetes plans to send warnings
starting with Kubernetes version 1.20 and finalize the deprecation by
version 1.24.This change aligns with the planned change to make containerd the
default for GKE.

In Google Distributed Cloud, you can configure `kubelet` to use Docker or
`containerd` through the new `containerRuntime` field.

## Before you begin

- Identify what container runtime you want your clusters to use. You can only
  change the value of the container runtime field when upgrading or installing
  a cluster.

- Ensure your deployment supports `containerd` version 1.4.6 or later.
  Google Distributed Cloud installs this version over any previously installed
  version of `containerd`.

- Ensure Google Distributed Cloud can install the following files which are
  installed for both runtimes:

  - Binary files

    - `/usr/bin/containerd`
    - `/usr/bin/containerd-shim`
    - `/usr/bin/containerd-shim-runc-v1`
    - `/usr/bin/containerd-shim-runc-v2`
    - `/usr/bin/crictl`
    - `/usr/bin/ctr`
    - `/usr/local/sbin/runc`
  - Configuration files

    - `/etc/crictl.yaml`
    - `/etc/systemd/system/containerd.service`
    - `/etc/containerd/config.toml`
    - `/etc/containerd/certs.d/`
    - `/etc/systemd/system/containerd.service.d/09-proxy.conf` This file is only installed if you configure an HTTP proxy.
- Ensure Google Distributed Cloud can install the following certificates on
  your nodes depending on your chosen runtime:

  - For Docker: `/etc/docker/certs.d/`
  - For `containerd`:
    - `/etc/docker/certs.d/`
    - `/etc/containerd/certs.d/`

## Configure the container runtime for a new cluster

To set your container runtime for a new cluster, set the `containerRuntime`
field in the `nodeConfig` section under `spec` in your cluster configuration
file. Google Distributed Cloud supports the following values:

- `docker`
- `containerd`

If the field is empty or not set, Google Distributed Cloud uses `docker` by
default.
To use `containerd`, the entry in your configuration should look similar to the
following example:

```yaml
apiVersion: baremetal.cluster.gke.io/v1
kind: Cluster
metadata:
  name: cluster1
  namespace: cluster-cluster1
spec:
  nodeConfig:
    containerRuntime: containerd
```

## Configure the container runtime when upgrading a cluster

You can configure Google Distributed Cloud to use a different container runtime
when you upgrade. You can only change the value of the container runtime field
when upgrading or installing a cluster.

> [!NOTE]
> **Note:** Cluster upgrades to 1.8.0 are blocked for 1.7.x clusters that are configured to use the preview containerd capability. For more information, see [Upgrading 1.7.x clusters that use the containerd](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/1.8/troubleshooting/known-issues.md.txt#containerd-upgrade).

### Requirements

- Upgrade admin clusters before user clusters
- Set the value of the `containerRuntime` field in your configuration file before upgrading your clusters.

### Change the runtime to containerd

To set your container runtime during an upgrade, set the `containerRuntime`
field in the `nodeConfig` section under `spec` in your cluster configuration
file. Google Distributed Cloud supports the following values:

- `docker`
- `containerd`

To use `containerd`, change your configuration file to look like the following
example:

```yaml
apiVersion: baremetal.cluster.gke.io/v1
kind: Cluster
metadata:
  name: cluster1
  namespace: cluster-cluster1
spec:
  nodeConfig:
    containerRuntime: containerd
```

To set the container runtime of the cluster nodes to `containerd` as part of
their upgrade, run the following command to upgrade your clusters:

```bash
bmctl upgrade cluster
```

### Updating your clusters with containerd set as the runtime

If you set the container runtime to `containerd`, the following command updates
the image registry certificates in `/etc/containerd/certs.d/`

```bash
bmctl update cluster
```

### Resetting your clusters with containerd set as the runtime

If you set the container runtime to `containerd`, the following command doesn't
delete configurations, binary files, or directories:

```bash
bmctl reset cluster
```

During reset the containerd service continues to run, but the containers that
Kubernetes scheduled are stopped and removed from the containerd runtime.

Delete the following binary files and directories to complete the reset:

- `/etc/crictl.yaml`
- `/etc/systemd/system/containerd.service`
- `/etc/systemd/system/containerd.service.d/`
- `/etc/containerd/config.toml`
- `/etc/containerd/certs.d/`

### Check the status of the containerd runtime

To check the status of the `containerd` as part of the machine health check,
run the following command:

```bash
systemctl status containerd
```