kyverno: [Bug] Policy validation stopped working after upgrade to v1.12.0
Kyverno Version
1.12.0
Kubernetes Version
1.27.x
Kubernetes Platform
AKS
Kyverno Rule Type
Validate
Description
After upgrading from Kyverno v1.11.4 to v1.12.0 all validation policies fail. The odd behavior is that the error reported is not always the same: sometimes Kyverno reports one policy failure, for example:
Error from server: error when creating "ubuntu-psp-pod.yaml": admission webhook "validate.kyverno.svc-fail" denied the request:
resource Pod/test/ubuntu-psp-pod was blocked due to the following policies
require-non-root-groups:
check-fsgroup: 'validation error: Containers cannot run with a root primary or supplementary
GID. rule check-fsgroup failed at path /spec/'
check-runasgroup: 'validation error: Running with root group IDs is disallowed.
rule check-runasgroup failed at path /spec/'
check-supplementalgroups: 'validation error: Containers cannot run with a root primary
or supplementary GID. rule check-supplementalgroups failed at path /spec/'
sometimes more policies are listed in the error, for example:
Error from server: error when creating "ubuntu-psp-pod.yaml": admission webhook "validate.kyverno.svc-fail" denied the request:
resource Pod/test/ubuntu-psp-pod was blocked due to the following policies
disallow-host-namespaces:
host-namespaces: 'validation error: Sharing the host namespaces is disallowed. The
fields spec.hostNetwork, spec.hostIPC, and spec.hostPID must be unset or set to
`false`. rule host-namespaces failed at path /spec/'
disallow-host-ports:
host-ports-none: 'validation error: Use of host ports is disallowed. rule host-ports-none
failed at path /spec/'
disallow-privilege-escalation:
privilege-escalation: 'validation error: Privilege escalation is disallowed. rule
privilege-escalation failed at path /spec/'
require-non-root-groups:
check-fsgroup: 'validation error: Containers cannot run with a root primary or supplementary
GID. rule check-fsgroup failed at path /spec/'
check-runasgroup: 'validation error: Running with root group IDs is disallowed.
rule check-runasgroup failed at path /spec/'
check-supplementalgroups: 'validation error: Containers cannot run with a root primary
or supplementary GID. rule check-supplementalgroups failed at path /spec/'
require-run-as-nonroot-user:
run-as-non-root: 'validation error: runAsUser must be set and with value greater
than 0. root user is not allowed. rule run-as-non-root[0] failed at path /spec/
rule run-as-non-root[1] failed at path /spec/'
restrict-seccomp:
check-seccomp: 'validation error: Use of custom Seccomp profiles is disallowed.
type must be unset or set to `RuntimeDefault` or `Localhost`. rule check-seccomp
failed at path /spec/'
restrict-sysctls:
check-sysctls: 'validation error: Setting additional sysctls above the allowed type
is disallowed. The field spec.securityContext.sysctls must be unset or not use
any other names than kernel.shm_rmid_forced, net.ipv4.ip_local_port_range, net.ipv4.ip_unprivileged_port_start,
net.ipv4.tcp_syncookies and net.ipv4.ping_group_range. rule check-sysctls failed
at path /spec/'
Even more strange, sometimes the pod gets created.
Steps to reproduce
- Upgrade to Kyverno v1.12.0 via Helm.
Expected behavior
The existing policies should work as in version 1.11.4.
Screenshots
No response
Kyverno logs
No response
Slack discussion
No response
Troubleshooting
- I have read and followed the documentation AND the troubleshooting guide.
- I have searched other issues in this repository and mine is not recorded.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 29 (23 by maintainers)
Just tried it out with the current Helm chart version 3.2.3-rc.3 and it seems to work now 😃
@monotek I can reproduce your issue. Thank you for your report. We will work on a fix for it right away.
@monotek - the new chart 3.2.2 will be release via https://github.com/kyverno/kyverno/pull/10193.
We can add that to 1.12.1 and publish a new chart for you.
New issue for cli: https://github.com/kyverno/kyverno/issues/10171
I can confirm that
v1.12.1-rc.1fixes the issue.