验证“ helm安装错误”:验证数据错误:[apiVersion未设置,种类未设置]

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

我尝试过的

我创建了具有以下结构的service helm chart

service/
  templates/
    service.yaml
  values.yaml
  Chart.yaml

这里是service.yaml:

 apiVersion: v1
 kind: Service
 metadata:
   name: {{ required "A valid Application Name is required!" .Values.name }}
   namespace: {{ required "A valid namespace is required!" .Values.namespace }}
  labels:
    {{ range $key, $value := .Values.labels }}
    {{ $key }}: {{ $value | quote }}
    {{ end }}
  annotations:
    {{ range $key, $value := .Values.annotations }}
    {{ $key }}: {{ $value | quote }}
    {{ end }}
spec:
  clusterIP: {{ .Values.spec.clusterIP }}
  externalIPs: {{ .Values.spec.externalIPs }}
  externalName: {{ .Values.spec.externalName }}
  externalTrafficPolicy: {{ .Values.spec.externalTrafficPolicy }}
  healthCheckNodePort: {{ .Values.spec.healthCheckNodePort }}
  loadbalancerIP: {{ .Values.spec.loadbalancerIP }}
  loadbalancerSourceRanges:
    {{ range .Values.spec.loadbalancerSourceRanges }}
    - {{ . | quote }}
    {{ end }}
  ports:
  {{ range .Values.spec.ports }}
  - name: {{ .name }}
    port: {{ .port }}
    protocol: {{ .protocol | quote }}
    targetPort: {{ .targetPort }}
  {{ end }}
  publishNotReadyAddresses: {{ .Values.spec.publishNotReadyAddresses }}
  selector:
    {{ range $key, $value := .Values.spec.selector }}
    {{ $key }}: {{ $value | quote }}
    {{ end }}
  type: {{ .Values.spec.type }}

这里是values.yaml:

name: personal-sandbox-service
namespace: mynamespace

labels:
  app: personal-sandbox

annotations:
  app: personal-sandbox


spec:
  ports:
  - name: 8080-tcp
    port: 8080
    protocol: TCP
    targetPort: 8080

selector:
  app: personal-sandbox

type: ClusterIP

这里是棉绒:

 $ helm lint service/
 ==> Linting service/
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, 0 chart(s) failed

以下是掌舵版本:

$ helm version
version.BuildInfo{Version:"v3.2.1", GitCommit:"fe51cd1e31e6a202cba7dead9552a6d418ded79a", 
GitTreeState:"clean", GoVersion:"go1.13.10"}

集群信息:

我们正在使用Openshift 4.2

 Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.6+999bb21", GitCommit:"999bb21", GitTreeState:"clean", BuildDate:"2020-02-17T18:41:39Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}

使用的Kubernetes API文档:

我正在使用Kubernetes 1.14 API Reference Doc确定所有服务属性。

什么是错误:

 $ helm install test-service service/ 
 Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: [apiVersion not set, kind not set]
kubernetes openshift kubernetes-helm
1个回答
0
投票
您可以尝试关注服务吗?

apiVersion: v1 kind: Service metadata: name: personal-sandbox-service namespace: mynamespace spec: type: ClusterIP ports: - port: 8080 protocol: TCP targetPort: 8080 selector: app: personal-sandbox

掌舵人,您可以稍后在试用期结束后使用values.yml占位符更新这些值。    
© www.soinside.com 2019 - 2024. All rights reserved.