Kubernetes服务不公开外部端口 [英] Kubernetes service doesn't expose external port

查看:81
本文介绍了Kubernetes服务不公开外部端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Kubernetes上本地托管我的第一个dotnet核心应用程序.

I am trying to host my first dotnet core application locally on Kubernetes.

一切正常,但是当我尝试使用z_service.yml文件创建服务时,它不会公开端口8099以便在浏览器中进行外部访问.

$> kubectl apply -f .\z_service.yml
service/amazing-app-service created

但是,如果我运行$> kubectl port-forward amazing-app 8099:80命令,它将起作用,并且我可以使用 http://localhost来访问浏览器中的Web应用程序:8099/

However if I run $> kubectl port-forward amazing-app 8099:80 command then it works and I can access the web application in browser with http://localhost:8099/

这是服务仪表板的外观

和服务状态

我在这里缺少任何配置吗?

Am I missing any configuration here?

推荐答案

如我所见,它是您的服务amazing-app-serviceNodePort.当您要将服务公开给Internet时.您应该对服务使用LoadBalancer类型.就像:

As I see it's NodePort for your service amazing-app-service. When you want to expose the service to the Internet. You should use the LoadBalancer type for the service. Just like:

type: LoadBalancer

这篇关于Kubernetes服务不公开外部端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