如何将Ingress与基本身份验证结合使用,但仅适用于某些路由? [英] How do I use Ingress with basic auth but only for certain routes?
问题描述
如何在域的每条路径上使用基本身份验证进行入口(除了其中一条路径).我的入口看起来像这样:
apiVersion:extensions/v1beta1
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
我想做的是在除/successfull_login
之外的每个路径上都具有基本身份验证,当我点击x.x.x/successfull_login
时不需要凭据.
我尝试使用不使用基本身份验证但仍需要基本身份验证的路径创建一个新的Ingress.
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
我该怎么做?
推荐答案
如注释中所述,所采用的解决方案是在新的docker映像中分离应用程序视图,并为此新代码段创建新的部署和服务
As mentioned in comments, the solution adopted was separate the application view in a new docker image, also a new deployment and service was created to this new piece of code.
这篇关于如何将Ingress与基本身份验证结合使用,但仅适用于某些路由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!