首页 > 解决方案 > 在自定义命名空间下安装 helm chart

问题描述

我正在尝试将一些 helm 图表安装到 Microk8s 集群上的自定义命名空间中,但出现以下错误。我究竟做错了什么?集群是新鲜的,这些命名空间或资源都不存在。

> helm install loki grafana/loki-stack -f values/loki-stack.yaml --namespace loki --create-namespace
W0902 08:08:35.878632 1610435 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+
Error: rendered manifests contain a resource that already exists. Unable to continue with install: 
PodSecurityPolicy "loki-grafana" in namespace "" exists and cannot be imported into the current release: 
invalid ownership metadata; annotation validation error: 
key "meta.helm.sh/release-namespace" must equal "loki": current value is "default"

> helm install traefik traefik/traefik -f values/traefik.yml --namespace traefik --create-namespace
Error: rendered manifests contain a resource that already exists. Unable to continue with install: 
ClusterRole "traefik" in namespace "" exists and cannot be imported into the current release: 
invalid ownership metadata; annotation validation error: 
key "meta.helm.sh/release-namespace" must equal "traefik": current value is "default"

标签: kuberneteskubernetes-helmmicrok8s

解决方案


要部署的资源 ( loki ) 已存在于指定的命名空间中。

请检查helm list -n loki

因此,在安装之前,您需要先将其卸载。

  1. helm uninstall loki -n loki
  2. helm install loki grafana/loki-stack -f values/loki-stack.yaml --namespace loki

或者您可以尝试直接更新它:

helm upgrade loki grafana/loki-stack -f values/loki-stack.yaml --namespace loki


推荐阅读