解决HTTP未自动重定向到HTTPS问题,编辑
在 K3s 服务器的 /var/lib/rancher/k3s/server/manifests/目录下创建一个新文件,例如 traefik-config.yaml。
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
additionalArguments:
- --entrypoints.web.http.redirections.entryPoint.to=websecure
- --entrypoints.web.http.redirections.entryPoint.scheme=https
ports:
websecure:
# 定义 Traefik Pod 内部监听的 HTTPS 端口
port: 443 # 将此处从 8443 改为 443
# 这并不影响 Service 对外暴露的 443 端口