<p>I have two application, both deployed in same cluster.</p>

<p>Now from web, there is an ajax request to get data from api, but it always return <code>502 Connection refused</code>.</p>

<p>here is my jquery code (web).</p>

<pre><code>$.get("http://10.43.244.118/api/users", function (data) {
        console.log(data);
        $('#table').bootstrapTable({
            data: data
        });
    });
</code></pre>

<p>Note: when I change the service type to <code>LoadBalancer</code> from <code>ClusterIP</code> then it works fine.</p>

<p>ClusterIP services (usually) only work within the cluster. You can technically make your CNI address space available externally, but that is rare and you probably shouldn't count on it. The correct way to expose something outside the cluster is either a NodePort service or a LoadBalancer (which is a NodePort plus a cloud load balancer).</p>
