How do I use Ingress with basic auth but only for certain routes?

折月煮酒 提交于 2020-11-29 21:07:47

问题


How do I make an ingress with basic auth on every path of the domain except on one. My ingress looks like this:
apiVersion: extensions/v1beta1

kind: Ingress
metadata:
  name: frontend-ingress
  namespace: dev
  labels:
    app: x
  annotations:
    kubernetes.io/ingress.global-static-ip-name: x.x.x
    ingress.kubernetes.io/auth-secret: "basic-auth"
    ingress.kubernetes.io/auth-type: "basic"
spec:
  rules:
  - host: x.x.x
    http:
      paths:
      - path: /
        backend:
          serviceName: hello
          servicePort: 80 

What i wanna make is to have basic auth on every path except on /successfull_login , when I hit x.x.x/successfull_login not to require credentials. I tried making a new Ingress just with that path that doesn't use basic auth but still it require basic auth.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-successfull-login
  namespace: dev
  labels:
    app: x
  annotations:
    kubernetes.io/ingress.global-static-ip-name: x.x.x
spec:
  rules:
  - host: x.x.x
    http:
      paths:
      - path: /successfull_login
        backend:
          serviceName: hello
          servicePort: 80

How do i do it?

来源:https://stackoverflow.com/questions/64858553/how-do-i-use-ingress-with-basic-auth-but-only-for-certain-routes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!