amazon-web-services - Kubernetes 和 AWS : Set LoadBalancer to use predefined Security Group

标签 amazon-web-services kubernetes aws-elb

正如标题所说,我正在寻找一种方法来强制 LoadBalancer 服务使用 AWS 中的预定义安全组。我不想手动编辑由 Kubernetes 为 ELB 创建的安全组的入站/出站规则。我无法在文档中找到任何内容,也没有找到任何在线其他地方有效的内容。这是我当前的模板:

apiVersion: v1
kind: Service
metadata:
  name: ds-proxy
spec:
  type: LoadBalancer
  ports:
  - port: 8761 # the port that this service should serve on
    targetPort: 8761
    protocol: TCP
  selector:
    app: discovery-service

最佳答案

您无法阻止 Kubernetes 创建新的安全组。但是自从 Andonaeus 的回答被提交以来,一个新功能已经被添加,它允许通过您的服务的配置文件显式定义入站权限。

the user guide details对于具体情况。那里提供的示例表明,通过使用 spec.loadBalancerSourceRanges您可以提供允许入站 IP:

In the following example, a load blancer will be created that is only accessible to clients with IP addresses from 130.211.204.1 and 130.211.204.2.


apiVersion: v1
kind: Service
metadata:
  name: myapp
spec:
  ports:
    - port: 8765
      targetPort: 9376
  selector:
    app: example
  type: LoadBalancer
  loadBalancerSourceRanges:
  - 130.211.204.1/32
  - 130.211.204.2/32

关于amazon-web-services - Kubernetes 和 AWS : Set LoadBalancer to use predefined Security Group,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34748320/

相关文章:

python - Amazon Polly ProfileNotFound : The config profile (adminuser) could not be found

amazon-web-services - 无法在 IAM 中使用 CDK 构造/CFN 资源的可访问 ARN

amazon-web-services - 将对象从一个 S3 存储桶移动到另一个存储桶时,是否可以触发 S3 PUT 事件?

java - AWS ECS : Task Being Mapped to Wrong Target Group

amazon-web-services - AWS Load Balancer 允许 URL 路径上的某些 IP 地址

amazon-web-services - 使用 UDP ECS 服务对 NetworkLoadBalancer 进行健康检查

amazon-web-services - 带有 Api 网关的 AWS Route 53 通配符子域

kubernetes - 在Kubernetes中是否有针对关机或在杀死Pod之前的探针?

amazon-web-services - 如何让 kubectl 登录 AWS EKS 集群?

docker - 恢复后Elasticsearch节点会同步数据吗?