traefik

更新时间:2025年10月10日 22:30 浏览:1358

安装

官方安装说明

https://doc.traefik.io/traefik/getting-started/install-traefik/

helm 安装脚本

helm repo add traefik https://traefik.github.io/charts

helm repo update

# deployment.kind=DaemonSet
helm install traefik traefik/traefik \
--set deployment.kind=DaemonSet

# 删除
helm uninstall traefik

指定参数

以 DaemonSet 安装到所有主节点,监听 80 和 443

values.yaml

deployment:
  kind: DaemonSet

tolerations:
  - key: "node-role.kubernetes.io/control-plane"
    operator: "Exists"
    effect: "NoSchedule"

nodeSelector:
  node-role.kubernetes.io/control-plane: ""

ports:
  web:
    port: 80
    expose:
      default: true
    exposedPort: 80
    nodePort: 80
  websecure:
    port: 443
    expose:
      default: true
    exposedPort: 443
    nodePort: 443

service:
  type: NodePort

# 容器内使用 80 和 443 端口时,需要使用 root 权限
podSecurityContext:
  runAsNonRoot: false
  runAsUser: 0
  runAsGroup: 0
  fsGroup: 0
securityContext:
  capabilities:
    drop: [ALL]
    add: [NET_BIND_SERVICE]

安装

helm install traefik traefik/traefik \
  --namespace traefik \
  --create-namespace \
  -f values.yaml

完整 values.yaml 参数:
https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml

导航