How do I block paths in my (k8s) ingress?

7/1/2020

I have a subset of paths that I expose with an ingress. I'd like to block them for anyone coming through the ingress.

I'm trying this with a GCE Ingress

Adding a rule like:

 - host: my.example.com
    http:
      paths:
      - backend:
          serviceName: dead-end-backend
          servicePort: 80
        path: /private

This backend is designated dead-end using Nginx default backend deployment/service but it's not working well.

I'm not asking how to use the default-backend (but it solve it).

I'm asking for a proper way to do this.

-- Amir Mehler
kubernetes
kubernetes-ingress

1 Answer

7/24/2020

I'm not sure it's the best thing to do but what I did was use a "default-backend" service which returns error for anything. Then I added each route I wanted to block to get to that default backend.

Like the saying - if it's silly, but it's working, then it's not silly.

-- Amir Mehler
Source: StackOverflow