0
votes

I have a helm chart where I deploy a kong service. This deployment works if I use a remote kubernetes cluster in EKS (Aws). Now I'm deploy a minikube cluster with the same K8s version but I'm getting the next error when I try to install the helm chart.

minikube version -> minikube version: v1.19.0

Kubectl version -> Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.12", GitCommit:"7cd5e9086de8ae25d6a1514d0c87bac67ca4a481", GitTreeState:"clean", BuildDate:"2020-11-12T09:18:55Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

helm version: version.BuildInfo{Version:"v3.4.2", GitCommit:"23dd3af5e19a02d4f4baa5b2f242645a1a3af629", GitTreeState:"clean", GoVersion:"go1.14.13"}

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: apiVersion not set

My chart.yml is like this:

apiversion: v2
name: kong
description: A Helm chart for Kubernetes

type: application
version: 0.1.0

My deployment.yaml is:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}-deployment
  namespace: {{ .Release.Namespace }}
spec:
  replicas: {{ .Values.replicaCount }}
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ .Release.Name }}
    spec:
      initContainers:
      - name: init-kong
        image: "{{ .Values.image.repository }}{{ .Values.global_version }}"
        command: [ 'kong', 'migrations', 'bootstrap']
        envFrom:
        - configMapRef:
            name: {{ .Release.Name }}-env
      containers:
      - image: "{{ .Values.image.repository }}{{ .Values.global_version }}"
        envFrom:
        - configMapRef:
            name: {{ .Release.Name }}-env
        livenessProbe:
          exec:
            command:
            - kong
            - health
          failureThreshold: 3
          periodSeconds: 90
          timeoutSeconds: 10
        name: {{ .Release.Name }}-pod
        ports:
        - containerPort: 9800
        - containerPort: 9801
      restartPolicy: Always
      volumes:
      - name: {{ .Release.Name }}-configmap
        configMap:
          name: {{ .Release.Name }}-configmap
      nodeSelector:    
        eks.amazonaws.com/nodegroup: "{{ .Values.postgres.WORKER_NODE }}"

The commnd I'm using to install helm chart is (I tried to do it inside the chart directory and out of it, with the same result):

helm install kong kong

1
you can try helm install kong kong --dry-run to check your yml outputNIrav Modi
The output message is the same ..Humberto Lantero
can you post output of helm template ?Vit

1 Answers

0
votes

Well the error message is very clear:

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: apiVersion not set

The problem is that the apiVersion in your template is apiversion, remember that all k8s yaml templates keys should be camelcased:

The right should be:

apiVersion: v2
name: kong
description: A Helm chart for Kubernetes

type: application
version: 0.1.0