1
| helm repo add traefik https://traefik.github.io/charts
|
1 2
| helm repo update helm search repo traefik
|
https://doc.traefik.io/traefik/getting-started/kubernetes/#using-helm-values-file
1
| kubectl create ns traefik
|
1
| helm pull traefik/traefik --untar
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| # values.yaml ingressRoute: dashboard: enabled: true matchRule: Host(`dashboard.localhost`) entryPoints: - web providers: kubernetesGateway: enabled: true gateway: listeners: web: namespacePolicy: from: All
|
1 2 3 4 5
| tolerations: - key: "node-role.kubernetes.io/control-plane" operator: "Equal" effect: "NoSchedule" node-role.kubernetes.io/master:NoSchedul
|
1 2
| nodeSelector: kubernetes.io/hostname: "k8s201"
|
1 2
| service: # 使用 hostport 模式就不需要Service了 enabled: false
|
1 2 3 4 5 6 7 8 9 10 11 12
| ~~~~#### xxxxxxx 不要管这个,默认就好。该hostNetwork 就好。~~~~ #### 还是需要管这个的。, ports: traefik: port: 8080 hostPort: 8080 # 使用 hostport 模式 web: port: 8000 hostPort: 80 # 使用 hostport 模式 websecure: port: 8443 hostPort: 443 # 使用 hostport 模式
|
1 2 3
| ingressRoute: dashboard: enabled: false
|
1 2 3
| logs: general: level: DEBUG
|
1 2
| ## #### xxxxxxx 不要管这个 hostNetwork: true
|
hostNetwork 和 hostPort 冲突。只能开一个。
查看污点或标签,需要和自己的一致。
1 2
| kubectl describe node | grep -i taint -C3 kubectl get node --show-labels
|
1
| helm install traefik -n traefik . -f values.yaml
|
1
| helm upgrade traefik . -n traefik -f values.yaml
|
1
| kubectl get pod -n traefik
|
测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| ####xxxxxxxxxxxxxxx 不能用这个api版本了,1.35 apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: name: dashboard namespace: traefik spec: entryPoints: - web routes: - match: Host(`traefik.bravexist.cn`) kind: Rule services: - name: api@internal kind: TraefikService
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| apiVersion: traefik.io/v1alpha1 # 只需要改这一行 kind: IngressRoute metadata: name: dashboard namespace: traefik spec: entryPoints: - web routes: - match: Host(`traefik.bravexist.cn`) kind: Rule services: - name: api@internal kind: TraefikService
|
1
| kubectl apply -f 0003-dashboard.yaml
|
1 2 3 4 5 6
| ```
绑定域名后,确实可以访问了,nodeselect 部署traefik到 k8s201 了。
|
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: argo-rollouts-dashboard
namespace: argo-rollouts
spec:
entryPoints:
- web # 只监听普通的 80 端口 (HTTP)
routes:
- match: Host(
argo-rollouts.bravexist.cn) # 你的访问域名
kind: Rule
services:
- name: argo-rollouts-dashboard # 你的 Service 名称
port: 3100 # 你的 Service 端口