<p>I've set up an ingress to route traffic to my http server, however I would like to leave some routes inaccessible from outside of the cluster.</p>
<p>Example routes:</p>
<pre><code>/status -&gt; end point to determine service status

/users/names -&gt; returns users

/users/ages -&gt; returns ages
</code></pre>
<p>current ingress:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  namespace: my-namespace
  name: my-app-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: localhost
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: my-service
            port:
              number: 8080
</code></pre>
<p>this works currently but leaves all routes accessible. What I want to do is only have routes that fall under the <code>/users</code> path open, so that would be both <code>/users/names</code> and <code>/users/ages</code>. That would leave <code>/status</code> inaccessible from outside of the cluster. Is this achievable from changing the ingress configuration? Any help would be appreciated.</p>

<p>Just specify the path that you want to expose via the ingress like this:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  namespace: my-namespace
  name: my-app-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: localhost
    http:
      paths:
      - pathType: Prefix
        path: /users # &lt;- add the path here
        backend:
          service:
            name: my-service
            port:
              number: 8080
</code></pre>
