<p>I have 2 local vms on different clusters.
On the first one, I have a pod that listens on port <code>9090</code></p>
<pre><code>gateway gRPC server starting {&quot;address&quot;: &quot;0.0.0.0:9090&quot;}
</code></pre>
<p>How can I expose this port on the VM to make the connection from the second VM to this pod?</p>
<p>Both vms are in the same network and they can see each other</p>
<p>Currently the pod has a SVC of type <code>ClusterIP</code></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  creationTimestamp: &quot;2023-06-09T06:21:57Z&quot;
  labels:
    app.kubernetes.io/name: myapp
    service-type: public
  name: myapp
  namespace: myapp
  ownerReferences:
  - apiVersion: core.opni.io/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: Gateway
    name: myapp
    uid: 5cf052fb-31cb-43b4-8b3c-264a4d2240ce
  resourceVersion: &quot;371786&quot;
  uid: 95a07669-fe15-40a2-9614-21d33475a54b
spec:
  clusterIP: 10.43.66.183
  clusterIPs:
  - 10.43.66.183
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: grpc
    port: 9090
    protocol: TCP
    targetPort: grpc
  - name: noauth
    port: 4000
    protocol: TCP
    targetPort: noauth
  selector:
    app.kubernetes.io/name: myapp
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}
</code></pre>
<p>Is it possible to expose this app on the <code>nodeIP:9090</code> ?</p>

Kristian Zhelyazkov
<p>ClusterIP service works within the cluster. You cannot use clusterIP to connect to virtual machines in different clusters. In this case where <strong>NodePort service</strong> comes in.</p>
<p>A NodePort is an open port on every node of your cluster. Kubernetes transparently routes incoming traffic on the NodePort to your service, even if your application is running on a different node.Refer to the <a href="https://sysdig.com/blog/kubernetes-services-clusterip-nodeport-loadbalancer/" rel="nofollow noreferrer">link</a> by Javier Martinez for more information on service types</p>
<p>Whenever a new Kubernetes cluster gets built and If you set the type field to NodePort, one of the available configuration parameters is <code>service-node-port-range</code> which defines a range of ports to use for NodePort allocation and usually defaults to <code>30000-32767</code></p>
<p>So, Nodeport service uses a port range from 30000 for which you may not use port 9090 for exposing the application.</p>
