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

v23.01.1: Error: container has runAsNonRoot and image will run as root #817

Closed
temirg opened this issue Mar 30, 2023 · 18 comments
Closed

v23.01.1: Error: container has runAsNonRoot and image will run as root #817

temirg opened this issue Mar 30, 2023 · 18 comments
Labels

Comments

@temirg
Copy link

temirg commented Mar 30, 2023

Describe the bug
Upgrade of trident in Rancher UI via helmchart from 22.10.0 to 23.01.1 failed

Environment
Rancher 2.7.1, RKE2 v1.24.9+rke2r2

  • Trident version: 23.01.1
  • Trident installation flags used:
    ** yaml **
    affinity: {}
    deploymentAnnotations: {}
    imagePullPolicy: IfNotPresent
    imagePullSecrets: null
    imageRegistry: registry.k8s.io/sig-storage
    kubeletDir: ''
    nodeSelector: {}
    operatorDebug: true
    operatorImage: docker.io/netapp/trident-operator:23.01.1
    operatorImageTag: ''
    podAnnotations: {}
    tolerations: null
    tridentAutosupportImage: docker.io/netapp/trident-autosupport:23.01
    tridentAutosupportImageTag: '23.01'
    tridentAutosupportProxy: ''
    tridentDebug: false
    tridentEnableNodePrep: false
    tridentHttpRequestTimeout: 90s
    tridentIPv6: false
    tridentImage: docker.io/netapp/trident:23.01.1
    tridentImageTag: ''
    tridentK8sTimeout: 0
    tridentLogFormat: text
    tridentProbePort: ''
    tridentSilenceAutosupport: false
    tridentSkipK8sVersionCheck: false
    windows: false
    ** yaml end **
  • Container runtime: containerd
  • Kubernetes version: v1.24.9+rke2r2
  • Kubernetes orchestrator: Rancher v2.7.1
  • OS: SLES 15.4

To Reproduce
Steps to reproduce the behavior:

  • push images to local registry, upload trident helmchart 23.01.1 to registry
  • Rancher => downstream cluster (explorer) => Apps => installed Apps => trident => Upgrade/Edit => choose 23.01.1 => apply using YAML above

Expected behavior
All trident pods run without errors

Additional context => Error:
Events:
Type Reason Age From Message
" ---- ------ ---- ---- -------"
Normal Scheduled 37s default-scheduler Successfully assigned trident/trident-controller-89d5d9c5f-pn7tr to worker-xxx
Normal Pulling 37s kubelet Pulling image "docker.io/netapp/trident:23.01.1"
Normal Pulled 35s kubelet Successfully pulled image "docker.io/netapp/trident:23.01.1" in 1.634133777s
Normal Pulling 35s kubelet Pulling image "docker.io/netapp/trident-autosupport:23.01"
Normal Pulling 34s kubelet Pulling image "registry.k8s.io/sig-storage/csi-provisioner:v3.4.0"
Normal Pulled 34s kubelet Successfully pulled image "docker.io/netapp/trident-autosupport:23.01" in 1.048826948s
Normal Pulling 33s kubelet Pulling image "registry.k8s.io/sig-storage/csi-attacher:v4.1.0"
Normal Pulled 33s kubelet Successfully pulled image "registry.k8s.io/sig-storage/csi-provisioner:v3.4.0" in 759.625294ms
Normal Pulled 32s kubelet Successfully pulled image "registry.k8s.io/sig-storage/csi-attacher:v4.1.0" in 881.271892ms
Normal Pulling 32s kubelet Pulling image "registry.k8s.io/sig-storage/csi-resizer:v1.7.0"
Warning Failed 32s kubelet Error: container has runAsNonRoot and image will run as root (pod: "trident-controller-89d5d9c5f-pn7tr_trident(6e9ac407-9040-4af6-ae1e-eea99b92d08e)", container: csi-attacher)
Warning Failed 31s kubelet Error: container has runAsNonRoot and image will run as root (pod: "trident-controller-89d5d9c5f-pn7tr_trident(6e9ac407-9040-4af6-ae1e-eea99b92d08e)", container: csi-resizer)
Normal Pulled 31s kubelet Successfully pulled image "registry.k8s.io/sig-storage/csi-resizer:v1.7.0" in 819.988585ms
Normal Pulling 31s kubelet Pulling image "registry.k8s.io/sig-storage/csi-snapshotter:v6.2.1"
Normal Pulled 31s kubelet Successfully pulled image "registry.k8s.io/sig-storage/csi-snapshotter:v6.2.1" in 812.559916ms
Warning Failed 31s kubelet Error: container has runAsNonRoot and image will run as root (pod: "trident-controller-89d5d9c5f-pn7tr_trident(6e9ac407-9040-4af6-ae1e-eea99b92d08e)", container: csi-snapshotter)
Warning Failed 30s (x2 over 35s) kubelet Error: container has runAsNonRoot and image will run as root (pod: "trident-controller-89d5d9c5f-pn7tr_trident(6e9ac407-9040-4af6-ae1e-eea99b92d08e)", container: trident-main)
Warning Failed 30s (x2 over 33s) kubelet Error: container has runAsNonRoot and image will run as root (pod: "trident-controller-89d5d9c5f-pn7tr_trident(6e9ac407-9040-4af6-ae1e-eea99b92d08e)", container: csi-provisioner)
Warning Failed 30s (x2 over 34s) kubelet Error: container has runAsNonRoot and image will run as root (pod: "trident-controller-89d5d9c5f-pn7tr_trident(6e9ac407-9040-4af6-ae1e-eea99b92d08e)", container: trident-autosupport)
Normal Pulled 30s kubelet Container image "docker.io/netapp/trident:23.01.1" already present on machine
Normal Pulled 30s kubelet Container image "docker.io/netapp/trident-autosupport:23.01" already present on machine
Normal Pulled 30s kubelet Container image "registry.k8s.io/sig-storage/csi-provisioner:v3.4.0" already present on machine
Normal Pulled 30s kubelet (combined from similar events): Container image "registry.k8s.io/sig-storage/csi-attacher:v4.1.0" already present on machine

