【问题标题】:Security group inbound rules wiped out and added 0.0.0.0/0 by eksclusterrole automaticallyeksclusterrole 自动清除并添加 0.0.0.0/0 的安全组入站规则
【发布时间】:2022-05-06 03:35:07
【问题描述】:

我已经部署了 AWS EKS 2 节点集群(版本 1.18)。它包含一些 ELB、微服务和托管在 Kubernetes 上的 UI。 ELB 有自己的安全组。我手动修改主副本的安全组的入站规则,以启用对端口 27017 上特定 IP(例如:117.123.111.99/32)的数据库的访问。但是,我注意到几天后会自动为端口 27017 添加入站规则-所有 3 个 mongo 副本 LoadBalancer 安全组的 0.0.0.0/0 和自定义 ICMP-IPv4 0.0.0.0/0。

当我在“CloudTrail”中看到日志时,它说的是 eksclusterrole

                "type": "Role",
                "principalId": “blablabla”,
                "arn": "arn:aws:iam::MyAccountId:role/eksclusterrole",
                "accountId": "MyAccountId",
                "userName": "eksclusterrole"
            },
            "webIdFederationData": {},
            "attributes": {
                "mfaAuthenticated": "false",
                "creationDate": “date”
            }
        },
        "invokedBy": "eks.amazonaws.com"
    },
    "eventTime": "date",
    "eventSource": "ec2.amazonaws.com",
    "eventName": "AuthorizeSecurityGroupIngress",
    "awsRegion": "us-east-2”,
    "sourceIPAddress": "eks.amazonaws.com",
    "userAgent": "eks.amazonaws.com",
    "requestParameters": {
        "groupId": "sg-mysecurityid,
        "ipPermissions": {
            "items": [
                {
                    "ipProtocol": "icmp",
                    "fromPort": 3,
                    "toPort": 4,
                    "groups": {},
                    "ipRanges": {
                        "items": [
                            {
                                "cidrIp": "0.0.0.0/0"
                            }
                        ]
                    },
                    "ipv6Ranges": {},
                    "prefixListIds": {}
                },
                {
                    "ipProtocol": "tcp",
                    "fromPort": 27017,
                    "toPort": 27017,
                    "groups": {},
                    "ipRanges": {
                        "items": [
                            {
                                "cidrIp": "0.0.0.0/0"
                            }
                        ]
                    },
                    "ipv6Ranges": {},
                    "prefixListIds": {}
                }
            ]
        }
    }

【问题讨论】:

  • 你有什么问题?
  • @JohnRotenstein - 我的问题是为什么 eks 集群角色会自动将入站规则更改为 0.0.0.0/0,我多次遇到这种情况,我想知道我在 EKS 中犯了什么错误。谢谢..

标签: mongodb kubernetes amazon-eks aws-security-group replicaset


【解决方案1】:

来自Docs

Amazon EKS 为客户端流量的节点安全组添加一条入站规则,并为 VPC 中的每个负载均衡器子网添加一条规则,以检查您创建的每个网络负载均衡器的运行状况

可以禁用Docs

service.beta.kubernetes.io/aws-load-balancer-manage-backend-security-group-rules 指定控制器是否应自动将入口规则添加到实例/ENI 安全组。

【讨论】:

    猜你喜欢
    • 2022-01-22
    • 1970-01-01
    • 2020-04-23
    • 2022-06-11
    • 2017-08-10
    • 2021-03-31
    • 2021-08-01
    • 2022-08-09
    • 2018-02-27
    相关资源
    最近更新 更多