How to deploy Ember app to kubernetes

Alexandr Korsak
1 min readApr 5, 2018

As part of my unfinished project [observerio](github.com/observerio/observer-server) I were working on my first ember dashboard and when I finished to work on prototype, decided to deploy it as pod in kubernetes cluster in digitalocean. Why kubernetes probably it’s saving a lot of time if you are solo developer and don’t have enough money to support the non profitable idea.

On the first deploy I found that it was pretty easy to build released version of ember app but on open the dashboard in browser I found that my routing is not working properly. After googling the solution someone suggested to change nginx settings on serve ember app.

[Docker.released](https://github.com/observerio/observer-server/blob/master/web/Dockerfile.release) used by pod:

FROM alpine:3.6COPY dist/ /appWORKDIR /appCMD [“tail”, “-f”, “/dev/null”]

How to change nginx settings? I started to think about it. I didn’t know internal stuff in k8s and the next step for me was to explore a bit the containers from running processes in kubernetes cluster. In ingress pod I found the nginx template that used on serving my ember pod.

[nginx.tmpl](https://github.com/kubernetes/ingress-nginx/blob/master/rootfs/etc/nginx/template/nginx.tmpl)

To make sure that I would have the same template as installed ingress container, I copied [nginx.tmpl](https://github.com/observerio/observer-server/blob/master/deployment/app-deploy/ingress/templates/nginx.tmpl#L458) from the container and placed there(line: 458):


{{ if and (eq $path “/”) (eq $server.Hostname “observer.rubyforce.co”) }}
try_files $uri $uri/ /index.html?/$request_uri;
{{ end }}

Then changed ingress controller to use the new template via config map, example of [Deployment](https://github.com/observerio/observer-server/blob/master/deployment/app-deploy/ingress/03-deployment.yml#L67)

Probably it could be helpful for someone as well.

Thanks for reading!

--

--