主机的 Kubernetes Ingress 白名单 IP
Kubernetes Ingress Whitelist IP for host
如何将同一路径的不同主机的 IP 地址列入白名单?
example.com - 应该没有白名单。所有其他人都必须列入白名单。
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: login.example.com
http:
paths:
- backend:
serviceName: login
servicePort: 4444
path: /
- host: admin.example.com
http:
paths:
- backend:
serviceName: admin
servicePort: 3333
path: /
- host: api.example.com
http:
paths:
- backend:
serviceName: api
servicePort: 2222
path: /
- host: example.com
http:
paths:
- backend:
serviceName: wp
servicePort: 1111
path: /
注释:
nginx.ingress.kubernetes.io/whitelist-source-range: "1.1.1.1/24"
基本上@ANISH 给了你关于 nginx.ingress.kubernetes.io/whitelist-source-range 的好主意,你可以从哪里开始。
You can specify allowed client IP source ranges through the
nginx.ingress.kubernetes.io/whitelist-source-range annotation. The
value is a comma separated list of CIDRs, e.g. 10.0.0.0/24,172.10.0.1.
To configure this setting globally for all Ingress rules, the
whitelist-source-range value may be set in the NGINX ConfigMap.
但是,如果您不想将其应用于所有入口规则 - 只需创建 2 个单独的入口。 1 个用于列入白名单的主机,第二个用于您的 example.com 主机
如何将同一路径的不同主机的 IP 地址列入白名单?
example.com - 应该没有白名单。所有其他人都必须列入白名单。
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: login.example.com
http:
paths:
- backend:
serviceName: login
servicePort: 4444
path: /
- host: admin.example.com
http:
paths:
- backend:
serviceName: admin
servicePort: 3333
path: /
- host: api.example.com
http:
paths:
- backend:
serviceName: api
servicePort: 2222
path: /
- host: example.com
http:
paths:
- backend:
serviceName: wp
servicePort: 1111
path: /
注释: nginx.ingress.kubernetes.io/whitelist-source-range: "1.1.1.1/24"
基本上@ANISH 给了你关于 nginx.ingress.kubernetes.io/whitelist-source-range 的好主意,你可以从哪里开始。
You can specify allowed client IP source ranges through the nginx.ingress.kubernetes.io/whitelist-source-range annotation. The value is a comma separated list of CIDRs, e.g. 10.0.0.0/24,172.10.0.1.
To configure this setting globally for all Ingress rules, the whitelist-source-range value may be set in the NGINX ConfigMap.
但是,如果您不想将其应用于所有入口规则 - 只需创建 2 个单独的入口。 1 个用于列入白名单的主机,第二个用于您的 example.com 主机