Skip to content

Instantly share code, notes, and snippets.

@janakiramm
Created November 6, 2021 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janakiramm/27d9dcd083ce94cd9018713c49851b0c to your computer and use it in GitHub Desktop.
Save janakiramm/27d9dcd083ce94cd9018713c49851b0c to your computer and use it in GitHub Desktop.
if grep -q 'data-dir' /etc/rancher/rke2/config.yaml; then
DATA_DIR=$(grep 'data-dir' /etc/rancher/rke2/config.yaml | awk '{print $2}')
else
DATA_DIR=/var/lib/rancher/rke2
fi
CONTAINERD_CONFIG=$DATA_DIR/agent/etc/containerd/config.toml.tmpl
cat <<EOF | sudo tee $CONTAINERD_CONFIG
version = 2
[plugins]
[plugins."io.containerd.grpc.v1.cri"]
enable_selinux = false
sandbox_image = "index.docker.io/rancher/pause:3.2"
stream_server_address = "127.0.0.1"
stream_server_port = "10010"
[plugins."io.containerd.grpc.v1.cri".containerd]
disable_snapshot_annotations = true
snapshotter = "overlayfs"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
runtime_type = "io.containerd.runc.v2"
[plugins."io.containerd.internal.v1.opt"]
path = "/data/rancher/rke2/agent/containerd"
EOF
CONTAINERD_SOCKET=/run/k3s/containerd/containerd.sock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment