文档说明:只记录关键地方;
试验环境: linux debian 11
目标:自建K8S 对外提供 http https 服务
生成TLS
kubectl create -n default secret tls com-xiaoshuogeng-tls-cert-secret \
--key=/data/tls/wildcard.xiaoshuogeng.com.key.pem \
--cert=/data/tls/wildcard.xiaoshuogeng.com.fullchain.pem
ingress-nginx 配置路由
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-com-xiaoshuogeng-confluence
namespace: default
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: "True"
spec:
ingressClassName: nginx
rules:
- host: confluence.xiaoshuogeng.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: com-xiaoshuogeng-confluence-service
port:
number: 80
tls:
- hosts:
- confluence.xiaoshuogeng.com
secretName: com-xiaoshuogeng-tls-cert-secret