我在我的 aks 集群中使用 Kong 入口控制器,我尝试添加 key-auth 插件以在我的入口中使用,它可以工作,但是在这个设置中存在一个大问题,所有使用这个插件的入口的所有密钥都工作,即使在不同的命名空间中。
这是我的设置:
一个名为 nginx1 的新应用程序:
...
annotations:
konghq.com/plugins: nginx1-apikey
kubernetes.io/ingress.class: kong
...
---
apiVersion: configuration.konghq.com/v1
kind: KongConsumer
metadata:
name: nginx1
namespace: nginx1
annotations:
kubernetes.io/ingress.class: kong
username: nginx1
credentials:
- nginx1-apikey
---
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: nginx1-apikey
namespace: nginx1
plugin: key-auth
以及名为 nginx2 的第二个应用程序:
...
annotations:
konghq.com/plugins: nginx2-apikey
kubernetes.io/ingress.class: kong
...
---
apiVersion: configuration.konghq.com/v1
kind: KongConsumer
metadata:
name: nginx2
namespace: nginx2
annotations:
kubernetes.io/ingress.class: kong
username: nginx2
credentials:
- nginx1-apikey
---
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: nginx2-apikey
namespace: nginx2
plugin: key-auth
我为每个插件创建了一个秘密:
kubectl create secret -n nginx1 generic nginx1-apikey \
--from-literal=kongCredType=key-auth \
--from-literal=key=1234
kubectl create secret -n nginx2 generic nginx2-apikey \
--from-literal=kongCredType=key-auth \
--from-literal=key=5678
有什么方法可以限制特定入口的秘密?