kubernetes - 在Vagrant下使用Kubernetes公开用于主机的Traefik Web UI

标签 kubernetes vagrant traefik traefik-ingress

我尝试安装Traefik Web UI,但在Vagrant下,没有Minikube。这是一个多节点设置。在主机上,我尝试在localhost:8081(在Vagrantfile中公开给主机的guest 8080端口)和https://localhost:6443/api/v1/namespaces/kube-system/services/https:traefik-web-ui:/proxy/下都无法访问UI。你能推荐一个工作环境吗?在此最后一个URL上,出现以下错误:

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "no endpoints available for service \"https:traefik-web-ui:\"",
  "reason": "ServiceUnavailable",
  "code": 503
}

通过SSH进入主计算机,Web UI正在工作:

vagrant@my-project-master:/vagrant$ kubectl get services --namespace=kube-system
NAME                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)           AGE
...
traefik-ingress-service   ClusterIP   10.110.210.58    <none>        80/TCP,8080/TCP   4m30s
traefik-web-ui            ClusterIP   10.98.235.112    <none>        80/TCP            4m29s

vagrant@my-project-master:/vagrant$ curl 10.110.210.58:8080/dashboard/
<!doctype html><html class="has-navbar-fixed-top"><head><meta charset="utf-8"><title>Traefik</title><base href="./"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="./assets/images/traefik.icon.png"><link href="styles.e21e21d47be645f690e6.bundle.css" rel="stylesheet"/></head><body><app-root></app-root><script type="text/javascript" src="inline.318b50c57b4eba3d437b.bundle.js"></script><script type="text/javascript" src="polyfills.1457c99db4b6dba06e8d.bundle.js"></script><script type="text/javascript" src="scripts.ef668c5c0d42ec4c5e83.bundle.js"></script><script type="text/javascript" src="main.f341693bf9ed22060b42.bundle.js"></script></body></html>

当前的ui.yml:

---
apiVersion: v1
kind: Service
metadata:
  name: traefik-web-ui
  namespace: kube-system
spec:
  selector:
    k8s-app: traefik-ingress-lb
  ports:
  - name: web
    port: 80
    targetPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: traefik-web-ui
  namespace: kube-system
spec:
  rules:
  #- host: traefik-ui.minikube
  - host: traefik-ui.local
    http:
      paths:
      - path: /
        backend:
          serviceName: traefik-web-ui
          servicePort: web

安装:

kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-ds.yaml
#kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/ui.yaml
kubectl apply -f /vagrant/hashicorp/manifests/traefik/ui.yml

如何访问主机上的Web UI,最好仅通过已安装的证书将其提供给主机浏览器使用?

我类似地使用Kubernetes仪表板,并将证书安装在主机浏览器上。

最佳答案

我在API下找到了正确的URL即可到达UI:
https://localhost:6443/api/v1/namespaces/kube-system/services/http:traefik-ingress-service:8080/proxy/dashboard/
使这些命令完全正确:

kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/ui.yaml
# or
kubectl apply -f /vagrant/hashicorp/manifests/traefik/ui.yml

关于kubernetes - 在Vagrant下使用Kubernetes公开用于主机的Traefik Web UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53669788/

相关文章:

apache-spark - 如何在 Kubernetes 上使用 Spark 修复 "Forbidden!Configured service account doesn' t have access”?

kubernetes - kubernetes中的 "Pods"和 "Static Pods"有什么区别,何时选择常规 pod 上的 "static pods"?

vagrant - 关闭不再配置的vagrant box

linux - Vagrant 配置脚本在 VM 完全启动之前运行?

kubernetes - Traefik信息中心-自定义API路径

docker - (NGINX + Skaffold)-即使编译正确,在本地计算机上运行微服务系统也会始终生成404?

kubernetes - 使用 Kubernetes client-go 如何以编程方式检查 Node 是否为 "Ready"?

ruby - Vagrantfile ruby​​ 语法解释

docker - Traefik后端健康检查不起作用

oauth-2.0 - 如何使用OAuth2身份验证设置traefik