<p>I'm trying to create an Istio ingress gateway (istio: 1.9.1, EKS: 1.18) with a duplicate <code>targetPort</code> like this:</p>
<pre><code>apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
  name: istio
spec:
  components:
    ingressGateways:
      - name: ingressgateway
        k8s:
          service:
            ports:
              - port: 80
                targetPort: 8080
                name: http2
              - port: 443
                name: https
                targetPort: 8080
</code></pre>
<p>but I get the error:</p>
<pre><code>- Processing resources for Ingress gateways.
✘ Ingress gateways encountered an error: failed to update resource with server-side apply for obj Deployment/istio-system/istio: failed to create typed patch object: errors:
.spec.template.spec.containers[name=&quot;istio-proxy&quot;].ports: duplicate entries for key [containerPort=8080,protocol=&quot;TCP&quot;]
</code></pre>
<p>I am running Istio in EKS so we terminate TLS at the NLB, so all traffic (<code>http</code> and <code>https</code>) should go to the pod on the same port (8080)</p>
<p>Any ideas how I can solve this issue?</p>

<p>Until the istio 1.8 version, this type of configuration worked (although with initial problems) - <a href="https://github.com/kubernetes/kubernetes/issues/53526" rel="nofollow noreferrer">github #53526</a>.</p>
<p>As of version 1.9 an error is generated and you can no longer use two of the same ports in one definition. There have also been created (or reopened) reports on github:</p>
<ul>
<li><a href="https://github.com/istio/istio/issues/35349" rel="nofollow noreferrer">github #35349</a></li>
<li><a href="https://github.com/kubernetes/kubernetes/pull/53576" rel="nofollow noreferrer">github #53576</a></li>
<li><a href="https://github.com/kubernetes/ingress-nginx/issues/1622" rel="nofollow noreferrer">github #1622</a></li>
</ul>
<p>However, the issue is with an outdated version of Kubernetes and Istio at the time of writing the response.</p>
<p>Possible workarounds:</p>
<ul>
<li>Use different <code>targetPort</code></li>
<li>Upgrade Kubernetes and Istio to newest versions.</li>
</ul>
