rancher: [BUG] Upgrade 1.29 to 1.30 failed due to cillium nsenter error

Rancher Server Setup

  • Rancher version: 2.9.0
  • Installation option (Docker install/Helm Chart): helm chart
    • If Helm Chart, Kubernetes Cluster and version (RKE1, RKE2, k3s, EKS, etc): RKE2
  • Proxy/Cert Details: N/A

Information about the Cluster

  • Kubernetes version: 1.30.2
  • Cluster Type (Local/Downstream): Downstream
    • If downstream, what type of cluster? (Custom/Imported or specify provider for Hosted/Infrastructure Provider): Custom (Debian 12) ; deployed via curl

User Information

  • What is the role of the user logged in? (Admin/Cluster Owner/Cluster Member/Project Owner/Project Member/Custom)
    • If custom, define the set of permissions: Admin

Describe the bug I started to upgrade downstream cluster … it finished with fully healthy cluster but nothing worked… Issue which I found was that CNI doesn’t work … Error is:

kube-system/cilium-54vc9:mount-cgroup
│ nsenter: cannot open /hostproc/1/ns/cgroup: Permission denied                                                                                                                                                                               │
│ Stream closed EOF for kube-system/cilium-54vc9 (mount-cgroup)                                                                                                                                                                               │

To Reproduce Upgrade 1.29.6 to to 1.30.2 … exit with this fail

Result Upgrade succeeded, nothing works due to CNI fail

Expected Result

Success upgrade also with CNI

Screenshots

image image

Additional context

N/A (also the thing that )

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Have some hypothesis guys: the problem arises when DaemonSet/cilium is:

  1. yet created without
  securityContext:
    appArmorProfile:
      type: Unconfined
  1. but at the same time already created without
  annotations:
    container.apparmor.security.beta.kubernetes.io/apply-sysctl-overwrites: unconfined
    container.apparmor.security.beta.kubernetes.io/cilium-agent: unconfined
    container.apparmor.security.beta.kubernetes.io/clean-cilium-state: unconfined
    container.apparmor.security.beta.kubernetes.io/config: unconfined
    container.apparmor.security.beta.kubernetes.io/install-cni-binaries: unconfined
    container.apparmor.security.beta.kubernetes.io/install-portmap-cni-plugin: unconfined
    container.apparmor.security.beta.kubernetes.io/mount-bpf-fs: unconfined
    container.apparmor.security.beta.kubernetes.io/mount-cgroup: unconfined

because of https://github.com/rancher/rke2-charts/blob/699fe0e2b3006587b98e9b2add8e77fecc2bee7a/charts/rke2-cilium/rke2-cilium/1.16.000/templates/cilium-agent/daemonset.yaml#L65 and https://github.com/rancher/rke2-charts/blob/699fe0e2b3006587b98e9b2add8e77fecc2bee7a/charts/rke2-cilium/rke2-cilium/1.16.000/templates/cilium-agent/daemonset.yaml#L95

the problem is not so easy reproducible, it seems it arises if we have HA controlplane (3 x masters), gradually upgrading those to 1.30, and depends on placing of Job/helm-install-rke2-cilium POD.

As such, it can be mitigated by appending

    podAnnotations:
      container.apparmor.security.beta.kubernetes.io/cilium-agent: "unconfined"
      container.apparmor.security.beta.kubernetes.io/clean-cilium-state: "unconfined"
      container.apparmor.security.beta.kubernetes.io/mount-cgroup: "unconfined"
      container.apparmor.security.beta.kubernetes.io/apply-sysctl-overwrites: "unconfined"

to HelmChartConfig/rke2-cilium, but the real RC yet to be found/confirmed. wdyt? Br, Alexey

Same issue here. Since the Upgrade to K8S 1.30.3 the cgroup automount container in the Cilium pod fails with permission denied. I don’t really understand why this would now be the case, my first idea was it having to do something with the new UserNamespace feature for K8S 1.30, but that should be disabled by default as a feature flag.

Note that according to Cilium documentation, there is a workaround for this. If cgroupv2 is already mounted on the host, you can just disable the failing automount init container and provide the path to the cgroupv2 mount (usually something like /sys/fs/cgroup, refer to the third note in this paragraph https://docs.cilium.io/en/stable/network/kubernetes/kubeproxy-free/#quick-start)

@NicolasAuden Problem seems to be fixed with v1.30.5

You can check the milestone on https://github.com/rancher/rke2/issues/7480. The cilium chart update that resolves this is slated for the 2025-01 release cycle, which means it will go out in this month’s upstream patch releases, including v1.30.9+rke2r1.

Note that simply upgrading or reconfiguring the chart once all cluster nodes have been upgraded to 1.30 will also fix this.

We’re trying to migrate to 1.30, but have high-stability requirements and are waiting for this issue to be fixed.

Is there a known path forward or an ETA to fix this issue? Thank you.

@agrevtsev how to add podAnnotations via rancher for upgrade? Or do I have to use annotations section?

I created a values.yaml file with all the specific settings and I added this to that file.

podAnnotations:
  container.apparmor.security.beta.kubernetes.io/cilium-agent: "unconfined"
  container.apparmor.security.beta.kubernetes.io/clean-cilium-state: "unconfined"
  container.apparmor.security.beta.kubernetes.io/mount-cgroup: "unconfined"
  container.apparmor.security.beta.kubernetes.io/apply-sysctl-overwrites: "unconfined"

I installed cilium with the cilium cli.

cilium install --helm-values values.yaml

Hello, I have the same issue. Upgrade from 1.28 to 1.30.5. Workaround works perfectly.