And*_*eus 11 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
Run Code Online (Sandbox Code Playgroud)
小智 16
您无法阻止Kubernetes创建新的安全组.但自从Andonaeus的回答提交后,我们又添加了一项新功能,允许通过服务的配置文件显式定义入站权限.
有关详细信息,请参阅用户指南详细信息.这里提供的示例显示,通过使用,spec.loadBalancerSourceRanges
您可以提供允许入站IP:
在以下示例中,将创建一个只能由IP地址为130.211.204.1和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
Run Code Online (Sandbox Code Playgroud)