【问题标题】:Network Policy not working correctly, Not able to curl http://169.254.169.254/latest/meta-data/网络策略无法正常工作,无法 curl http://169.254.169.254/latest/meta-data/
【发布时间】:2020-11-04 18:30:44
【问题描述】:

这是我的网络政策。我正在使用 calico 插件在 EKS 中申请

kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  name: net-document
  namespace: default
spec:
  policyTypes:
  - Egress
  - Ingress
  podSelector:
    matchLabels:
      app: test-document
  ingress:
  - {}
  egress:
  - to:
    ports:
    - port: 53
      protocol: TCP
    - port: 53
      protocol: UDP
    - port: 5000
      protocol: TCP
    - port: 5000
      protocol: UDP
    - port: 27017
      protocol: TCP
    - port: 443
      protocol: TCP
    - port: 443
      protocol: UDP
    - port: 6379
      protocol: TCP
    - port: 8080
      protocol: TCP
    - port: 80
      protocol: TCP
    - port: 80
      protocol: UDP
    - port: 5672
      protocol: TCP
    - port: 943
      protocol: TCP
    - port: 1194
      protocol: TCP

但是当我进入吊舱并做时

curl http://169.254.169.254/latest/meta-data/

我收到超时错误。它应该像我允许的端口 80 一样运行。

【问题讨论】:

    标签: amazon-web-services kubernetes-networkpolicy


    【解决方案1】:

    如错误中所述,您的 pod 无权调用 AWS API。

    确保正确的前缀列表在 443 上列入白名单

    【讨论】:

    • Pod 有权限。当我删除网络策略时,这意味着我打开所有端口的出口,然后一切正常。我需要为 AWS API 打开哪些端口??
    • 只是 HTTPS。即使您有 VPC 网关/端点,S3 ip 也始终是可公开路由的。他们的前缀需要被列入白名单。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-24
    • 2021-08-16
    • 2014-10-04
    • 2021-10-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多