[英]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.