无法访问 Traefik 仪表板,获得 404。从 Helm 图表安装在 Kubernetes (k3d) 上(在 Ubuntu 20.04 笔记本电脑上)
Cannot reach Traefik dashboard, get a 404. Installed on Kubernetes (k3d) from Helm chart (on Ubuntu 20.04 Laptop)
我创建了一个这样的 k3d 集群:
# Create 3 server nodes and only allow control plane stuff on there (and things with tolerations)
# Pretty print:
# k3d cluster create dev
# --api-port 6551
# --port "8081:80@loadbalancer"
# --servers 3
# --k3s-server-arg --node-taint="CriticalAddonsOnly=true:NoExecute"
# --k3s-server-arg "--no-deploy=traefik"
#
k3d cluster create dev --api-port 6551 --port "8081:80@loadbalancer" --servers 3 --k3s-server-arg --node-taint="CriticalAddonsOnly=true:NoExecute" --k3s-server-arg "--no-deploy=traefik"
然后我安装了Traefik:
# Has tolerations so it can run on those nodes
# Pretty print:
# helm install traefik traefik/traefik
# --set tolerations[0].key=CriticalAddonsOnly
# --set tolerations[0].operator=Exists
# --set tolerations[0].effect=NoExecute
# --set ingressRoute.dashboard.annotations."kubernetes\.io/ingress\.class"=traefik-internal
#
helm install traefik traefik/traefik --set tolerations[0].key=CriticalAddonsOnly --set tolerations[0].operator=Exists --set tolerations[0].effect=NoExecute --set ingressRoute.dashboard.annotations."kubernetes\.io/ingress\.class"=traefik-internal
然后我开始端口转发:
kubectl port-forward $(kubectl get pods --selector "app.kubernetes.io/name=traefik" --output=name) 9000:9000
当我访问 http://127.0.0.1/dashboard/
时,我收到了 404。
我可以看到 pods:
kubectl get pods
# NAME READY STATUS RESTARTS AGE
# svclb-traefik-5gbwz 2/2 Running 0 20m
# svclb-traefik-fmpgc 2/2 Running 0 20m
# svclb-traefik-lg9j6 2/2 Running 0 20m
# traefik-84846f6fcb-q5hwd 1/1 Running 0 20m
然而,没有入口显示:
kubectl get ingresses --all-namespaces
# Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
# No resources found
Kubernetes 版本为1.19.4
缺少什么设置?
问题有两点:
-
Service
和其他通过 Traefik 的 Helm chart 安装但不在 Deployment
中的 K8s 对象没有部分可以从 [=14= 中拉入 tolerations
]
- 我只有受污染的节点 运行,所以 Traefik 部署安装了它的 pods,但没有安排其他节点
修正
# Install worker nodes that aren't tainted
k3d node create worker --cluster dev --replicas 3
之后就可以安装Traefik了。
我创建了一个这样的 k3d 集群:
# Create 3 server nodes and only allow control plane stuff on there (and things with tolerations)
# Pretty print:
# k3d cluster create dev
# --api-port 6551
# --port "8081:80@loadbalancer"
# --servers 3
# --k3s-server-arg --node-taint="CriticalAddonsOnly=true:NoExecute"
# --k3s-server-arg "--no-deploy=traefik"
#
k3d cluster create dev --api-port 6551 --port "8081:80@loadbalancer" --servers 3 --k3s-server-arg --node-taint="CriticalAddonsOnly=true:NoExecute" --k3s-server-arg "--no-deploy=traefik"
然后我安装了Traefik:
# Has tolerations so it can run on those nodes
# Pretty print:
# helm install traefik traefik/traefik
# --set tolerations[0].key=CriticalAddonsOnly
# --set tolerations[0].operator=Exists
# --set tolerations[0].effect=NoExecute
# --set ingressRoute.dashboard.annotations."kubernetes\.io/ingress\.class"=traefik-internal
#
helm install traefik traefik/traefik --set tolerations[0].key=CriticalAddonsOnly --set tolerations[0].operator=Exists --set tolerations[0].effect=NoExecute --set ingressRoute.dashboard.annotations."kubernetes\.io/ingress\.class"=traefik-internal
然后我开始端口转发:
kubectl port-forward $(kubectl get pods --selector "app.kubernetes.io/name=traefik" --output=name) 9000:9000
当我访问 http://127.0.0.1/dashboard/
时,我收到了 404。
我可以看到 pods:
kubectl get pods
# NAME READY STATUS RESTARTS AGE
# svclb-traefik-5gbwz 2/2 Running 0 20m
# svclb-traefik-fmpgc 2/2 Running 0 20m
# svclb-traefik-lg9j6 2/2 Running 0 20m
# traefik-84846f6fcb-q5hwd 1/1 Running 0 20m
然而,没有入口显示:
kubectl get ingresses --all-namespaces
# Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
# No resources found
Kubernetes 版本为1.19.4
缺少什么设置?
问题有两点:
-
Service
和其他通过 Traefik 的 Helm chart 安装但不在Deployment
中的 K8s 对象没有部分可以从 [=14= 中拉入tolerations
] - 我只有受污染的节点 运行,所以 Traefik 部署安装了它的 pods,但没有安排其他节点
修正
# Install worker nodes that aren't tainted
k3d node create worker --cluster dev --replicas 3
之后就可以安装Traefik了。