Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

explicitly set 'runtime_type' in containerd config#1214

Merged
jepio merged 1 commit intomainfrom
jepio/containerd-config-fix
Aug 24, 2021
Merged

explicitly set 'runtime_type' in containerd config#1214
jepio merged 1 commit intomainfrom
jepio/containerd-config-fix

Conversation

@jepio
Copy link
Copy Markdown
Contributor

@jepio jepio commented Aug 23, 2021

explicitly set 'runtime_type' in containerd config

The way the SystemdCgroup parameter was being set resulted in 'runtime_type' being unset, which prevents containerd from being used as the kubelet container runtime. Explicitly set in 'runtime_type' to fix the issue.

Fixes flatcar/Flatcar#484

How to use

Rebuild image and deploy kubernetes with containerd as the runtime.

Testing done

CI pending

…being unset

The containerd config works in mysterious ways - sometimes it acts hierarchical
with respect to the section headers, other times not. In this case, setting
runc.options resets all the fields of the runc section, including
'runtime_type'. Having an unset runtime_type causes containerd to fail to spawn
containers (but the daemon itself starts succesfully) returning the error:

    kubelet[13148]: E0823 11:57:17.030551   13148 remote_runtime.go:116] "RunPodSandbox from runtime service failed" err="rpc error: code = InvalidArgument desc = failed to create containerd container: create container failed validation: container.Runtime.Name must be set: invalid argument"

Explicitly set the runtime_type in all containerd configs, and bump the config
version to 2.

Reported as flatcar/Flatcar#484

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
@jepio jepio requested a review from a team August 23, 2021 16:51
@tormath1
Copy link
Copy Markdown
Contributor

@jepio reading the containerd config; there is no risk to have other unset options ? :)

@jepio
Copy link
Copy Markdown
Contributor Author

jepio commented Aug 24, 2021

I checked two things:

$ containerd -c before.toml config dump >a
$ containerd -c after.toml config dump >b
$ diff -up a b
--- a   2021-08-24 07:52:17.000000000 +0000
+++ b   2021-08-24 07:52:13.000000000 +0000
@@ -1,5 +1,5 @@
 disabled_plugins = []
-imports = ["before.toml"]
+imports = ["after.toml"]
 oom_score = -999
 plugin_dir = ""
 required_plugins = []
@@ -99,17 +99,7 @@ version = 2
           runtime_type = "io.containerd.runc.v2"

           [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
-            BinaryName = ""
-            CriuImagePath = ""
-            CriuPath = ""
-            CriuWorkPath = ""
-            IoGid = 0
-            IoUid = 0
-            NoNewKeyring = false
-            NoPivotRoot = false
-            Root = ""
-            ShimCgroup = ""
-            SystemdCgroup = false
+            SystemdCgroup = true

       [plugins."io.containerd.grpc.v1.cri".containerd.untrusted_workload_runtime]
         base_runtime_spec = ""

So the other fields have default zero values that will be kept.
Kops uses the same configuration for SystemdCgroup: https://github.com/kubernetes/kops/blob/master/nodeup/pkg/model/containerd.go#L433-L462

@jepio
Copy link
Copy Markdown
Contributor Author

jepio commented Aug 24, 2021

@jepio jepio merged commit 5a2e727 into main Aug 24, 2021
@jepio jepio deleted the jepio/containerd-config-fix branch August 24, 2021 08:33
jepio added a commit that referenced this pull request Aug 24, 2021
explicitly set 'runtime_type' in containerd config

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cilium pod hangs on alpha-2969.0.0-hvm

3 participants