在k8中为我的角度应用程序获取502 Bad Gateway nginx / 1.13.9



在 k8 的浏览器中访问时,我的角度应用程序得到了 502 个错误的网关 nginx/1.13.9。我的服务和入口如下。

Angular 应用程序 Pod 日志显示所有成功,事实上端口转发工作正常。同样的图像在我的本地机器中使用 docker 也能正常工作。

从k8s日志中,我可以看到以下内容:

[错误] 1534

#1534:*32272457 SSL_do_handshake(( 失败(SSL: 错误:1408F10B:SSL 例程:ssl3_get_record:版本号错误( 而 SSL 握手到上游

服务:


Name:              test-portal
Namespace:         testproject
Labels:            app=test-portal
chart=test-portal-1.0.0
environment=dev
heritage=Tiller
release=test-portal
version=dev
Annotations:       <none>
Selector:          app=test-portal,release=test-portal
Type:              ClusterIP
IP:                x.x.x.x
Port:              <unset>  80/TCP
TargetPort:        4200/TCP
Endpoints:         x.x.x.x:4200
Session Affinity:  None
Events:            <none>

入口:


Name:             test-portal
Namespace:        testproject
Address:
Default backend:  default-http-backend:80 (<none>)
TLS:
SNI routes test-portal.us-west-2.xxxxx.xxxxxx.delivery
Rules:
Host                                                       Path  Backends
----                                                       ----  --------
test-portal.us-west-2.xxxxx.xxxxxx.delivery
/  test-portal:80 (<none>)
Annotations:
secure-backends:  true
ssl-redirect:     true
Events:             <none>

入口配置映射


apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/secure-backends: "false"
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"ingress.kubernetes.io/secure-backends":"false","kubernetes.io/ingress.class":"nginx"},"labels":{"app":"test-portal","chart":"test-portal-1.0.0","environment":"dev","heritage":"test-portal","release":"Helm","version":"1.0.0"},"name":"test-portal","namespace":"testproject"},"spec":{"rules":[{"host":"test-portal.us-west-2.xxxx.xxxxxxxxx.delivery","http":{"paths":[{"backend":{"serviceName":"test-portal","servicePort":80},"path":"/"}]}}],"tls":[{"hosts":["test-portal.us-west-2.xxxx.xxxxxxxxx.delivery"]}]}}
kubernetes.io/ingress.class: nginx
creationTimestamp: 2020-01-08T11:24:18Z
generation: 1
labels:
app: test-portal
chart: test-portal-1.0.0
environment: dev
heritage: test-portal
release: Helm
version: 1.0.0
name: test-portal
namespace: testproject
resourceVersion: "2379156945"
selfLink: /apis/extensions/v1beta1/namespaces/testproject/ingresses/test-portal
uid: 6925819b-3209-11ea-80fb-02fb0c9060d8
spec:
rules:
- host: test-portal.us-west-2.xxxx.xxxxxxxxx.delivery
http:
paths:
- backend:
serviceName: test-portal
servicePort: 80
path: /
tls:
- hosts:
- test-portal.us-west-2.xxxx.xxxxxxxxx.delivery
status:
loadBalancer:
ingress:
- {}

您似乎正在 pod 中的端口 4200 上运行角度开发服务器。 角度应用程序使用 http 而不是 https 提供,因此您必须将入口配置为不使用 https(安全后端:false(进行后端通信。

此外,角度开发服务器不应用于生产服务。使用角度生产构建构建容器映像,以从大大提高的性能中受益。

相关内容

  • 没有找到相关文章

最新更新