traefik入口:服务无法到达

我刚刚部署了traefik:

$ helm install traefik traefik/traefik --set dashboard.ingressRoute=true

我正在使用一个有2个工作人员的k3d集群。

一旦安装了traefik,我就意识到有几种类似入口的资源:

$ kubectl api-resources | grep ingress
NAME               SHORTNAMES   APIGROUP               NAMESPACED   KIND
ingresses          ing          extensions             true         Ingress
ingresses          ing          networking.k8s.io      true         Ingress
ingressroutes                   traefik.containo.us    true         IngressRoute
ingressroutetcps                traefik.containo.us    true         IngressRouteTCP

第一个问题是:为什么有那么多类似入口的资源?

我可以在localhost/dashboard下访问刚刚部署的traefik仪表板。

尽管如此,我安装了一个简单的服务,无法弄清为什么它无法访问。

在这里,graylog.localhost入口描述:

$ kubectl describe ingresses.networking.k8s.io graylog-web
Name:             graylog-web
Namespace:        graylog
Address:          
Default backend:  default-http-backend:80 (<none>)
Rules:
  Host               Path  Backends
  ----               ----  --------
  graylog.localhost  
                     /gelf   graylog-tcp:gelf (10.42.0.24:12201,10.42.1.33:12201)
                             graylog-web:graylog (10.42.0.24:9000,10.42.1.33:9000)
Annotations:
Events:  <none>

但是,当我尝试访问graylog.localhost时:

$ curl graylog.localhost
404 page not found

这是已部署的traefik部署:

$ kubectl describe deployments.apps traefik
Name:                   traefik
Namespace:              kube-system
CreationTimestamp:      Sun,08 Mar 2020 20:51:09 +0100
Labels:                 app=traefik
                        chart=traefik-4.0.0
                        heritage=Helm
                        release=traefik
Annotations:            deployment.kubernetes.io/revision: 1
Selector:               app=traefik,release=traefik
Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  1 max unavailable,1 max surge
pod Template:
  Labels:           app=traefik
                    chart=traefik-4.0.0
                    heritage=Helm
                    release=traefik
  Service account:  traefik
  Containers:
   traefik:
    Image:       traefik:2.1.3
    Ports:       9000/TCP,8000/TCP,8443/TCP
    Host Ports:  0/TCP,0/TCP,0/TCP
    Args:
      --global.checknewversion=true
      --global.sendanonymoususage=true
      --entryPoints.traefik.address=:9000
      --entryPoints.web.address=:8000
      --entryPoints.websecure.address=:8443
      --api.dashboard=true
      --ping=true
      --providers.kubernetescrd
      --log.level=WARN
    Liveness:     http-get http://:9000/ping delay=10s timeout=2s period=10s #success=1 #failure=3
    Readiness:    http-get http://:9000/ping delay=10s timeout=2s period=10s #success=1 #failure=1
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetavailable
OldReplicaSets:  <none>
NewReplicaSet:   traefik-6c6c896889 (1/1 replicas created)
Events:
  Type    Reason             Age    From                   Message
  ----    ------             ----   ----                   -------
  Normal  ScalingReplicaSet  4d11h  deployment-controller  Scaled up replica set traefik-6c6c896889 to 1

在这里,您有traefik服务说明:

$ kubectl describe services traefik
Name:                     traefik
Namespace:                kube-system
Labels:                   app=traefik
                          chart=traefik-4.0.0
                          heritage=Helm
                          release=traefik
Annotations:              <none>
Selector:                 app=traefik,release=traefik
Type:                     LoadBalancer
IP:                       10.43.215.222
LoadBalancer Ingress:     172.20.0.2
Port:                     web  80/TCP
TargetPort:               web/TCP
NodePort:                 web  31000/TCP
Endpoints:                10.42.1.12:8000
Port:                     websecure  443/TCP
TargetPort:               websecure/TCP
NodePort:                 websecure  31856/TCP
Endpoints:                10.42.1.12:8443
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

有什么想法吗?

liuzhaobing 回答:traefik入口:服务无法到达

不知道完整的答案,但是traefik预先安装了k3s,所以这可能就是为什么你得到这么多

的原因。
本文链接:https://www.f2er.com/2653472.html

大家都在问