<p>(The final goal of what I am doing is to access my application via node IP address)</p>
<p>My cluster is using Traefik ingress controller.
The Ingress rule is:</p>
<pre><code>      kind: Ingress
      ...
      ...
      spec:
        rules:
          - host: my.app
            http:
              paths:
                - pathType: ImplementationSpecific
                  path: /
                  backend:
                    service:
                      name: my-app-svc
                      port:
                        number: 3000
</code></pre>
<p>There is also a <code>LoadBalancer</code> service deployed:</p>
<pre><code>k get svc -n kube-system traefik
NAME      TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)                      AGE
traefik   LoadBalancer   10.43.58.233   192.168.10.82   80:32003/TCP,443:30554/TCP   40d
</code></pre>
<p>As you can see the external IP is <code>192.168.10.82</code> for this <code>LoadBalancer</code> service.</p>
<p>On my laptop, I map that external IP with the hostname in <code>/etc/hosts</code>:</p>
<pre><code>192.168.10.82 my.app
</code></pre>
<p>I can successfully access my deployed application via the external IP: <a href="http://my.app" rel="nofollow noreferrer">http://my.app</a></p>
<p><strong>Now, I would like to access it via IP address instead.</strong>
This is what I try to do below:
<a href="https://i.stack.imgur.com/1yGQ7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1yGQ7.png" alt="enter image description here" /></a></p>
<p>So, I have deployed a <code>NodePort</code> service for the controller:</p>
<pre><code>      apiVersion: v1
      kind: Service
      metadata:
        name: traefik-node-port-svc
        namespace: kube-system
      spec:
        type: NodePort
        ports:
        - name: http
          port: 80
          targetPort: 80
          nodePort: 30182
          protocol: TCP
        - name: https
          port: 443
          targetPort: 443
          nodePort: 30183
          protocol: TCP
        selector:
          app: traefik
</code></pre>
<p>I can see this <code>NodePort</code> service is deployed:</p>
<pre><code>NAME                    TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
traefik-node-port-svc   NodePort   10.43.148.128   &lt;none&gt;        80:30182/TCP,443:30183/TCP   69m
</code></pre>
<p>As you can see above, the exposed port for HTTP traffic is <code>30182</code>.</p>
<p>Then, I get the node (I have only one node):</p>
<pre><code>k get node -o wide
NAME        STATUS   ROLES                  AGE   VERSION        INTERNAL-IP     EXTERNAL-IP   OS-IMAGE              KERNEL-VERSION     CONTAINER-RUNTIME
testk3s01   Ready    control-plane,master   40d   v1.21.5+k3s2   192.168.10.82   &lt;none&gt;        k3OS v0.21.5-k3s2r1   5.4.0-88-generic   containerd://1.4.11-k3s1
</code></pre>
<p>I can see above that the node's internal IP is <code>192.168.10.82</code>.</p>
<p>I then try to access my application via <code>&lt;node internal IP&gt;:&lt;NodePort svc exposed port&gt;</code></p>
<pre><code>&gt; curl 192.168.10.82:30182
curl: (7) Failed to connect to 192.168.10.82 port 30182 after 7 ms: Connection refused
</code></pre>
<p>But connection is refused, why is that? How can I access my application via IP address directly?</p>
<p>The <code>NodePort</code> service detail is like following:</p>
<pre><code>&gt; kubectl describe svc traefik-node-port-svc -n kube-system
Name:                     traefik-node-port-svc
Namespace:                kube-system
Labels:                   &lt;none&gt;
Annotations:              &lt;none&gt;
Selector:                 app=traefik
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.43.148.128
IPs:                      10.43.148.128
Port:                     http  80/TCP
TargetPort:               80/TCP
NodePort:                 http  30182/TCP
Endpoints:                &lt;none&gt;
Port:                     https  443/TCP
TargetPort:               443/TCP
NodePort:                 https  30183/TCP
Endpoints:                &lt;none&gt;
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>
<p><strong>==== Update based on @Sibtain's answer ====</strong></p>
<p>I tried the option 2 of @Sibtain's answer to figure out the correct <code>targetPort</code> for my <code>NodePort</code> service.</p>
<p>I first try to find the <code>targetPort</code> from that <code>LoadBalancer</code> service:</p>
<pre><code>&gt; kubectl get svc traefik -o yaml -n kube-system

...
...
ports:
  - name: web
    nodePort: 32003
    port: 80
    protocol: TCP
    targetPort: web
  - name: websecure
    nodePort: 30554
    port: 443
    protocol: TCP
    targetPort: websecure
  selector:
    app.kubernetes.io/instance: traefik
    app.kubernetes.io/name: traefik
  sessionAffinity: None
  type: LoadBalancer