@temirg temirg added the bug label Mar 30, 2023
@temirg
Copy link
Author

temirg commented Mar 31, 2023

Hello,

attached is a diff/compare between v22.10.0 and v23.01.1 helmcharts:
charts-diff_v22.10.0_vs_v23.01.1.txt

v23.01.1 - roles/rolebindings added before clusteroles/clusterrolebindings.

Regards, temir.

@temirg
Copy link
Author

temirg commented Apr 3, 2023

Possibly very important info: all rke2 cluster with rke2 (k8s) <1.25.x have "cis-profile: 1.6" configured.

In the future, when rke2 is updated to version 1.25.x and newer, "cis-profile: 1.23" will be used.

Regards, temir.

@gnarl
Copy link
Contributor

gnarl commented Apr 3, 2023

Hi @temirg,

We haven't tested Trident against RKE 2 and it seems that you are the first customer reporting an issue while using RKE 2. Please open a NetApp Support case for this issue so that additional information can be collected. This will help us to address this issue faster than if we try to just collect the information via GitHub Issues.

@temirg
Copy link
Author

temirg commented Apr 3, 2023

Hello @gnarl,

Netapp Case with prio 2 is closed today, because the bugfix wills take a while.
Should the Issue be closed too?

@gnarl
Copy link
Contributor

gnarl commented Apr 3, 2023

Hi @temirg,

I found out about the NetApp support case a bit ago. We are working on reopening the support case.

@antwynne
Copy link

antwynne commented Apr 4, 2023

The case has now been re-opened

@antwynne
Copy link

Hi @gnarl

Do you need any more information about this issue. Please let me know if you do.

@mdekoster
Copy link

mdekoster commented May 15, 2023

Hi,

We have the same issue with the Trident Operator (on k8s version 1.24). The Operator creates the deployment for the trident-controller, but it does not specify the securityContext on pod level and container level in the deployment. If an another PSP is specified in the cluster with a alphabetic name for the ClusterRoleBinding that is before the ClusterRoleBinding fleet-controller with least permissions, the mutating admission psp controller will add securityContexts that do not conform the persmissons the pod/container(s) will need.

@antwynne
Copy link

@mdekoster
we have the output of kubectl describe ns trident:
@test:~> kubectl describe ns trident
Name: trident
Labels: kubernetes.io/metadata.name=trident

pod-security.kubernetes.io/enforce=privileged
Annotations: cattle.io/status:

{"Conditions":[{"Type":"ResourceQuotaInit","Status":"True","Message":"","LastUpdateTime":"2022-01-28T11:03:35Z"},{"Type":"InitialRol
esPopu...
lifecycle.cattle.io/create.namespace-auth: true
Status: Active

Resource Quotas
Name:
trident-csi
Resource Used Hard


No LimitRange resource.

@mdekoster
Copy link

mdekoster commented May 16, 2023

@antwynne that's for the Pod Security Admission (PSA) in k8s 1.25+. We are still on 1.24 and use the (deprecated) Pod Security Policy feature.

But, you still have to specify the needed securityContext in the pod specs of the deployment, daemonset or statefulset. The triden-operator does not specify the securityContext in the trident-controller deployment.

@temirg
Copy link
Author

temirg commented Jun 6, 2023

@antwynne / @gnarl
there is a new trident release available: v23.04: https://github.com/NetApp/trident/releases/tag/v23.04.0
Does the new release solve the problem of version 23.01 with RKE2?

Regards, temirg.

@zlmitchell
Copy link

I just attempted the same with 23.04 and still have the same issue. RKE2 1.24.12+rke2r1, cis 1.6

Error: container has runAsNonRoot and image will run as root

@zlmitchell
Copy link

It appears that the Trident-Controller does not have a securityContext set, and is not configurable via the helm chart. Updating the deployment for the trident-controller and adding follow got it running. But as the chart/operator has no way to configure this we should probably get this bug report submitted.

securityContext:
  runAsNonRoot: false

@antwynne
Copy link

antwynne commented Jun 7, 2023

@zlmitchell
In helm chart values exists a line with "deploymentAnnotations: {}" .

There are two deployments in total: trident-csi and trident-operator.
What is the correct syntax to pass the rigth securityContext to the trident-csi?

== As a sample ==
deploymentAnnotations:
metadata:
name: trident-csi
spec:
spec:
securityContext:
runAsNonRoot: false

@temirg
Copy link
Author

temirg commented Jun 7, 2023

@zlmitchell The workaround works, but: is it safe for production?
Or does the orchestrator eventually realize that the deployment has been changed and reset it again?

@zlmitchell
Copy link

If you are running PSA in your RKE2 cluster you will also need to add the following to the trident-operator ClusterRole

  - apiGroups:
      - management.cattle.io
    resources:
      - projects
    verbs:
      - updatepsa

@temirg
Copy link
Author

temirg commented Jun 13, 2023

Hello all,

the workaround with deployment edit works fine.
Issue wills be closed as solved by workaround.

Many thanks to all involved!

Best Regards, temirg.

@temirg temirg closed this as completed Jun 13, 2023
@gnarl
Copy link
Contributor

gnarl commented Jul 14, 2023

This issue is also addressed with commit 6d30a16 and will be included in the Trident 23.07 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants