Ingress后端REST错误:服务器遇到临时错误,无法完成您的请求。请在30秒后重试

时间:2018-03-02 20:12:30

标签: kubernetes google-cloud-platform google-kubernetes-engine

我正在google kubernetes引擎部署应用程序。 Applicaion有2项服务。还有Ingress我试图用来公开一个服务,ingress也用于https支持。我有1 NodePort服务"网关"和ClusterIp服务"内部"。 "内部"应该从网关访问。这是服务配置:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: x-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: x-x-ip
    kubernetes.io/tls-acme: "true"
  labels:
    app: gateway
spec:
  tls:
    - secretName: secret
      hosts:
      - x.x.com
  backend:
    serviceName: gateway
    servicePort: 80
---
apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer
metadata:
  name: x-x
spec:
  acme:
    server: https://acme-v01.api.letsencrypt.org/directory
    email: x@x.com
    privateKeySecretRef:
      name: x-x
    http01: {}
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
  name: gateway
  labels:
    app: gateway
spec:
  type: NodePort
  ports:
  - port: 80
    name: gateway
    targetPort: 8080
  selector:
    app: gateway
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
  name: internal
  labels:
    app: internal
spec:
  ports:
  - port: 8082
    name: internal
    targetPort: 8082
  selector:
    app: internal

网关提供静态内容和REST资源。静态内容服务正常,所以我看到HTML和图像和脚本。但是当我尝试调用REST端点时,我得到The server encountered a temporary error and could not complete your request. Please try again in 30 seconds.网关转发REST请求到"内部"来自内部的服务和回复响应。使用网址http://internal:8082/some/rest访问网关访问内部服务。当我打电话给任何要求转发给#34;内部"。

时,我收到了错误

Actualy我有相同的方案,没有Ingress,它的工作原理。 "网关"是LoadBalancer服务和"内部"是NodePort。对于https,我需要Ingress

UPD:我发现我没有与8082端口相关的任何转发规则,只有80443(我使用了gcloud compute forwarding-rules list和{{ 1}}命令)。

以下是gcloud compute forwarding-rules describe

的输出
kubectl describe svc

UPD2:这是Name: gateway Namespace: default Labels: app=gateway Annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints=true Selector: app=gateway Type: NodePort IP: * Port: gateway 80/TCP TargetPort: 8080/TCP NodePort: gateway 31168/TCP Endpoints: *:8080 Session Affinity: None External Traffic Policy: Cluster Events: <none> --- Name: internal Namespace: default Labels: app=internal Annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints=true Selector: app=internal Type: ClusterIP IP: * Port: internal 8082/TCP TargetPort: 8082/TCP Endpoints: *:8082 Session Affinity: None Events: <none> 输出问题网址:

curl -v

当此网址请求时,网关日志中没有任何内容。

1 个答案:

答案 0 :(得分:1)

问题出现在网关应用程序和Ingress组合中,我升级了网关应用程序版本并开始工作