Helm Chart ServicePort 和 Ingress with Https
Helm Chart ServicePort and Ingress with Https
在设置 Ingress 期间使用 https 的 Web 应用程序应该如何配置以及与 Helm 3 中的 Deployment 和 Service 资源映射。
我应该在 Service.ports 下定义 https 端口和名称,还是只更改 Service.Port 名称和端口?或者使用 TLS 已经覆盖了这个?
ports:
port: {{ .Values.service.port }}
targetPort: 80
protocol: TCP
name: http
name:https
port:443
Service.yaml
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 80
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "road-dashboard.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
Ingress.yaml
ingress:
enabled: false
annotations:
kubernetes.io/ingress.class: traefik
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
ingress-traefik-dashboard * 80 42h
Tls 设置是通过入口完成的。所以你需要你的入口重定向到你的服务。
你不需要在你的服务中创建一个 https 端口,处理它是入口的工作。
您的配置将是这样的:
入口:
rules:
- host: example.com
http:
paths:
- path: /api($|/)(.*)
backend:
serviceName: "{{ .Release.Name }}-api-service"
servicePort: {{ .Values.service.port }}
服务:
metadata:
name: "{{ .Release.Name }}-api-service"
spec:
ports:
- port: {{ .Values.service.port }}
targetPort: 80
name: http
type: {{ .Values.service.type }}
Ingress和Service不完整,只强调了重要的部分。
在设置 Ingress 期间使用 https 的 Web 应用程序应该如何配置以及与 Helm 3 中的 Deployment 和 Service 资源映射。
我应该在 Service.ports 下定义 https 端口和名称,还是只更改 Service.Port 名称和端口?或者使用 TLS 已经覆盖了这个?
ports:
port: {{ .Values.service.port }}
targetPort: 80
protocol: TCP
name: http
name:https
port:443
Service.yaml
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 80
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "road-dashboard.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
Ingress.yaml
ingress:
enabled: false
annotations:
kubernetes.io/ingress.class: traefik
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
ingress-traefik-dashboard * 80 42h
Tls 设置是通过入口完成的。所以你需要你的入口重定向到你的服务。 你不需要在你的服务中创建一个 https 端口,处理它是入口的工作。
您的配置将是这样的:
入口:
rules:
- host: example.com
http:
paths:
- path: /api($|/)(.*)
backend:
serviceName: "{{ .Release.Name }}-api-service"
servicePort: {{ .Values.service.port }}
服务:
metadata:
name: "{{ .Release.Name }}-api-service"
spec:
ports:
- port: {{ .Values.service.port }}
targetPort: 80
name: http
type: {{ .Values.service.type }}
Ingress和Service不完整,只强调了重要的部分。