问题描述
我正在尝试使用minikube将微服务映像构建并部署到在我的开发计算机上运行的单节点Kubernetes集群.我正在使用Google的云原生微服务演示应用程序Online Boutique来了解Kubernetes,Istio等技术的使用.
I am trying to build and deploy microservices images to a single-node Kubernetes cluster running on my development machine using minikube. I am using the cloud-native microservices demo application Online Boutique by Google to understand the use of technologies like Kubernetes, Istio etc.
链接到github存储库: microservices-demo
Link to github repo: microservices-demo
我已经按照所有安装过程在本地构建和部署微服务,并且能够通过我的浏览器访问Web前端.但是,当我单击任何产品图片说时,我会看到此错误页面.
I have followed all the installation process to locally build and deploy the microservices, and am able to access the web frontend through my browser. However, when I click on any of the product images say, I see this error page.
在使用kubectl get pod进行检查时我意识到我的一个Pod(推荐服务)的状态为CrashLoopBackOff.运行 kubectl describe pods Recommendationservice-55b4d6c477-kxv8r
:
On doing a check using kubectl get podsI realize that one of my pods( Recommendation service) has status CrashLoopBackOff.Running kubectl describe pods recommendationservice-55b4d6c477-kxv8r
:
Namespace: default
Priority: 0
Node: minikube/192.168.99.116
Start Time: Thu, 23 Jul 2020 19:58:38 +0530
Labels: app=recommendationservice
app.kubernetes.io/managed-by=skaffold-v1.11.0
pod-template-hash=55b4d6c477
skaffold.dev/builder=local
skaffold.dev/cleanup=true
skaffold.dev/deployer=kubectl
skaffold.dev/docker-api-version=1.40
skaffold.dev/run-id=49913ced-e8df-40a7-9336-a227b56bcb5f
skaffold.dev/tag-policy=git-commit
Annotations: <none>
Status: Running
IP: 172.17.0.14
IPs:
IP: 172.17.0.14
Controlled By: ReplicaSet/recommendationservice-55b4d6c477
Containers:
server:
Container ID: docker://2d92aa966a82fbe58c8f40f6ecf9d6d55c29f8081cb40e0423a2397e1419350f
Image: recommendationservice:2216d526d249cc8363129aed9a09d752f9ad8f458e61e50a2a99c59d000606cb
Image ID: docker://sha256:2216d526d249cc8363129aed9a09d752f9ad8f458e61e50a2a99c59d000606cb
Port: 8080/TCP
Host Port: 0/TCP
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Error
Exit Code: 137
Started: Thu, 23 Jul 2020 21:09:33 +0530
Finished: Thu, 23 Jul 2020 21:09:53 +0530
Ready: False
Restart Count: 29
Limits:
cpu: 200m
memory: 450Mi
Requests:
cpu: 100m
memory: 220Mi
Liveness: exec [/bin/grpc_health_probe -addr=:8080] delay=0s timeout=1s period=5s #success=1 #failure=3
Readiness: exec [/bin/grpc_health_probe -addr=:8080] delay=0s timeout=1s period=5s #success=1 #failure=3
Environment:
PORT: 8080
PRODUCT_CATALOG_SERVICE_ADDR: productcatalogservice:3550
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-sbpcx (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
default-token-sbpcx:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-sbpcx
Optional: false
QoS Class: Burstable
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Pulled 44m (x15 over 74m) kubelet, minikube Container image "recommendationservice:2216d526d249cc8363129aed9a09d752f9ad8f458e61e50a2a99c59d000606cb" already present on machine
Warning Unhealthy 9m33s (x99 over 74m) kubelet, minikube Readiness probe failed: timeout: failed to connect service ":8080" within 1s
Warning BackOff 4m25s (x294 over 72m) kubelet, minikube Back-off restarting failed container
在事件中,我看到 Readiness探针失败:超时:无法连接服务:8080&";在1秒内
.原因是什么,我该如何解决?感谢您的帮助!
In Events, I see Readiness probe failed: timeout: failed to connect service ":8080" within 1s
.What is the reason and how can I resolve this?Thanks for the help!
推荐答案
答案
就绪探针"的超时时间(1秒)太短.
Answer
The timeout of the Readiness Probe (1 second) was too short.
定义相关的就绪探测器,以便在 server
容器内运行/bin/grpc_health_probe -addr =:8080
.
The relevant Readiness Probe is defined such that /bin/grpc_health_probe -addr=:8080
is run inside the server
container.
您希望这样的探针1秒钟的超时就足够了,但是它正在Minikube上运行,因此可能会影响探针的超时.
You would expect a 1 second timeout to be sufficient for such a probe but this is running on Minikube so that could be impacting the timeout of the probe.
这篇关于就绪探针失败:超时:无法连接服务“:8080&";1秒内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!