<p>As various google articles(Example : <a href="https://www.ovh.com/blog/getting-external-traffic-into-kubernetes-clusterip-nodeport-loadbalancer-and-ingress/" rel="nofollow noreferrer">this blog</a>) states that this(connecting Kube cluster through proxy and clusterIP) method isn’t suitable for a production environment, but it’s useful for development.</p>

<p>My question is why it is not suitable for production ? Why connecting through nodeport service is better than proxy and clusterIP  ?</p>

user3198603
<p>Lets distinguish between three scenarios where connecting to the cluster is required </p>

<ol>
<li><p><strong>Connecting to Kubernetes API Server</strong>
Connecting to the API server is required for administrative purposes. The users of your application have no business with it. 
The following options are available</p>

<ul>
<li>Connect directly to Master IP via HTTPS</li>
<li><a href="https://kubernetes.io/docs/tasks/access-kubernetes-api/http-proxy-access-api/" rel="nofollow noreferrer">Kubectl Proxy</a> Use <code>kubectl proxy</code> to to make the Kubernetes API available on your localhost.</li>
</ul></li>
<li><p><strong>Connecting external traffic to your applications running in the Kubernetes Cluster</strong>. Here you want to expose your applications to your users. You'll need to configure a <a href="https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types" rel="nofollow noreferrer">Service</a> and they can be of the following types</p>

<ul>
<li><strong>NodePort</strong>: Only accessible on the NodeIPs and ports > 30000</li>
<li><strong>ClusterIP</strong>: Internal Only. External traffic cannot hit a service of type ClusterIP directly. Requires ingress resource &amp; ingress controller to receive external traffic. </li>
<li><strong>LoadBalancer</strong>: Allows you receive external traffic to one and only one service</li>
</ul></li>
</ol>

<p><strong>Ingress</strong>: This isn't a type of service, it is another type of Kubernetes resource. By configuring <a href="https://github.com/kubernetes/ingress-nginx/" rel="nofollow noreferrer">NGINX Ingress</a> for example, you can handle traffic to multiple ClusterIP services with only on external LoadBalancer. </p>

<ol start="3">
<li><strong>A Developer needs to troubleshoot a pod/service:</strong> <code>kubectl port-forward</code>: <a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/#forward-a-local-port-to-a-port-on-the-pod" rel="nofollow noreferrer">Port forwarding example</a> Requires <code>kubectl</code> to be configured on the system hence it cannot be used for all users of the application</li>
</ol>

<p>As you can see from the above explanation, the proxy and port-forwarding option aren't viable options for connecting external traffic to the applications running because it requires your <code>kubectl</code> installed and configured with a valid <code>kubeconfig</code> which grants access into your cluster.</p>
