traefik - traefik 入口:服务无法访问
问题描述
我刚刚部署了 traefik:
$ helm install traefik traefik/traefik --set dashboard.ingressRoute=true
我正在使用一个k3d
有 2 个工作人员的集群。
安装 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
第一个问题是:为什么会有这么多类似 ingress 的资源?
我可以访问我刚刚部署的 traefik 仪表板localhost/dashboard
。
尽管如此,我安装了一个简单的服务,我无法弄清楚为什么它无法访问。
这里,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>
有任何想法吗?
解决方案
不知道完整的答案,但是 k3s 预装了 traefik,所以这可能就是你得到这么多的原因。
推荐阅读
- reactjs - 如何删除 React-Bootstrap 中 FormControl 组件默认提供的 class="form-control"
- javascript - 我可以从 HTML 字符串或 dom 节点/元素创建 React 元素吗
- actionscript-3 - cs6的charCode有什么替代品吗?
- google-app-engine - IntelliJ 寻找 appcfg.sh,但只存在 appcfg.py
- ruby - 无法定位框架?红宝石
- ios - 每次点击单元格时都会运行 layoutSubviews()
- c# - 如何将 MVVM 视图注入到 shell UWP 页面的区域中
- python - 如何将通知编号添加到按钮图标?
- c++ - 如何本地化格式为“[-][+]Xh Xmin”的文本
- powershell - Set-ADUser 不处理空或空变量