Grafana helm chart showing warnings : policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+
After we upgrade Kubernetes version to 1.21+ we are getting below warnings for Grafana helm chart.
W0829 15:48:27.712041 11076 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0829 15:48:27.719603 11076 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0829 15:48:27.740527 11076 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0829 15:48:27.748148 11076 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0829 15:48:27.756059 11076 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0829 15:48:27.777071 11076 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+
We are having Grafana helm version : 6.24.1
@vtandel-hub This one can't be suppressed due to policy/v1 does not have psp:
k8s 1.24.0
$ k api-resources | grep 'policy/v1'
poddisruptionbudgets pdb policy/v1 true PodDisruptionBudget
podsecuritypolicies psp policy/v1beta1 false PodSecurityPolicy
$ k version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:30:48Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.0", GitCommit:"4ce5a8954017644c5420bae81d72b09b735c21f0", GitTreeState:"clean", BuildDate:"2022-05-19T15:39:43Z", GoVersion:"go1.18.1", Compiler:"gc", Platform:"linux/amd64"}
k8s 1.25.0
$ kind create cluster --image kindest/node:v1.25.0
Creating cluster "kind" ...
...
Set kubectl context to "kind-kind"
You can now use your cluster with:
kubectl cluster-info --context kind-kind
Not sure what to do next? 😅 Check out https://kind.sigs.k8s.io/docs/user/quick-start/
$ k api-resources | grep 'policy/v1'
poddisruptionbudgets pdb policy/v1 true PodDisruptionBudget
$ k version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:30:48Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.0", GitCommit:"a866cbe2e5bbaa01cfd5e969aa3e033f3282a8a2", GitTreeState:"clean", BuildDate:"2022-09-01T23:30:43Z", GoVersion:"go1.19", Compiler:"gc", Platform:"linux/amd64"}
rbac:
pspEnabled: false
testFramework:
enabled: false
.Values.rbac.pspEnabled is currently false by default. However, updates to existing releases continue to generate the same error. To resolve this we need to remove the PodSecurityPolicy from past releases using the Helm mapkubeapis Plugin.
@ykzts is there a plan to implement the fix?
i was able to fix it by using helm-mapkubeapis
$ helm mapkubeapis --namespace monitoring grafana
2024/06/26 12:00:14 Release 'grafana' will be checked for deprecated or removed Kubernetes APIs and will be updated if necessary to supported API versions.
2024/06/26 12:00:14 Get release 'grafana' latest version.
2024/06/26 12:00:20 Check release 'grafana' for deprecated or removed APIs...
2024/06/26 12:00:20 Found 2 instances of deprecated or removed Kubernetes API:
"apiVersion: policy/v1beta1
kind: PodSecurityPolicy
"
No supported API equivalent
2024/06/26 12:00:20 Finished checking release 'grafana' for deprecated or removed APIs.
2024/06/26 12:00:20 Deprecated or removed APIs exist, updating release: grafana.
2024/06/26 12:00:20 Set status of release version 'grafana.v12' to 'superseded'.
2024/06/26 12:00:25 Release version 'grafana.v12' updated successfully.
2024/06/26 12:00:25 Add release version 'grafana.v13' with updated supported APIs.
2024/06/26 12:00:27 Release version 'grafana.v13' added successfully.
2024/06/26 12:00:27 Release 'grafana' with deprecated or removed APIs updated successfully to new version.
2024/06/26 12:00:27 Map of release 'grafana' deprecated or removed APIs to supported versions, completed successfully.
So it created a new revision by removing Deleted APIs and then upgrading worked without fail by keeping psp disabled
rbac:
pspEnabled: false