相关疑难解决方法(0)

路径的 Kubernetes 入口白名单 IP

我知道我可以将整个入口对象的 IP 列入白名单,但是有没有办法将单个路径的 IP 列入白名单?例如,如果我只想允许/admin10.0.0.0/16?

ingress.yml

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: frontend
  namespace: default
  labels:
    app: frontend
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    #nginx.ingress.kubernetes.io/whitelist-source-range: "10.0.0.0/16"
spec:
  tls:
    - hosts:
        - frontend.example.com
      secretName: frontend-tls
  rules:
    - host: frontend.example.com
      http:
        paths:
          - path: /
            backend:
              serviceName: frontend
              servicePort: 80
          - path: /api
            backend:
              serviceName: api
              servicePort: 8000
          - path: /admin
            backend:
              serviceName: api
              servicePort: 8000
          - path: /staticfiles
            backend:
              serviceName: api
              servicePort: 80
Run Code Online (Sandbox Code Playgroud)

nginx kubernetes kubernetes-ingress

5
推荐指数
2
解决办法
7619
查看次数

标签 统计

kubernetes ×1

kubernetes-ingress ×1

nginx ×1