二进制

1
2
3
4
wget https://github.com/containous/traefik/releases/download/v1.7.9/traefik_linux-amd64
curl -k -o traefik.toml https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml
chmod +x traefik_linux-amd64
./traefik_linux-amd64 --configFile=traefik.toml

配置

修改80端口

1
2
3
[entryPoints]
    [entryPoints.http]
    address=":8090"

修改8080端口

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[entryPoints]
    [entryPoints.traefik]
    address=":8091"

[metrics]
  [metrics.prometheus]
    entryPoint = "traefik"
    buckets = [0.1,0.3,1.2,5.0]
# http://127.0.0.1:8091/dashboard/
# curl http://127.0.0.1:8091/metrics
# curl http://127.0.0.1:8091/health

systemd

k8s

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# examples/k8s/traefik-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/v1.7/examples/k8s/traefik-rbac.yaml
# examples/k8s/traefik-deployment.yaml
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/v1.7/examples/k8s/traefik-deployment.yaml
# examples/k8s/traefik-ds.yaml
#kubectl apply -f https://raw.githubusercontent.com/containous/traefik/v1.7/examples/k8s/traefik-ds.yaml
kubectl --namespace=kube-system get pod,svc -o wide
# examples/k8s/ui.yaml
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/v1.7/examples/k8s/ui.yaml
# 测试traefik-ui
curl -H 'host:traefik-ui.minikube' http://<node-ip>:<nodeport>
curl -H 'host:traefik-ui.minikube' http://<CLUSTER-IP>:<port>
curl -H 'host:traefik-ui.minikube' http://<EXTERNAL-IP>:<port>
# <a href="/dashboard/">Found</a>

参考