背景:
我正在尝试搭建BareMetal K8s集群,并希望利用Traefik的集群Ingress的众多功能。我已经在MetalLB的前面提供了LoadBalancer IP地址,这对我来说现在不是问题。
信息:
K8s群集版本:1.12
Helm and Tiller版本:v2.11.0
问题:
如果我使用头盔图表安装了Traefik,并且安装了link,但是当我去检查创建的容器的docker日志时,会得到错误提示
E1012 15:23:50.784829 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Endpoints: Unauthorized
E1012 15:23:52.279720 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Service: Unauthorized
E1012 15:23:52.784902 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1beta1.Ingress: Unauthorized
如果我改走其他方法,并尝试使用官方文档手动安装traefik,则至少可以使它正常工作,但是随后我会在
方面遇到错误
time="2018-10-12T12:22:57Z" level=error msg="Service not found for monitoring/prometheus-server"
time="2018-10-12T12:22:59Z" level=warning msg="Endpoints not found for monitoring/prometheus-server"
因此,要在我的开发人员(最终产品集群)中启动并运行它,我需要付出100%的努力。谁能提供一些帮助和/或指导,以使我朝正确的方向工作?
提前谢谢
答案 0 :(得分:2)
对于第一次安装(使用Helm),您似乎缺少了RBAC configs:
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml
对于第二个安装,看来Traefik可能已配置为从监视名称空间和群集中不存在的prometheus-server
服务端点中刮取指标。如果您可以共享部署方式,那就太好了。
答案 1 :(得分:0)
感谢您回答里科。
因此,作为后续测试。我回去炸掉了所有东西,并使用以下命令重新安装
helm install --values values.yaml stable/traefik
NAME: khaki-goose
LAST DEPLOYED: Fri Oct 12 14:05:23 2018
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/Deployment
NAME AGE
khaki-goose-traefik 0s
==> v1beta1/Ingress
khaki-goose-traefik-dashboard 0s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
khaki-goose-traefik-dccfdf765-cmfl9 0/1 Pending 0 0s
==> v1/ConfigMap
NAME AGE
khaki-goose-traefik 0s
==> v1/Service
khaki-goose-traefik-dashboard 0s
khaki-goose-traefik 0s
在创建输出的末尾跟随建议的命令
kubectl get svc khaki-goose-traefik --namespace default -w
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
khaki-goose-traefik LoadBalancer 10.109.30.181 172.16.15.1 80:31644/TCP,443:31004/TCP 12s
因此,我知道由于 MetalLB ,我至少能够获得一个“外部IP地址”,并且作为初始设置的一部分,它应该为我创建了相关的入口规则,但是我我不确定它是否按照我描述的那样正确地执行了操作。
Name: khaki-goose-traefik-dashboard
Namespace: default
Address:
Default backend: default-http-backend:80 (<none>)
Rules:
Host Path Backends
---- ---- --------
traefik-ui.minikube
khaki-goose-traefik-dashboard:80 (<none>)
Annotations:
Events: <none>
我看到的重要一点是,它实际上并没有获得应有的后端信息(至少是我了解的方式)。
然后我使用官方文档中指定的默认值运行您建议的命令。
kubectl apply -f traefik-rbac.yaml
然后在我运行时向我显示以下信息:
kubectl describe pods
Name: khaki-goose-traefik-dccfdf765-k9pxh
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: jbv-dev-k8wrkr-02.removed.domain.name/172.16.1.47
Start Time: Fri, 12 Oct 2018 14:54:30 -0400
Labels: app=traefik
chart=traefik-1.43.0
heritage=Tiller
pod-template-hash=dccfdf765
release=khaki-goose
Annotations: checksum/config=fba7308c36f00b969971dec5caa6ca1e456737d4564d6c623d261aee9ffb82cc
Status: Running
IP: 172.25.4.44
Controlled By: ReplicaSet/khaki-goose-traefik-dccfdf765
Containers:
khaki-goose-traefik:
Container ID: docker://f88d222ccf72c244bdb100b956a8b629bcb8b89c9954de1f83552bddd6c44a43
Image: traefik:1.6.6
Image ID: docker-pullable://traefik@sha256:9569c56e8b7353c9c4e5d4f00177b0b7c523db6926a42a148e04a6fa4b6f9f8d
Ports: 80/TCP, 8880/TCP, 443/TCP, 8080/TCP
Host Ports: 0/TCP, 0/TCP, 0/TCP, 0/TCP
Args:
--configfile=/config/traefik.toml
State: Running
Started: Fri, 12 Oct 2018 14:54:41 -0400
Ready: True
Restart Count: 0
Limits:
cpu: 100m
memory: 30Mi
Requests:
cpu: 100m
memory: 20Mi
Liveness: tcp-socket :80 delay=10s timeout=2s period=10s #success=1 #failure=3
Readiness: tcp-socket :80 delay=10s timeout=2s period=10s #success=1 #failure=1
Environment: <none>
Mounts:
/config from config (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-n8865 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
config:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: khaki-goose-traefik
Optional: false
default-token-n8865:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-n8865
Optional: false
QoS Class: Burstable
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 1m default-scheduler Successfully assigned default/khaki-goose-traefik-dccfdf765-k9pxh to jbv-dev-k8wrkr-02.removed.domain.name
Normal Pulled 1m kubelet, jbv-dev-k8wrkr-02.removed.domain.name Container image "traefik:1.6.6" already present on machine
Normal Created 1m kubelet, jbv-dev-k8wrkr-02.removed.domain.name Created container
Normal Started 1m kubelet, jbv-dev-k8wrkr-02.removed.domain.name Started container
我也刚回去运行了命令 kubectl记录卡其色-鹅-traefik-dccfdf765-k9pxh
E1012 20:19:14.410278 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1beta1.Ingress: Unauthorized
E1012 20:19:14.411657 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Endpoints: Unauthorized
E1012 20:19:15.388608 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Service: Unauthorized
E1012 20:19:15.391057 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1beta1.Ingress: Unauthorized
E1012 20:19:15.397616 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Endpoints: Unauthorized
E1012 20:19:15.411714 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Service: Unauthorized
E1012 20:19:15.413496 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1beta1.Ingress: Unauthorized
E1012 20:19:15.414809 1 reflector.go:205] github.com/containous/traefik/vendor/k8s.io/client-go/informers/factory.go:86: Failed to list *v1.Endpoints: Unauthorized
应用完所有这些之后,然后尝试通过端口80或443打开一个Web浏览器到外部IP地址,然后得到未找到的可怕页面错误。我知道这里有很多信息可以参考舵设置方法,但是我想为此提供尽可能多的信息。
我将不得不回头并从命令历史记录中解析出我对第二次设置所做的相关命令,并在正确提取所有内容后尝试在此处回复。