ingress发布https

功能介绍

1、指定ingressClassName

2、配置https发布

3、设置80是否自动跳转443

创建tls证书

Usage:
  kubectl create secret tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none]

ingress配置

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false" #设置80是否自动跳转443,false不跳转
  generation: 3
  name: demo-example-net
  namespace: default
spec:
  ingressClassName: nginx #ingress1.22后,需要指定ingressclass类型,不添加此配置无法使用
  rules:
  - host: demo.example.net
    http:
      paths:
      - backend:
          service:
            name: nginx
            port:
              number: 80
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - demo.example.net
    secretName: example-net

你可能感兴趣的:(k8s,kubernetes)