<p>I have an an nginx Ingress controller and let's encrypt + cert-manager deployed using helm. Accessing the frontend works fine, the problem is that the frontend pod calls the backend pod on a clusterIP service but fails with a block mixed content error?</p>
<p>frontend in Angular where api_url: 'http://backend/api'</p>
<p>If I run the workload without nginx-ingress-let's encrypt &gt; no issues, the call succeeds.</p>
<p>So I am assuming because of https on the ingress and http client call results in that error.</p>
<p>How do I go about solving this? If I changed the frontend code api_url: https://backend/api, it won't work either because missing TLS cert on the service.</p>
<p>How can I use TLS on the clusterIP service between the fronend and backend??</p>
<p>My frontend is setup as:</p>
<pre><code>this.http.post&lt;any&gt;(`${environment.apiUrl}/auth/login`, {email, password})
</code></pre>
<p>Where <code>apiUrl: 'http://backend/api'</code></p>
<p>I built the frontend in a container and exposed it to a loadbalancer service and I am trying to hook it up through a ClusterIP service to a backend on port 3000.</p>
<p>Frontend YAML:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: frontend
spec:
  selector:
    tier: frontend
  ports:
    - port: 80
      targetPort: 80
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
spec:
  selector:
    matchLabels:
      tier: frontend
  replicas: 1
  template:
    metadata:
      labels:
        tier: frontend
    spec:
      containers:
      - name: frontend
        image: &lt;Image&gt;
        imagePullPolicy: Always
        ports:
        - containerPort: 80
</code></pre>
<p>Backend YAML:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
spec:
  selector:
    matchLabels:
      app: app
      tier: backend
  replicas: 1
  template:
    metadata:
      labels:
        app: app
        tier: backend
    spec:
      containers:
      - name: frontend-container
        image: &lt;Image&gt;
        ports:
        - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  name: backend
spec:
  selector:
    app: app
    tier: backend
  ports:
  - protocol: TCP
    port: 80
    targetPort: 3000
</code></pre>
<p>As explained in the doc <a href="https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/" rel="nofollow noreferrer">here</a>.</p>
<p>But it doesn't work when I try to access it from the browser, I receive Unknown Error!!</p>
<p><a href="https://i.stack.imgur.com/U1ddX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U1ddX.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/lj512.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lj512.png" alt="enter image description here" /></a></p>
<p>Here are screenshots from inside the frontend making sure it is able to reach the backend internally.</p>
<p><a href="https://i.stack.imgur.com/7vyji.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7vyji.png" alt="enter image description here" /></a></p>
<p>I don't understand where I went wrong here. I am thinking the apiUrl var set to http://backend is not being translated correctly because if I changed that to a loadbalancer IP and rebuilt the image, exposed the backend to a LB service instead of ClusterIP. It does work.</p>
<p>But obviously I don't want to expose my backend to a LB service.</p>
<p>Any idea?</p>

<p>You can do the TLS termination at the ingress layer, the ingress rule contains provision for that.</p>
<p>The nginx service will be exposed to external world via a public IP and it runs at LoadBalancer's level only, the termination has to be done only at one level, once the traffic comes into VPN of your kubernetes cluster, there is no need to keep things internally encrypted.</p>
<p>you can follow <a href="https://stackoverflow.com/questions/58423312/how-do-i-test-a-clusterissuer-solver/58436097?noredirect=1#comment103215785_58436097">this stack overflow post </a>, it shall help I guess. The TLS certificate will be automatically created by cert-manager, you just need to do the appropriate settings in the DNS.</p>
