By default Kubernetes will only create externally facing load balancers from a cloud provider(AWS, GCE, etc) when creating a Load Balanced service. To overwrite this and create an ELB in AWS that only contains private subnets add the following annotation to the METADATA section of your service definition file.
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
For example the following will create an internal only load balance service for an NGINX appliction:
metadata:
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
namespace: default
name: nginx-lb
labels:
nginx: app
spec:
type: LoadBalancer
ports:
- port: 80
protocol: TCP
targetPort: 80
name: http
- port: 443
protocol: TCP
targetPort: 443
name: https
selector:
nginx: app
Comments
0 comments
Please sign in to leave a comment.