How to get permanent ip address of a kubernetes load balancer service on AWS?

时间秒杀一切 提交于 2019-12-08 07:12:34

问题


How can I publish a service in an AWS kubernetes cluster at a permanent IP address, so that I can add a DNS record? I define service xxx of type LoadBalancer in kubernetes, and kubectl describe service xxx gives me something like:

LoadBalancer Ingress:   aae55ce563ca611e692c10a83aef9ddc-467886677.eu-west-1.elb.amazonaws.com
Port:           <unset> 9004/TCP

Indeed, I can access the application on aae55ce563ca611e692c10a83aef9ddc-467886677.eu-west-1.elb.amazonaws.com:9004. How can I make this a permanent IP address?


回答1:


As @error2007s said, you can't get a static IP for ELB. But if all you want is to assign a domain name to your ELB, then you can use a CNAME record pointing to aae55ce563ca611e692c10a83aef9ddc-467886677.eu-west-1.elb.amazonaws.com. If you're using Route53 you can also define an alias for better performance. Create a record set under your hosted zone, choose type A, select Yes under "Alias: ", and finally select your ELB from the dropdown box.

Both options are documented by Amazon:

http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/using-domain-names-with-elb.html




回答2:


For AWS ELB you cannot make a permanent IP address as the IP address for AWS ELB is dynamic and changes frequently. So you have to use "aae55ce563ca611e692c10a83aef9ddc-467886677.eu-west-1.elb.amazonaws.com" as the Canonical name for your application. Also refer this question Amazon EC2 Elastic Load Balancer: Does its IP ever Change?



来源:https://stackoverflow.com/questions/38063891/how-to-get-permanent-ip-address-of-a-kubernetes-load-balancer-service-on-aws

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!