Go templates: How do I access array item (arr[2]) in templates?

Solution 1:

You need to use the index template function.

{{index .a 2}}

Solution 2:

to access a field on an array item as go templating in *.yaml format :

{{ (index .Values.fields 0).fieldItem }}

Index of zero(0) as in fields array of field as fieldItem .