Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yaml parse error helm

im getting

Error: YAML parse error on myApp-infra/templates/my.yaml: error converting YAML to JSON: yaml: line 20: found unexpected ':'

below is helm install --dry-run --debug ./myApp output

kind: Service
apiVersion: v1
metadata:
  name: spark-slave-service
  labels:
    app: spark-slave
spec:
  selector:
    app: spark-slave
  clusterIP: None
---
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
  name: spark-slave-deployment
spec:
  selector:
    matchLabels:
      app: spark-slave
  serviceName: "spark-slave-service"
  replicas: 3 # tells deployment to run 2 pods matching the template
  template: # create pods using pod definition in this template
    metadata:
      labels:
        app: spark-slave
    spec:
      containers:
      - name: spark-slave-container
        image: <image url>
        command: [<mycommand>
        volumeMounts:
        - mountPath: "/tmp/data"
          name: slave-pvc
  volumeClaimTemplates:
  - metadata:
      labels:
        app: spark-slave
      name: slave-pvc
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      storageClassName: "rook-block"
like image 252
shiv455 Avatar asked Mar 06 '18 18:03

shiv455


People also ask

How do I get Yaml from helm chart?

You can use the helm native commands to achieve this. In helm, there is a command called helm template . Using the template command you can convert any helm chart to a YAML manifest. The resultant manifest file will have all the default values set in the helm values.

How do I debug helm issues?

There are a few commands that can help you debug. helm template --debug will test rendering chart templates locally. helm install --dry-run --debug : We've seen this trick already. It's a great way to have the server render your templates, then return the resulting manifest file.

What is helm -- dry-run?

--dry-run in helm install means checking the generated manifests of a release without installing the chart. @

What is helm lint?

This command takes a path to a chart and runs a series of tests to verify that the chart is well-formed. If the linter encounters things that will cause the chart to fail installation, it will emit [ERROR] messages.


1 Answers

When helm encounters parse errors while processing multiple YAML documents in a single file (like your case) the error message can be a bit misleading. Although it says line 20, that point is in reference to the beginning of one of the YAML documents in the file, not the beginning of the file itself. With most parse errors, you should check the line it mentions as well as the previous line for issues. In your case, it looks like Line 19 of the StatefulSet document on the command line would cause it.

like image 193
Grant David Bachman Avatar answered Sep 19 '22 16:09

Grant David Bachman