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?
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. Created 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
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?