Search code examples
.netkuberneteskubectl

Kubernetes service doesn't expose external port


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

Everything is working fine but when I am trying to create service using z_service.yml file it doesn't expose port 8099 for accessing it externally in browser.

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

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/

this is how services dashboard looks like

enter image description here

and the services status

enter image description here

Am I missing any configuration here?


Solution

  • 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