Kubernetes helm 使用Https的舵图服务端口和入口

Kubernetes helm 使用Https的舵图服务端口和入口,kubernetes-helm,kubernetes-ingress,Kubernetes Helm,Kubernetes Ingress,在安装入口和映射Helm 3中的部署和服务资源期间,使用https的web应用程序的配置应该是什么 我应该在Service.port下面定义https端口和名称,还是只更改Service.port名称和端口?或者使用TLS已经涵盖了这一点 ports: port: {{ .Values.service.port }} targetPort: 80 protocol: TCP name: http name:https

在安装入口和映射Helm 3中的部署和服务资源期间,使用https的web应用程序的配置应该是什么

我应该在Service.port下面定义https端口和名称,还是只更改Service.port名称和端口?或者使用TLS已经涵盖了这一点

   ports:
      port: {{ .Values.service.port }}
      targetPort: 80
      protocol: TCP
      name: http

      name:https
      port:443
服务。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:
  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
Ingress.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:
  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 }}

入口和服务不完整,只强调了重要部分。

+1,你能在这里看到我的类似问题吗:+1,你能在这里看到我的类似问题吗: