<p>My current ingress looks something like </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
spec:
  rules:
  - host: web1.dev.cloud
    http:
      paths:
      - path: /
        backend:
          serviceName: web1
          servicePort: 8080
</code></pre>

<p>Meaning that the first part of the host will always match the serviceName.
So for every web pod I would need to repeat the above like:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
spec:
  rules:
  - host: web1.dev.cloud
    http:
      paths:
      - path: /
        backend:
          serviceName: web1
          servicePort: 8080
  - host: web2.dev.cloud
    http:
      paths:
      - path: /
        backend:
          serviceName: web2
          servicePort: 8080
</code></pre>

<p>I was just wondering if there is some support for doing the following:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
spec:
  rules:
  - host: $1.dev.cloud
    http:
      paths:
      - path: /
        backend:
          serviceName: $1
          servicePort: 8080
</code></pre>

panpan
<p>This is not possible if you use kubectl to deploy your kubernetes manifests. However if you write a helm chart for your application it is possible. Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources in the form for templates.
There in the ingress.yaml template you can write such config using range block and putting the variable values in values.yaml</p>
<p>In your case it will look something like below</p>
<pre><code>spec:
  rules:
  {{- range .Values.ingress.hosts }}
  - host: {{ .name }}.dev.cloud
    http:
      paths:
      - path: {{ default &quot;/&quot; .path | quote }}
        backend:
          serviceName: {{ .name }}
          servicePort: 8080
  {{- end }}
</code></pre>
<p>and the values.yaml will have</p>
<pre><code>ingress:
      hosts:
        - name: abc
        - name: xyz
</code></pre>
