简体   繁体   English

Traefik K8s设置问题

[英]Traefik K8s setup Issues

Background: 背景:

I'm trying to stand up a BareMetal K8s Cluster and want to take advantage of Traefik's multitude of features for my cluster Ingress. 我正试图站出一个BareMetal K8s群集,并希望利用Traefik的群集Ingress的众多功能。 I've got MetalLB in front providing the LoadBalancer IP Addresses and that isn't an issue for me at this time. 我前面有MetalLB提供LoadBalancer IP地址,这对我来说不是问题。

Info: 信息:

K8s Cluster Version: 1.12 K8s群集版本:1.12

Helm and Tiller version: v2.11.0 Helm和Tiller版本:v2.11.0

Problem: 问题:

If I install Traefik using the helm chart and the link It installs, but when I go to check to docker logs for the containter that is created I get errors along the lines of 如果我使用舵图和安装链接安装Traefik,但当我去检查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 

If I instead go a different route and try to manually install traefik using the official documentation, I can at least get it somewhat working, but I then get errors along the lines of 如果我改为采用不同的路线并尝试使用官方文档手动安装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" 

So I am at a 100% loss as to what I need to do to get this up and running in my dev (eventual prod cluster). 所以我在我的开发(最终的prod集群)中完成并运行我需要做的事情100%。 Can anyone provide some assistance and/or guidance to get me working in the right direction? 任何人都可以提供一些帮助和/或指导,让我朝着正确的方向努力吗?

Thank you in advance 先感谢您

For the first installation (using Helm) looks like you are missing the RBAC configs : 对于第一次安装(使用Helm),您似乎缺少RBAC配置

kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml

For the second installation, looks like the Traefik might be configured to scrape metrics from the monitoring namespace and a prometheus-server service endpoint that is not there in your cluster. 对于第二次安装,看起来可能会将Traefik配置为从监视命名空间和群集中不存在的prometheus-server服务端点中删除指标。 It would be great if you could share how you deployed it. 如果你可以分享你如何部署它会很棒。

Thanks for answering Rico. 谢谢你回答Rico。

So as a followup test. 所以作为后续测试。 I went back in and blew everything away and reinstalled with the following commands 我回去了,把所有东西吹走,并用以下命令重新安装

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

Followed up by the suggested commands at the end of the creation output 在创建输出结束时按建议的命令进行操作

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

So I know that I am at least able to get an "External IP Address" thanks to MetalLB and as part of the initial setup it should have created the relevant ingress rules for me, but I am not sure it did that correctly as when I describe it I get the following. 所以我知道我至少能够得到一个“外部IP地址”,感谢MetalLB,并且作为初始设置的一部分,它应该为我创建相关的入口规则,但我不确定它是否正确,因为我描述它我得到以下。

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>

The important bit as I can see is that it isn't actually getting the information about the backend as it should be (at least the way I understand it). 我能看到的重要一点是它实际上并没有得到关于后端的信息(至少我理解它的方式)。

I then ran the command that you suggested with the default values as specified on the official documentation. 然后,我使用官方文档中指定的默认值运行您建议的命令。

kubectl apply -f traefik-rbac.yaml

It was then showing me the following info when I ran: 当我跑步时,它向我显示以下信息:

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

I also just went back and ran the command kubectl logs khaki-goose-traefik-dccfdf765-k9pxh 我也回去跑了命令kubectl logs khaki-goose-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

After I apply all of this, I then try to open a web browswer to the External IP address either via port 80 or 443 I then get the dreaded page not found error. 在我应用了所有这些之后,我尝试通过端口80或443打开外部IP地址的浏览器,然后找到可怕的页面找不到错误。 I know this is a lot of information here to reference the helm setup way, but I want to provide as much information as possible for this. 我知道这里有很多信息可以参考helm设置方式,但我想为此提供尽可能多的信息。

I will have to look back and parse out the relevant commands I did for the second setup from my command history and try to reply back here when I get it all correctly pulled out. 我将不得不回顾并解析我在命令历史记录中为第二次设置所做的相关命令,并在我正确拉出所有内容时尝试回复此处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM