<p>I have a pod that has following chart:</p>

<pre><code>ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
    // ...
  paths:
    - /api/myservice
</code></pre>

<p>My pod exposes api and additionally a <code>/prometheus</code> endpoint that is accessible through <code>/api/myservice/prometheus</code>.</p>

<p>I would like to have <code>prometheus</code> visible inside my cluster but not from <code>/api/myservice/prometheus</code>. How I can achieve that?</p>

pixel
<p>You can add an Ingress rule that redirects the endpoint to the default-backend:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: block
  annotations:
    ingress.kubernetes.io/ssl-redirect: "true"
    ingress.kubernetes.io/rewrite-target: /
spec:
  tls:
  - hosts:
    - myapp.to
  rules:
  - host: myapp.to
    http:
      paths:
      - path: /metrics
        backend:
          serviceName: ingress-default-backend
          servicePort: 8080
</code></pre>
