Nodeport 模式下获取 address 的代码在 getLoadBalancerRestEndpoint 中。历史版本会直接获取k8s master url, 在 Flink-1.14 版本中针对 k8s master 是 VIP 的情况做了适配[1],可以看下是否对你有帮助 https://issues.apache.org/jira/browse/FLINK-23507
> 2022年4月15日 下午1:37,shimin huang <huangshimin1...@gmail.com> 写道: > > Fabric8FlinkKubeClient#getRestEndPointFromService > > > shimin huang <huangshimin1...@gmail.com> 于2022年4月15日周五 13:37写道: > >> private Optional<Endpoint> getRestEndPointFromService(Service service, int >> restPort) { >> if (service.getStatus() == null) { >> return Optional.empty(); >> } >> >> LoadBalancerStatus loadBalancer = service.getStatus().getLoadBalancer(); >> boolean hasExternalIP = >> service.getSpec() != null >> && service.getSpec().getExternalIPs() != null >> && !service.getSpec().getExternalIPs().isEmpty(); >> >> if (loadBalancer != null) { >> return getLoadBalancerRestEndpoint(loadBalancer, restPort); >> >> // 理解主要这块代码,nodeport方式 >> } else if (hasExternalIP) { >> final String address = service.getSpec().getExternalIPs().get(0); >> if (address != null && !address.isEmpty()) { >> return Optional.of(new Endpoint(address, restPort)); >> } >> } >> return Optional.empty(); >> } >> >> >> huweihua <huweihua....@gmail.com> 于2022年4月15日周五 11:35写道: >> >>> 图片显示失败了,可以上传到图床,贴链接到邮件里 >>> >>>> 2022年4月15日 上午11:30,shimin huang <huangshimin1...@gmail.com> 写道: >>>> >>>> >>>> 具体细节看和flink k8s这块的细节实现有关,不清楚为什么这个externalIPs的第一个ip在我们k8s集群中为什么不存在 >>>> >>>> shimin huang <huangshimin1...@gmail.com <mailto: >>> huangshimin1...@gmail.com>> 于2022年4月15日周五 11:16写道: >>>> hi,使用flink on native k8s NodePort方式启动任务后返回的jobmanager web >>> ui的地址不是集群中的ip,看k8s底层的部署也没发现具体问题 >>> >>>