【问题标题】:Cannot export a IP in minikube and haproxy loadBalancer无法在 minikube 和 haproxy loadBalancer 中导出 IP
【发布时间】:2023-04-08 20:39:01
【问题描述】:

我是 Kubernetes 的新手。我已经在 virtualbox VM (ubuntu 19.10) 中安装了 minikube v1.5.2。我想创建一个可以从主机和来宾访问的 Web 服务器。但是,我无法访问它或公开 IP。你可以帮帮我吗?

我已经启用了入口插件。

当我尝试列出入口对象时,没有外部 IP,我从入口控制器部署收到此错误消息:

2019/11/10 15:41:04 controller-haproxy.go:147 service does not exists
2019/11/10 15:41:09 controller.go:333: service  does not exists
2019/11/10 15:41:09 controller-haproxy.go:147 service  does not exists
2019/11/10 15:41:14 controller.go:333: service  does not exists
2019/11/10 15:41:14 controller-haproxy.go:147 service  does not exists

这是我的代码:https://pastebin.com/ysMPtyuV

【问题讨论】:

    标签: kubernetes load-balancing minikube haproxy-ingress


    【解决方案1】:

    Minikube 通过minikube tunnel 引入了对LoadBalancer 的支持。

    当您不使用$ sudo minikube tunnel 时,您的LB 服务将一直处于pending 状态。

    您需要打开另一个 SSH 窗口并运行 $ sudo minikube tunnel。您将在一个 SSH 中收到输出,例如:

    $ sudo minikube tunnel
    Status:
            machine: minikube
            pid: 11549
            route: 10.96.0.0/12 -> 10.132.15.208
            minikube: Running
            services: [haproxy-ingress]
        errors: 
                    minikube: no errors
                    router: no errors
                    loadbalancer emulator: no errors
    

    在第二个 SSH 中,您将能够检查 LB 服务是否获取 IP 地址。

    minikube:~$ kubectl get svc -w
    NAME              TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
    app               ClusterIP      10.105.136.11   <none>        80/TCP         68s
    haproxy-ingress   LoadBalancer   10.111.24.111   <pending>     80:31187/TCP   68s
    kubernetes        ClusterIP      10.96.0.1       <none>        443/TCP        11d
    haproxy-ingress   LoadBalancer   10.111.24.111   10.111.24.111   80:31187/TCP   80s
    

    请记住,minikube tunnel 会话必须始终打开,否则您的 LB 将停止获取 IP 地址。

    您可以通过Kong using minikube LB查看类似情况。

    如果这对你有帮助,请告诉我。

    【讨论】:

    • 嗨@PjoterS。谢谢你的帮助。我试过了,但它仍然无法正常工作。现在我有一个外部 IP,但我无法从那里访问我的 pod。这就是我所做的: curl -I -H 'Host: web-aap.local' '10.102.220.80' (ERROR: 503 Server Unavailable) e curl -I -H 'Host: web-aap.local' '@987654324 @' (没有到主机的路由)。我怎样才能访问它?
    • 请提供$ minikube service haproxy-ingress 的输出以及何时运行$ curl -i &lt;output of previous command URL address&gt; ?还有你在用什么--vm-driver
    • 嗨,PjoterS。抱歉回答太晚了。我选择改用 Kubernetes 和 Metallb。您的解决方案更改了外部 IP,因此我将其标记为正确答案。谢谢!!
    猜你喜欢
    • 2015-09-22
    • 1970-01-01
    • 2020-11-18
    • 2023-03-09
    • 2021-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-12
    相关资源
    最近更新 更多