gpt4 book ai didi

kubernetes - 如果 https 流量,我如何将入口转发到 ssl 端口(443)

转载 作者:行者123 更新时间:2023-12-04 14:46:11 24 4
gpt4 key购买 nike

入口如何将 https 流量转发到服务的端口 443(最终到我的容器上的 8443)?我是否必须对我的入口进行任何更改,还是自动完成。

在 GCP 上,我有一个第 4 层平衡器 -> nginx-ingress Controller -> 入口

我的入口是:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-keycloak
annotations:
kubernetes.io/ingress.class: "nginx"
certmanager.k8s.io/issuer: "letsencrypt-prod"
certmanager.k8s.io/acme-challenge-type: http01


spec:
tls:
- hosts:
- mysite.com
secretName: staging-iam-tls
rules:
- host: mysite.com
http:
paths:
- path: /auth
backend:
serviceName: keycloak-http
servicePort: 80

我在网上搜索,但我没有看到达到 443 的明确例子。它总是 80(或 8080)

我的服务 keycloak-http是(被省略,我的容器实际上在 8443 监听)
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2019-05-15T12:45:58Z
labels:
app: keycloak
chart: keycloak-4.12.0
heritage: Tiller
release: keycloak
name: keycloak-http
namespace: default
..
spec:
clusterIP: ..
externalTrafficPolicy: Cluster
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
- name: https
port: 443
protocol: TCP
targetPort: 8443
selector:
app: keycloak
release: keycloak
sessionAffinity: None
type: NodePort
status:
loadBalancer: {}

最佳答案

尝试这个:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-keycloak
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
certmanager.k8s.io/issuer: "letsencrypt-prod"
certmanager.k8s.io/acme-challenge-type: http01
spec:
tls:
- hosts:
- mysite.com
secretName: staging-iam-tls
rules:
- host: mysite.com
http:
paths:
- path: /auth
backend:
serviceName: keycloak-http
servicePort: 443

关于kubernetes - 如果 https 流量,我如何将入口转发到 ssl 端口(443),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56187391/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com