Helm 安装失败:configMap 无法作为 ConfigMap 处理:json:无法将 bool 解组到字符串类型的 Go struct 字段 ConfigMap.data 中

问题描述 投票:0回答:2

尝试安装 helm 但收到如下错误消息:

install.go:178: [debug] Original chart version: ""
install.go:195: [debug] CHART PATH: /Users/lkkto/Dev/pipelines/manifests/helm/helm-pipeline/charts/base/charts/installs/charts/multi-user/charts/api-service
client.go:128: [debug] creating 4 resource(s)
Error: INSTALLATION FAILED: ConfigMap in version "v1" cannot be handled as a ConfigMap: json: cannot unmarshal bool into Go struct field ConfigMap.data of type string
helm.go:84: [debug] ConfigMap in version "v1" cannot be handled as a ConfigMap: json: cannot unmarshal bool into Go struct field ConfigMap.data of type string
INSTALLATION FAILED
main.newInstallCmd.func2
    helm.sh/helm/v3/cmd/helm/install.go:127
github.com/spf13/cobra.(*Command).execute
    github.com/spf13/[email protected]/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
    github.com/spf13/[email protected]/command.go:974
github.com/spf13/cobra.(*Command).Execute
    github.com/spf13/[email protected]/command.go:902
main.main
    helm.sh/helm/v3/cmd/helm/helm.go:83
runtime.main
    runtime/proc.go:250
runtime.goexit
    runtime/asm_amd64.s:1571

似乎与我生成的 configMap 有关:

apiVersion: v1
data:
  DEFAULTPIPELINERUNNERSERVICEACCOUNT: default-editor
  MULTIUSER: true
  VISUALIZATIONSERVICE_NAME: ml-pipeline-visualizationserver
  VISUALIZATIONSERVICE_PORT: 8888
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/name: kubeflow-pipelines
    app.kubernetes.io/component: ml-pipeline
    application-crd-id: kubeflow-pipelines
  name: pipeline-api-server-config-f4t72426kt
  namespace: kubeflow

这有什么问题吗?

kubernetes-helm
2个回答
20
投票

来自 docs ConfigMap.data 是一个

string:string
地图。在您的示例中,您将
MULTIUSER
设置为布尔值。

将您的 ConfigMap 更新为:

apiVersion: v1
data:
  DEFAULTPIPELINERUNNERSERVICEACCOUNT: default-editor
  MULTIUSER: 'true'
  VISUALIZATIONSERVICE_NAME: ml-pipeline-visualizationserver
  VISUALIZATIONSERVICE_PORT: 8888
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/name: kubeflow-pipelines
    app.kubernetes.io/component: ml-pipeline
    application-crd-id: kubeflow-pipelines
  name: pipeline-api-server-config-f4t72426kt
  namespace: kubeflow

注意

'true'
代表
MULTIUSER
。这明确地将其设置为字符串。


3
投票

只是为了进一步支持这一点。设置入口控制器时遇到此问题。

我的初始配置是这样的:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: prometheus-kube-prometheus-prometheus
  namespace: monitoring
  labels:
    app: kube-prometheus-stack-prometheus
    heritage: Helm
    release: prometheus
    self-monitor: true

问题在于

self-monitor: true
,Helm 无法将其编组为字符串,因为它是布尔值。它应该用这样的引号括起来 -
self-monitor: "true"
,所以我们之后会有这个:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: prometheus-kube-prometheus-prometheus
  namespace: monitoring
  labels:
    app: kube-prometheus-stack-prometheus
    heritage: Helm
    release: prometheus
    self-monitor: "true"
© www.soinside.com 2019 - 2024. All rights reserved.