繁体   English   中英

Kubernetes LoadBalancer没有响应? (适用于Windows的Docker)

[英]Kubernetes LoadBalancer is not responding? (Docker for Windows)

如何在Windows版Docker上设置Kubernetes与LoadBalancer一起使用?

我有一个非常简单的Kubernetes你好世界:

kubectl run my-nginx --image=nginx --replicas=1 --port=80
kubectl expose deployment my-nginx --port=80 --type=LoadBalancer
kubectl get svc
kubectl describe service my-nginx
curl -m 10 http://localhost/
curl -m 10 http://localhost:32026/

它不起作用,本地主机没有响应。 我得到的输出是:

deployment.apps "my-nginx" created
service "my-nginx" exposed
NAME       TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
my-nginx   LoadBalancer   10.103.126.2   localhost     80:32026/TCP   0s
Name:                     my-nginx
Namespace:                default
Labels:                   run=my-nginx
Annotations:              <none>
Selector:                 run=my-nginx
Type:                     LoadBalancer
IP:                       10.103.126.2
LoadBalancer Ingress:     localhost
Port:                     <unset>  80/TCP
TargetPort:               80/TCP
NodePort:                 <unset>  32026/TCP
Endpoints:                <none>
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
curl: (28) Operation timed out after 10000 milliseconds with 0 bytes received
curl: (28) Operation timed out after 10000 milliseconds with 0 bytes received

在外部IP中,LoadBalancer似乎在那里,但它不起作用。

我已经测试过,我可以使用kubectl exec pod-name -it -- bash进入pod,并且可以看到nginx在pod中运行。 但是,无法从Windows访问。

我还测试了与Docker映像的连接确实可以正常工作

docker run -dit --rm --name nginx -p 80:80 nginx
curl -m 10 http://localhost/
docker stop nginx

这可行。

在Kubernetes中与LoadBalancer的连接以某种方式断开了,对其他人有用吗?有什么方法可以解决此问题?

Docker for Windows,版本2.0.0.3(31259),通道:稳定,版本:8858db3

服务器正在侦听端口32270,请尝试localhost:32270

暂无
暂无

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

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