</code></pre>
<p>As you can see above, the <code>targetPort</code> which points to the application pod is <code>80</code> for http &amp; <code>443</code> https respectively. I can also see the <code>Selector</code> section used by this service.</p>
<p>So, I updated my <code>NodePort</code> Service manifest to point to the same <code>targetPort</code>:</p>
<pre><code>      apiVersion: v1
      kind: Service
      metadata:
        name: traefik-node-port-svc
        namespace: kube-system
      spec:
        type: NodePort
        ports:
        - name: web
          port: 80
          targetPort: web
          nodePort: 30182
          protocol: TCP
        - name: websecure
          port: 443
          targetPort: websecure
          nodePort: 30183
          protocol: TCP
        selector:
          app.kubernetes.io/name: traefik
          app.kubernetes.io/instance: traefik
</code></pre>
<p>I re-deployed this <code>NodePort</code> Service. But when check again, it still has <code>&lt;none&gt;</code> endpoint:</p>
<pre><code>&gt; kubectl describe svc traefik-node-port-svc -n kube-system
Name:                     traefik-node-port-svc
Namespace:                kube-system
Labels:                   &lt;none&gt;
Annotations:              &lt;none&gt;
Selector:                 app.kubernetes.io/instance=traefik,app.kubernetes.io/name=traefik,app=traefik
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.43.148.128
IPs:                      10.43.148.128
Port:                     web  80/TCP
TargetPort:               web/TCP
NodePort:                 web  30182/TCP
Endpoints:                &lt;none&gt;
Port:                     websecure  443/TCP
TargetPort:               websecure/TCP
NodePort:                 websecure  30183/TCP
Endpoints:                &lt;none&gt;
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>
<p>Now all the services under the <code>kube-system</code> shows me this:</p>
<pre><code>kubectl get svc -n kube-system
NAME                    TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)                      AGE
kube-dns                ClusterIP      10.43.0.10      &lt;none&gt;          53/UDP,53/TCP,9153/TCP       41d
metrics-server          ClusterIP      10.43.111.166   &lt;none&gt;          443/TCP                      41d
traefik                 LoadBalancer   10.43.58.233    192.168.10.82   80:32003/TCP,443:30554/TCP   40d
traefik-node-port-svc   NodePort       10.43.148.128   &lt;none&gt;          80:30182/TCP,443:30183/TCP   19h
</code></pre>
<p>The curl result:</p>
<pre><code>&gt; curl 192.168.10.82:30182
curl: (7) Failed to connect to 192.168.10.82 port 30182 after 10 ms: Connection refused

&gt; curl 192.168.10.82:80
404 page not found

&gt; curl 192.168.10.82:30183
curl: (7) Failed to connect to 192.168.10.82 port 30183 after 860 ms: Connection refused

&gt; curl 192.168.10.82:443
404 page not found
</code></pre>

user842225
<p>Your Service <code>traefik-node-port-svc</code> has no <code>Endpoints</code> attached to it (note the <code>&lt;none&gt;</code> in <code>describe</code> output)</p>
<p>This means there are no pods that the service can redirect the request to. Most likely you have an incorrect <code>TargetPort</code> or the <code>selector</code> label (<code>app: traefik</code>) is wrong.</p>
<p>To fix the <code>targetPort</code> you can opt any of the two options below:</p>
<ol>
<li>Run the <code>kubectl describe pod &lt;traefik-pod-here&gt;</code> and note down the
<code>port</code>. That should be the <code>targetPort</code> in <code>traefik-node-port-svc</code>
specification.</li>
<li>Run <code>kubectl describe svc traefik -n kube-system</code> and note the
<code>targetPort</code> from there as you have an already running LoadBalancer
Service so it means that it is redirecting the request to the
appropriate pods.</li>
</ol>
<p>If the issue is with the <code>selector</code> label, you can check the labels by running <code>kubectl get pod &lt;traefik-pod-here&gt; --show-labels</code> and add the appropriate labels.</p>
<p><strong>EDIT</strong></p>
<p>The easier way to create a Service and make sure you get the labels right is to use the declarative <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#expose" rel="nofollow noreferrer"><code>kubectl expose</code></a> command, assuming that the traefik pod is running as a Deployment named <code>traefik</code> on port <code>9000</code>, the command would look something like: (<em>Note: the actual nodePort would be allocated automatically from the range 30000-32767</em>)</p>
<pre><code>kubectl expose deployment traefik --name=traefik-node-port-svc --type=NodePort --port=80 --target-port=8000
</code></pre>
