【问题标题】:minikube service --url when service exposes multiple portsminikube service --url 当服务暴露多个端口时
【发布时间】:2019-06-04 14:32:52
【问题描述】:

我的my-app 服务暴露了多个端口:

/Mugen$ kubectl get endpoints
NAME           ENDPOINTS                                                   AGE
my-app         172.17.0.7:80,172.17.0.7:8003,172.17.0.7:8001 + 3 more...   7m
kubernetes     192.168.99.100:8443                                         10h
mysql-server   172.17.0.5:3306                                             10h

在执行minikube service my-app -n default --url 时,我得到了 minikube 转发的每个端口,但是如果不查询它们,我无法分辨哪个是哪个。有没有简单的方法来打印映射或自己设置端口转发?

/Mugen$ minikube service my-app -n default --url
http://192.168.99.100:30426
http://192.168.99.100:30467
http://192.168.99.100:31922
http://192.168.99.100:32008
http://192.168.99.100:30895
http://192.168.99.100:31602

【问题讨论】:

    标签: portforwarding kubectl minikube kubernetes-service


    【解决方案1】:

    您可以使用以下方法轻松检查 kubernetes 服务中的端口和 TargetPort 映射:

    kubectl descrive svc my-app
    Name:                     my-app
    Namespace:                default
    Labels:                   <none>
    Annotations:              <none>
    Selector:                 app=MyApp
    Type:                     NodePort
    IP:                       10.152.183.56
    Port:                     http  80/TCP
    TargetPort:               9376/TCP
    NodePort:                 http  30696/TCP
    Endpoints:                <none>
    Port:                     https  443/TCP
    TargetPort:               9377/TCP
    NodePort:                 https  32715/TCP
    Endpoints:                <none>
    Session Affinity:         None
    External Traffic Policy:  Cluster
    Events:                   <none>
    

    这样你就可以找到porttargetportendpoints映射。

    【讨论】:

    猜你喜欢
    • 2018-02-24
    • 1970-01-01
    • 2019-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-18
    • 1970-01-01
    相关资源
    最近更新 更多