简体   繁体   English

如何在AWS中设置kubernetes的loaderbalancer服务

[英]how to setup loaderbalancer service of kubernetes in AWS

i try to use AWS to setup kubernetes(version 1.0.1) and deploy a few services and pods there. 我尝试使用AWS来设置kubernetes(版本1.0.1)并在那里部署一些服务和pod。

but i have got stuck with LoadBalancer service. 但我已经陷入了LoadBalancer服务。 According to the docs i just need to setup correct type of service and open ports in firewall 根据文档,我只需要在防火墙中设置正确的服务类型和打开端口

But service doesn't receive external IP. 但服务不接收外部IP。 (ingress is empty) (进入是空的)

Do i need to create LoadBalancer manually in AWS console? 我是否需要在AWS控制台中手动创建LoadBalancer? maybe some another actions? 也许还有其他一些动作

Thanks, 谢谢,

The LoadBalancer should be getting created automatically. 应该自动创建LoadBalancer。

There might be IAM policy issues preventing the load balancer from being created (see Issue #10692 ). 可能存在阻止创建负载均衡器的IAM策略问题(请参阅问题#10692 )。

If that isn't the problem, looking for errors in /var/log/kube-controller-manager.log on the master VM may give you an idea of what is going wrong. 如果这不是问题,在主VM上查找/var/log/kube-controller-manager.log中的错误可能会让您知道出了什么问题。

This step is different whether you are using kubernetes over google cloud (where External IP is shown by issuing kubectl get svc ) or over amazon aws. 无论您是使用kubernetes而不是使用kubernetes(通过发布kubectl获取svc来显示外部IP)还是使用amazon aws,这一步都是不同的。 After launching your cluster (aws or gcloud) then deploying your app using kubectl create -f some-deployment.yaml you issue 启动集群(aws或gcloud)后,使用kubectl create -f some-deployment.yaml部署应用程序

kubectl expose rs your-pod-name  --type="LoadBalancer"

to expose your app ... then chill a few minutes until command 暴露你的应用......然后冷却几分钟,直到命令

kubectl get pods

responds back with column STATUS has value Running ... only then issue 使用列回复状态STATUS具有值Running ...然后才发出

kubectl get svc

which after a few minutes will show EXTERNAL-IP on gcloud as per 几分钟后,将在gcloud上显示EXTERNAL-IP

NAME                       CLUSTER-IP       EXTERNAL-IP       PORT(S)                   AGE
kubernetes                 10.123.240.1     <none>            443/TCP                   10m
loudspeed-deployment-210   10.123.247.54    104.196.113.166   3000/TCP,80/TCP,443/TCP   1m
mongo                      10.123.244.245   <none>            27017/TCP                 5m

whereas on aws the EXTERNAL-IP will partially display the URL of your LoadBalancer Ingress ... to see the full URL just issue 而在aws上,EXTERNAL-IP将部分显示LoadBalancer Ingress的URL ...以查看完整的URL问题

kubectl describe svc

typical output would be 典型的输出是

Labels:         app=my-cool-app,pod-template-hash=494629853
Selector:       app=my-cool-app,pod-template-hash=494629853
Type:           LoadBalancer
IP:         10.0.154.138
LoadBalancer Ingress:   a53bigscarystring33e-20075.us-east-1.elb.amazonaws.com
Port:           port-1  80/TCP
NodePort:       port-1  30487/TCP
Endpoints:      10.244.0.3:80
Port:           port-2  443/TCP
NodePort:       port-2  32698/TCP
Endpoints:      10.244.0.3:443
Session Affinity:   None
Events:
  FirstSeen LastSeen    Count   From            SubobjectPath   Type        Reason          Message
  --------- --------    -----   ----            -------------   --------    ------          -------
  14m       14m     1   {service-controller }           Normal      CreatingLoadBalancer    Creating load balancer
  13m       13m     1   {service-controller }           Normal      CreatedLoadBalancer Created load balancer


Name:           mongo
Labels:         name=mongo
Selector:       name=mongo
Type:           ClusterIP
IP:         10.0.63.81
Port:           <unset> 27017/TCP
Endpoints:      10.244.0.4:27017
Session Affinity:   None
No events.

note in above value of 注意上面的值

    LoadBalancer Ingress:   a53bigscarystring33e-20075.us-east-1.elb.amazonaws.com

that is your External URL which is visible from command line using 这是您的外部URL,可以从命令行使用

curl a53bigscarystring33e-20075.us-east-1.elb.amazonaws.com

and is typically mapped to your publicly visible domain in your aws Route 53 console on the Resource Type A auto refreshed picklist 并且通常映射到资源类型A自动刷新的选项列表中的aws Route 53控制台中的公共可见域

See details like ( we do not automatically open NodePort services in the AWS firewall) https://github.com/kubernetes/kubernetes/blob/release-1.3/docs/design/aws_under_the_hood.md 查看详细信息(我们不会在AWS防火墙中自动打开NodePort服务) https://github.com/kubernetes/kubernetes/blob/release-1.3/docs/design/aws_under_the_hood.md

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM