<p>My goal is to have multiple ports defined for a service of type <code>LoadBalancer</code> and I do not want to copy paste the same thing over and over again.</p>

<p>I did come to a solution, but sure how I could define the range - I need all values from 50000 to 50999.</p>

<p>In my service, I define the range:</p>

<pre><code>{{- range $service.ports }}
  - name: tport
    protocol: TCP
    port: {{ . }}
  {{- end }}
</code></pre>

<p>And in my values file:</p>

<pre><code>ports: 
  - 50000
  - 50001
  - 50999
</code></pre>

<p>How could I define the ports or update the service template to do this?</p>

Chillax
<p>Put the min and max port as two different values on your values.yaml and use the range on your template like this:</p>

<pre><code>{{- range untilStep (.Values.config.min_port|int) (.Values.config.max_port|int) 1 }}
- port: {{ . }}
  targetPort: "tcp-{{ . }}"
  protocol: TCP
  name: "tcp-{{ . }}"
{{ -end }}
</code></pre>
