简体   繁体   English

kubernetes LoadBalancer服务

[英]kubernetes LoadBalancer service

Trying to teach myself on how to use Kubernetes, and having some issues. 尝试教自己如何使用Kubernetes,并遇到一些问题。

I was able to set up a cluster, deploy the nginx image and then access nginx using a service of type NodePort (once I added the port to the security group inbound rules of the node). 我能够设置一个集群,部署nginx映像,然后使用NodePort类型的服务访问nginx(将端口添加到节点的安全组入站规则之后)。

My next step was to try to use a service of type LoadBalancer to try to access nginx. 我的下一步是尝试使用类型为LoadBalancer的服务来尝试访问nginx。

I set up a new cluster and deployed the nginx image. 我设置了一个新集群并部署了nginx映像。

kubectl \
       create deployment my-nginx-deployment \
       --image=nginx

I then set up the service for the LoadBalancer 然后,我为LoadBalancer设置服务

kubectl expose deployment my-nginx-deployment --type=LoadBalancer --port=80 --target-port=8080 --name=nginxpubic

Once it was done setting up, I tried to access nginx using the LoadBalancer Ingress (Which I found from describing the LoadBalancer service). 设置完成后,我尝试使用LoadBalancer Ingress(从描述LoadBalancer服务时发现)访问nginx。 I received a This page isn't working error. 我收到此页面无法正常工作的错误。

Not really sure where I went wrong. 不太确定我哪里出了错。

results of kubectl get svc kubectl get svc的结果

NAME         TYPE           CLUSTER-IP      EXTERNAL-IP                                                               PORT(S)        AGE
kubernetes   ClusterIP      100.64.0.1      <none>                                                                    443/TCP        7h
nginxpubic   LoadBalancer   100.71.37.139   a5396ba70d45d11e88f290658e70719d-1485253166.us-west-2.elb.amazonaws.com   80:31402/TCP   7h

From the nginx dockerhub page , I see that the container is using port 80. 从nginx dockerhub页面,我看到该容器正在使用端口80。

https://hub.docker.com/_/nginx/ https://hub.docker.com/_/nginx/

It should be like this: 应该是这样的:

kubectl expose deployment my-nginx-deployment --type=LoadBalancer --port=80 --target-port=80 --name=nginxpubic

Also, make sure the service type loadbalancer is available in your environement. 另外,请确保您所在的环境中可用的服务类型负载均衡器。

Known Issues for minikube installation minikube安装的已知问题

Features that require a Cloud Provider will not work in Minikube. These include:
LoadBalancers

Features that require multiple nodes. These include:
Advanced scheduling policies

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

相关问题 Kubernetes 负载均衡器服务与云负载均衡器 - Kubernetes loadbalancer service vs cloud loadbalancer 使用 loadBalancer 服务时,无法在 Kubernetes 上生产/消费到 Kafka - Unable to produce/consume to Kafka on Kubernetes when using loadBalancer Service Kubernetes LoadBalancer 服务未获取 ELB 外部 IP 地址 - Kubernetes LoadBalancer service not getting ELB external IP address TLS 不适用于 Kubernetes 中的 LoadBalancer 支持的服务 - TLS doesn't work with LoadBalancer backed Service in Kubernetes 如何使用 `service.spec.externalIPs` 而不是 `--type=LoadBalancer` 在 AWS 上公开 Kubernetes 服务? - How to expose a Kubernetes service on AWS using `service.spec.externalIPs` and not `--type=LoadBalancer`? 如何自定义由使用AWS NLB作为TCP服务的Kubernetes LoadBalancer类型服务创建的安全组入口规则 - How to customize the Security Group Ingress Rules created by a Kubernetes LoadBalancer type service that uses AWS NLB for TCP services 服务(LoadBalancer)端口在AWS上不起作用 - Service (LoadBalancer) port not working on aws Kubernetes 和 UDP 负载均衡器和基于 IP 的粘性会话 - Kubernetes with an UDP loadbalancer with sticky sessions based on IP EC2实例在loadbalancer中无法使用 - EC2 instance is out of service in loadbalancer AWS EKS:服务(LoadBalancer)正在运行但不响应请求 - AWS EKS: Service(LoadBalancer) running but not responding to requests
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM