Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure crio to use kube reserved cgroup #11028

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

pedro-peter
Copy link
Contributor

@pedro-peter pedro-peter commented Mar 23, 2024

What type of PR is this?
/kind bug

What this PR does / why we need it:
Fix for #11027

I think enabling this feature was missed when support for crio was added.

It's enabled for docker using the docker systemd unit file:
https://github.com/kubernetes-sigs/kubespray/blob/master/roles/container-engine/docker/templates/docker.service.j2#L46

there is no ansible j2 template file for the crio systemd unit file as it's currently copied from the crio binary file to the host:
https://github.com/kubernetes-sigs/kubespray/blob/master/roles/container-engine/cri-o/tasks/main.yaml#L88

the best approach in this case seems to be to add a seperate 00-slice.conf file.

with this fix in place, crio will run the correct systemd cgroup slice.

Before:

systemctl status crio.service
● crio.service - Container Runtime Interface for OCI (CRI-O)
   Loaded: loaded (/etc/systemd/system/crio.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2024-03-12 10:06:49 PDT; 2 days ago
     Docs: https://github.com/cri-o/cri-o
 Main PID: 2402291 (crio)
    Tasks: 12
   Memory: 86.6M
   CGroup: /system.slice/crio.service <--------- still on system.slice
           └─2402291 /usr/local/bin/crio

After:

systemctl status crio.service
Redirecting to /bin/systemctl status crio.service
● crio.service - Container Runtime Interface for OCI (CRI-O)
   Loaded: loaded (/etc/systemd/system/crio.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/crio.service.d
           └─00-slice.conf
   Active: active (running) since Fri 2024-03-22 08:38:25 PDT; 21h ago
     Docs: https://github.com/cri-o/cri-o
 Main PID: 1389453 (crio)
    Tasks: 19
   Memory: 535.6M
   CGroup: /kube.slice/crio.service
           └─1389453 /usr/local/bin/crio

the kubelet errors:

Mar 15 02:28:37 worker01.mycluster.net kubelet[2421710]: E0315 02:28:37.703623 2421710 summary_sys_containers.go:48] "Failed to get system container stats" err="failed to get cgroup stats for \"/kube.slice/crio.service\": failed to get container info for \"/kube.slice/crio.service\": unknown container \"/kube.slice/crio.service\"" containerName="/kube.slice/crio.service"
Mar 15 02:28:45 worker01.mycluster.net kubelet[2421710]: E0315 02:28:45.000770 2421710 summary_sys_containers.go:83] "Failed to get system container stats" err="failed to get cgroup stats for \"/kube.slice/crio.service\": failed to get container info for \"/kube.slice/crio.service\": unknown container \"/kube.slice/crio.service\"" containerName="/kube.slice/crio.service"
Mar 15 02:28:47 worker01.mycluster.net kubelet[2421710]: E0315 02:28:47.717431 2421710 summary_sys_containers.go:48] "Failed to get system container stats" err="failed to get cgroup stats for \"/kube.slice/crio.service\": failed to get container info for \"/kube.slice/crio.service\": unknown container \"/kube.slice/crio.service\"" containerName="/kube.slice/crio.service"

also stop appearing in the logs once crio is restarted with this fix in place.

note: the fix only takes effect when the crio service is restarted. it may not take effect during cluster upgrades unless crio is upgraded (which triggers a crio restart)

Which issue(s) this PR fixes:

Fixes #11027

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

configure crio container runtime to use kube reserved cgroup

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 23, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @pedro-peter. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 23, 2024
@yankay
Copy link
Member

yankay commented Mar 28, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 28, 2024
Copy link
Contributor

@VannTen VannTen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me !
/lgtm

Comment on lines +104 to +105
- kube_reserved is defined and kube_reserved is true
- kube_reserved_cgroups_for_service_slice is defined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like this is defined dance when we have role defaults, but given how our roles are layed out right now there is no way around it for now, unfortunately.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 29, 2024
@VannTen
Copy link
Contributor

VannTen commented Mar 29, 2024

note: the fix only takes effect when the crio service is restarted. it may not take effect during cluster upgrades unless crio is upgraded (which triggers a crio restart)

Since you notify the handler "Restart crio", that should not be a problem, it should be restarted if the task added the override.

@yankay
Copy link
Member

yankay commented Apr 1, 2024

Thanks @pedro-peter
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pedro-peter, yankay

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 1, 2024
@k8s-ci-robot k8s-ci-robot merged commit 9ef6678 into kubernetes-sigs:master Apr 1, 2024
60 checks passed
dabeck pushed a commit to fino-digital/kubespray that referenced this pull request May 7, 2024
pedro-peter added a commit to pedro-peter/kubespray that referenced this pull request May 8, 2024
Rickkwa pushed a commit to Rickkwa/kubespray that referenced this pull request Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
4 participants