我是Kubernetes的新手,正在尝试使用TLS(使用随附的GCE Ingress Controller)在Google容器引擎上进行HTTP负载平衡。我遇到的错误即使在Google's official tutorial之后也可以重复。为了便于阅读,我在config.yaml
中总结了该过程:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
template:
metadata:
labels:
name: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
name: nginx
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
selector:
name: nginx
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: basic-ingress
spec:
backend:
serviceName: nginx
servicePort: 80
然后:
kubectl create -f config.yaml
export NODE_PORT=$(kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services nginx)
gcloud compute firewall-rules create allow-130-211-0-0-22 --source-ranges 130.211.0.0/22 --allow tcp:$NODE_PORT
curl <ip_of_load_balancer>
(我删除了防火墙规则上的标签,因此它将适用于所有规则)。
但是我得到了
502 Server Error
,according to the docs意味着它很可能会引导(但始终保持这种状态)。我在控制台上看到后端不正常。在文档中,为了避免这一需求:
nginx
图像,并且该服务通过常规的负载均衡器正常运行)那么,此错误的原因是什么,我该如何进一步调试呢?
最佳答案
我离开集群过夜,现在可以正常工作了。似乎需要花很多时间进行引导,或者Google Cloud方面已修复了某些问题。
关于kubernetes - Kubernetes/GCE入口 Controller 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38037750/