1
votes

I'm a beginner of helm and Kubernetes in general. Recently I have started trialling deployments to an AKS cluster which will include multiple Cluster IP services hidden behind a load balancing NGINX node. For today I'm using Helm 2.2 and have successfully installed the NGINX node. My understanding is now that for each of my individual service charts in Helm I use annotations to enable Nginx routing. As I see it, I should be able to modify the values.yaml file at the top of the chart (nowhere else) to perform these actions.

service:
  type: ClusterIP
  port: 80

ingress:
  enabled: true
  annotations: 
    kubernetes.io/ingress.class: nginx
  hosts:
    - chart-example.local

When I execute the above (the rest of the file is excluded for brevity) I receive the error "converting YAML to JSON: yaml: line 38: did not find expected key."

Line 38 corresponds to the end of the ingress section (the blank line straight afterwards). I'm assuming that my yaml is badly formed, and I cannot for the life of me find any examples of this file being used in this fashion. Am I doing it right? If yes what mistake have I made in the yaml. If not, what should I be doing to route to one of my many services via the ingress file? Are there any actual examples of the values.yaml file being set in this fasion to be seen somewhere? Every time I search I find the Ingress.yaml file is modified as a Kubernetes object rather than as a templated Helm chart.

1
Please, can you link the helm chart you are referring to? Please take a moment to read How to create a Minimal, Reproducible Example.Mark Watney
Hi @mWatney thanks for the question. My chart was purely a local test chart and not published anywhere. I was attempting to figure out how to create the values.yaml correctly. However, in trying to re-create the reproducible example I solved the layout so thanks for the prompt.The Senator

1 Answers

1
votes

It turns out that with the values.yaml I didn't give people a fair chance. The offending yaml line happened after the code fragment that I provided and was subtle. The code that was necessary to ensure the correct ingress definition was supplied is this:

ingress:
enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
  hosts:
    - host: chart-example.local
      paths:
        - /test

  tls: {}

My mistake was the tls line that came afterwards. I had neglected to realise that the indendenting of the tls section meant it was included with the ingress section and it had one missing space.

_tls: {}

instead of

 __tls: {}

My example now renders the template correctly (the underscores are only included to demonstrate the number of spaces and should be removed of course).