[英]Google Kubernetes Engine Ingress UNHEALTHY backend service
Kind Note: I have googled a lot and take a look too many questions related to this issue at StackOverflow also but couldn't solve my issue, that's why don't mark this as duplicate, please!
温馨提示:我在Google上搜索了很多东西,在StackOverflow上也查看了很多与此问题相关的问题,但无法解决我的问题,因此,请不要将其标记为重复项!
I'm trying to deploy 2 services (One is Python flask and other is NodeJS) on Google Kubernetes Engine. 我正在尝试在Google Kubernetes Engine上部署2个服务(一个是Python flask,另一个是NodeJS)。 I have created two Kubernetes-deployments one for each service and two Kubernetes-services one for each service of type
NodePort
. 我为每个服务创建了两个Kubernetes部署,为NodePort类型的每个服务创建了两个Kubernetes-
NodePort
。 Then, I have created an Ingress and mentioned my endpoints
but Ingress says that One backend service is UNHEALTHY
. 然后,我创建了一个Ingress并提到了我的
endpoints
但是Ingress说一个后端服务是UNHEALTHY
。
Here are my Deployments YAML definitions: 这是我的部署YAML定义:
# Pyservice deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: pyservice
labels:
app: pyservice
namespace: default
spec:
selector:
matchLabels:
app: pyservice
template:
metadata:
labels:
app: pyservice
spec:
containers:
- name: pyservice
image: docker.io/arycloud/docker_web_app:pyservice
ports:
- containerPort: 5000
imagePullSecrets:
- name: docksecret
# # Nodeservice deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nodeservice
labels:
app: nodeservice
namespace: default
spec:
selector:
matchLabels:
app: nodeservice
template:
metadata:
labels:
app: nodeservice
tier: web
spec:
containers:
- name: nodeservice
image: docker.io/arycloud/docker_web_app:nodeservice
ports:
- containerPort: 8080
imagePullSecrets:
- name: docksecret
And, here are my services and Ingress YAML definitions: 而且,这是我的服务和Ingress YAML定义:
# pyservcie service
kind: Service
apiVersion: v1
metadata:
name: pyservice
spec:
type: NodePort
selector:
app: pyservice
ports:
- protocol: TCP
port: 5000
nodePort: 30001
---
# nodeservcie service
kind: Service
apiVersion: v1
metadata:
name: nodeservcie
spec:
type: NodePort
selector:
app: nodeservcie
ports:
- protocol: TCP
port: 8080
nodePort: 30002
---
# Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: "gce"
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /
backend:
serviceName: pyservice
servicePort: 5000
- path: /*
backend:
serviceName: pyservice
servicePort: 5000
- path: /node/svc/
backend:
serviceName: nodeservcie
servicePort: 8080
The pyservice
is working fine but the nodeservice
shows as UNHEALTHY
backend. 该
pyservice
工作正常,但nodeservice
显示为UNHEALTHY
后端。 Here's a screenshot: 这是屏幕截图:
Even I have edited the Firewall Rules
for all gke-....
and allow all ports just for getting out from this issue, but it still showing the UNHEALTHY
status for nodeservice
. 连我都编辑的
Firewall Rules
对于所有gke-....
并允许所有端口只是从这个问题失控,但它仍然显示UNHEALTHY
的状态nodeservice
。
What's wrong here? 怎么了
Thanks in advance! 提前致谢!
Why are you using a GCE ingress class and then specifying a nginx rewrite annotation? 为什么要使用GCE入口类,然后指定Nginx重写注释? In case you haven't realised, the annotation won't do anything to the GCE ingress.
如果您尚未意识到,则注释不会对GCE入口产生任何作用。
You have also got 'nodeservcie' as your selector instead of 'nodeservice'. 您还拥有“ nodeservcie”作为选择器,而不是“ nodeservice”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.