簡體   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