我无法在我的 kubernetes (1.14) 集群中使用 Traefik 的 IPWhitelist 中间件。
我在这里使用 DaemonSet 配置:
https://docs.traefik.io/user-guide/kubernetes/
我想将此白名单应用于所有进出集群的流量。
- 如何适用于所有流量?
- 我可以使用注释而不是 IngressRoute 吗?
- 是否有我错过的示例或文档?
谢谢!
这是我到目前为止所拥有的:
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: middlewares.traefik.containo.us
spec:
group: traefik.containo.us
version: v1alpha1
names:
kind: Middleware
plural: middlewares
singular: middleware
scope: Namespaced
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: cloudflare-whitelist
spec:
ipWhiteList:
sourceRange:
- 2400:cb00::/32
...
- 131.0.72.0/22
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: allup
annotations:
traefik.frontend.rule.type: PathPrefixStrip
spec:
tls:
- secretName: cloudflare-tls-cert
rules:
- host: example.com
http:
paths:
- path: /
backend:
serviceName: app-www-service
servicePort: http
- host: stuff.example.com
http:
paths:
- path: /
backend:
serviceName: app-stuff-service
servicePort: http
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: cloudflare-whitelist
namespace: ingress
spec:
entryPoints:
- web # <- what is this for?
routes:
- match: Host(`example.com`) # <- Howto apply to all ingress?
kind: Rule
middlewares:
- name: cloudflare-whitelist
- match: Host(`stuff.example.com`)
kind: Rule
middlewares:
- name: cloudflare-whitelist
- 如何适用于所有流量?
- 我可以使用注释而不是 IngressRoute 吗?
- 是否有我错过的示例或文档?
谢谢!