我正在尝试使用here中的指南将Traefik安装在Kubernetes中。
我执行了以下操作:
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-ds.yaml
,然后检查我的豆荚收到以下信息:
kubectl --namespace=kube-system get pods
coredns-78fcdf6894-5bslk 0/1 CrashLoopBackOff 626 2d
coredns-78fcdf6894-fxr28 1/1 Running 627 2d
etcd-nw-h-cos7-n1.natiki 1/1 Running 0 2d
kube-apiserver-nw-h-cos7-n1.natiki 1/1 Running 0 2d
kube-controller-manager-nw-h-cos7-n1.natiki 1/1 Running 0 2d
kube-flannel-ds-amd64-6t2j6 1/1 Running 0 2d
kube-flannel-ds-amd64-gxpg5 1/1 Running 0 2d
kube-flannel-ds-amd64-nf6bv 1/1 Running 0 2d
kube-proxy-5n9lm 1/1 Running 0 2d
kube-proxy-62kkp 1/1 Running 0 2d
kube-proxy-t7dfq 1/1 Running 0 2d
kube-scheduler-nw-h-cos7-n1.natiki 1/1 Running 0 2d
traefik-ingress-controller-7vbkz 1/1 Running 0 41m
traefik-ingress-controller-9qld7 1/1 Running 0 41m
现在,据我所知,我应该能够在主节点上以以下方式建立基本的http连接:http://localhost并转到Traefik仪表板,但是找不到页面。如果我尝试http://localhost:8001/api/v1/proxy/namespaces/default/services/traefik
也是如此我也尝试将入口代理为:
kubectl --namespace=kube-system port-forward traefik-ingress-controller-7vbkz 8080:8001
但是当我访问它时返回:
Handling connection for 8080
E0801 19:26:49.332072 12575 portforward.go:331] an error occurred forwarding 8080 -> 8001: error forwarding port 8001 to pod 46a5574cef4397d0d58c453883c91fc1df5eff94e68234587077f9a1c65d83b5, uid : exit status 1: 2018/08/01 19:26:49 socat[17624] E connect(5, AF=2 127.0.0.1:8001, 16): Connection refused
我的拓扑如下:
Master 10.99.99.101
Slave1 10.99.99.102
Slagve2 10.99.99.103
当我查看入口日志时,我会看到:
E0730 22:02:57.030684 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1beta1.Ingress: Get https://10.96.0.1:443/apis/extensions/v1beta1/ingresses?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: i/o timeout
看来traefik正在尝试连接10.9.6.0.1?不知道为什么。也许CoreDNS就是问题所在,因为查看该Pod的日志,我看到了:
kubectl --namespace=kube-system logs coredns-78fcdf6894-5bslk
E0801 09:32:21.267810 1 reflector.go:205] github.com/coredns/coredns/plugin/kubernetes/controller.go:313: Failed to list *v1.Service: Get https://10.96.0.1:443/api/v1/services?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: i/o timeout
E0801 09:32:21.267943 1 reflector.go:205] github.com/coredns/coredns/plugin/kubernetes/controller.go:320: Failed to list *v1.Namespace: Get https://10.96.0.1:443/api/v1/namespaces?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: i/o timeout
E0801 09:32:21.268219 1 reflector.go:205] github.com/coredns/coredns/plugin/kubernetes/controller.go:315: Failed to list *v1.Endpoints: Get https://10.96.0.1:443/api/v1/endpoints?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: i/o timeout
我想知道这是否与我使用Flannel或其他东西有关?有人可以帮我了解如何显示到仪表板吗?