<p>I have a K8S service (app-filestash-testing) running like following:</p>
<pre><code>NAME                    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE
app-filestash-testing   ClusterIP   10.111.128.18   &lt;none&gt;        10000/TCP   18h
kubernetes              ClusterIP   10.96.0.1       &lt;none&gt;        443/TCP     20h
</code></pre>
<p>I used the following yaml file to create an Ingress trying reach this service:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: app-filestash-testing
spec:
  rules:
  - host: www.masternode.com
    http:
      paths:
      - backend:
          serviceName: app-filestash-testing
          servicePort: 10000
</code></pre>
<p>In the <em>/etc/hosts</em> file, I made this change (I used the worker node public IP):</p>
<pre><code>127.0.0.1 localhost
xx.xxx.xxx.xxx www.masternode.com
</code></pre>
<p>However, when I checked the Ingress, I saw that the Ingress port is 80.</p>
<pre><code>NAME                    CLASS   HOSTS                ADDRESS   PORTS   AGE
app-filestash-testing   nginx   www.masternode.com             80      14h
</code></pre>
<p>Currently the service is running and listening on port 10000, but the Ingress port is 80.</p>
<p>I am just wondering is there any method/ setting to change the port number of Ingress to 10000? How to reach this service through Ingress? Is is possible to set the port number in <em>/etc/hosts</em> file?</p>
<p>Thanks.</p>

maantarng
<p>From: <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#what-is-ingress" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/ingress/#what-is-ingress</a></p>
<blockquote>
<p>An Ingress does not expose arbitrary ports or protocols. Exposing services other than HTTP and HTTPS to the internet typically uses a service of type Service.Type=NodePort or Service.Type=LoadBalancer.</p>
</blockquote>
<p>NodePort might be what you are looking for. More information and options are documented here: <a href="https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types</a></p>
