-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
securityContext of init containers contradicts new PodSecurity requirements #5896
Comments
Seems to happen in 0.42.0 too 😢 |
@RomanTheLegend Are you running your pipelineruns/taskruns in the tekton-pipelines namespace? |
We created a separate namespace for tekton tasks and that solved the problem with tasks not being executed (as it was suggested somewhere here, keep tekton-pipelines namespace only for controllers). |
+1
|
@NunoMaga These restrictions are per-namespace. The Create new namespace for tasks i.e.
This 'namespace' trick should be explicitly added to the README |
I encountered this issue (but for the 'prepare' pod), despite having a separate namespace for the task. As the original poster noted, this is due to Is there any reason the 'prepare' pod doesn't conform to a 'restricted' pod security? |
Yes It is right! |
Expected Behavior
Global problem: can't create new pods for tasks after update to 0.41 because of PodSecurity requirements. While there's a workaround to lower the requirements before each run (
kubectl label namespaces tekton-pipelines pod-security.kubernetes.io/enforce=baseline --overwrite
) we wanted to fix the root of the problem and harden the task pods by setting the correct securityContext to task pods/containers.It worked for task container, but failed for Init containers as they do not inherit these settings.
After setting up
stepTemplate
in task definition, new pod should be created on task submission, with all init containers mirroringsecurityContext
settings, just like task container does, but they don't.Actual Behavior
Scheduled task doesn't get pod allocated because of namespace's securityPolicy restrictions:
Steps to Reproduce the Problem
Update to latest Tekton version (0.41.0) and GKE above 1.23 ( in this case 1.23.12-gke.1600)
Add
stepTemplate
to Task definitionpod-security.kubernetes.io/enforce=restricted
policy applied to tekton-pipelines namespaceAdditional Info
Related to #2933
Kubernetes version: v1.23.12-gke.1600
Tekton Pipeline version: v0.41.0
The text was updated successfully, but these errors were encountered: