<p>I have two services running on k8s and I am using an ingress to access my services. One of the service requires access to another view env but I added the cluster IP and the port of the required service but it seems to be unaccessible.</p>
<p>User Deployment yaml</p>
<pre><code>...
         - name: WALLET_SERVICE_URL
              value: 'http://10.103.xxx.xx:30611'
            - name: WALLET_SERVICE_API_VERSION
              value: /api/v1
...
</code></pre>
<p>my Ingress</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: dev-ingress
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /api/v1$uri
spec:
  ingressClassName: nginx
  rules:
    - host: demo.localdev.me
      http:
        paths:
          - path: /user
            pathType: Prefix
            backend:
              service:
                name: accounts-service
                port:
                  number: 80
          - path: /wallet
            pathType: Prefix
            backend:
              service:
                name: wallet-service
                port:
                  number: 80
</code></pre>
<p>Wallet service</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: wallet-service
spec:
  selector:
    app: wallet-service
  ports:
    - port: 80
      targetPort: 3007
  type: NodePort
</code></pre>

King
<ol>
<li><p>Use <code>ClusterIP</code> for <code>wallet-service</code>. There's no reason to use <code>NodePort</code> -- the ingress controller will handle routing to the internal IP.</p>
</li>
<li><p>Your value for the <code>WALLET_SERVICE_URL</code> should be pointing to your service <em>by DNS name</em>, using the <code>port</code> you define for your <code>ClusterIP</code> service. i.e. <code>http://wallet-service:80</code>.</p>
</li>
<li><p>Unless <code>wallet-service</code> should be accessible outside of the cluster, you don't need to configure ingress for it.</p>
</li>
</ol>
