Kubernetes as webserver


I’m wanting to use kubernetes as a webserver. I created a asp.net application just saying Hello-World. I dockerised it and published it to Kubbernetes. The container started up and then backed off saying terminated completed exit code 0. So it looks like its ok, but didnt get chance to browse to webpage to view.

Is this the same with all asp.net apps, how do I create a website that I can browse to?

I see some people are using Nginx , but I want to use a kubernetes loadbalancer.

I see many articles on creating asp.net applications for kubernetes, but do they startup and shut down the same?

I want a webserver like IIS or Apache on kubernetes I can access and view pages.

I want to do this for asp.net and maybe php, what are my options?

Have I not created a website and instead just an app that executes and then finishes?

Can someone help?

cheers Mike

Hi @Michael_Wright I was thinking of doing the same, but with nginx as a LoadBalancer. I am still learning k8, so I haven’t gotten very far with this idea of mine. But, if the container is starting and terminating without any real error, could you add a sleep command to the container to keep it alive enough for you to browse to it?


Yes after further research thats the thing todo. My code is asp.net core which includes its own webserver called kestral. Any app that supports asp.net core supports kestral. I’m using kubernetes loadbalancer configured from the yaml. Kestral is not recommended to be exposed to internet hence why you use nginx as reverse http proxy. Yes a sleep command should do it.