访问 traefik dashboard
端口转发
# 访问地址 http://192.168.0.201:9000/dashboard/#/
kubectl -n kube-system port-forward $(kubectl -n kube-system get pods --selector "app.kubernetes.io/name=traefik" --output=name) 9000:9000 --address 0.0.0.0
配置域名
1、创建 ingress 配置文件 traefik-dashboard-web.yaml
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: traefik-dashboard-web
namespace: kube-system
spec:
entryPoints:
- web
routes:
- kind: Rule
match: Host(`traefik.domain.com`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
services:
- kind: TraefikService
name: api@internal # 固定值,不用修改
2、执行部署
kubectl apply -f traefik-dashboard-web.yaml
3、配置 DNS 解析,访问地址 https://traefik.domain.com/dashboard/#/
开启跨命名空间访问
默认情况 traefik ingress 是不开启此项功能的,需要手动启用
新增配置文件 /var/lib/rancher/k3s/server/manifests/traefik-config.yaml
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
globalArguments:
- "--providers.kubernetescrd.allowCrossNamespace=true"
部署
kubectl apply -f traefik-config.yaml
标签:web,kind,name,k3s,traefik,yaml,dashboard
From: https://www.cnblogs.com/lemos/p/17343143.html