如何在AWS上获取kubernetes负载均衡器服务的永久IP地址? [英] How to get permanent ip address of a kubernetes load balancer service on AWS?
问题描述
如何在AWS kubernetes群集中以永久IP地址发布服务,以便添加DNS记录?我在kubernetes中定义了类型为LoadBalancer
的服务xxx
,并且kubectl describe service xxx
给了我类似的东西:
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
实际上,我可以在aae55ce563ca611e692c10a83aef9ddc-467886677.eu-west-1.elb.amazonaws.com:9004上访问该应用程序.如何使它成为永久IP地址?
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?
推荐答案
正如@ error2007s所说,您不能为ELB获得静态IP.但是,如果您只想为ELB分配域名,则可以使用指向aae55ce563ca611e692c10a83aef9ddc-467886677.eu-west-1.elb.amazonaws.com
的CNAME记录.如果您使用的是Route53,则还可以定义别名以获得更好的性能.在托管区域下创建一个记录集,选择类型A
,在别名:"下选择是",最后从下拉框中选择您的ELB.
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.
两个选项均由Amazon记录:
Both options are documented by Amazon:
这篇关于如何在AWS上获取kubernetes负载均衡器服务的永久IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!