Helm 安装 rancher 提示:The target cluster does not have the PodSecurityPolicy API resource. Please disable PSPs in this chart before proceeding

Rancher Server 设置

  • Rancher 版本:2.7.2
  • 安装选项 (Docker install/Helm Chart): helm

下游集群信息

  • Kubernetes 版本: 1.25.0

主机操作系统:

问题描述:
helm安装报psp的错误

重现步骤:
通过 helm 安装 rancher:

helm install rancher rancher-latest/rancher \
--namespace cattle-system \           
--set hostname=rancher.my.org \
--version 2.7.2

结果:*
Error: INSTALLATION FAILED: execution error at (rancher/templates/validate-psp-install.yaml:4:5): The target cluster does not have the PodSecurityPolicy API resource. Please disable PSPs in this chart before proceeding.

解决方法:
在 Rancher chart 安装期间禁用 PodSecurityPolicy,使用以下命令:

helm install rancher rancher-latest/rancher \
--namespace cattle-system \           
--set hostname=rancher.my.org \
--set global.cattle.psp.enabled=false \
--version 2.7.2

当 local 集群使用 1.25,通过 helm 安装 rancher 2.7.2时会提示:Error: INSTALLATION FAILED: execution error at (rancher/templates/validate-psp-install.yaml:4:5): The target cluster does not have the PodSecurityPolicy API resource. Please disable PSPs in this chart before proceeding.

要解决这个问题,可在 helm install 后面添加 –set global.cattle.psp.enabled=false 即可

参考:Update feature charts to support updated approach for PSPs · Issue #40331 · rancher/rancher · GitHub