how to deploy an html website on kubernetes using gke?

7/3/2019

how to deploy a basic html website on gke, what do i need other than the dockerfile and the .html application itself? i have tried deploying applications which already have all the yaml files included but i don't know how to start from scratch. i don't have a lot of experience and i haven't found anything online about this. can anyone provide a step by step tutorial? what do i do after creating the cluster? taken the website is called hey.html, is this dockerfile enough?

FROM nginx:alpine
RUN apt-get update
RUN apt-get install -y ngin
COPY hey.html/usr/share/nginx/html
EXPOSE 80
-- marwa karaki
deployment
docker
google-kubernetes-engine
html
kubernetes

2 Answers

7/3/2019

To deploy any application in GKE you will need some Kubernetes and GCP knowledge. You can start with official documentation, Coursera path about GKE and Kubernetes in Cloud, official documentation or this article which will introduce you to the basic concepts.

I can start from recommending a good tutorial from Kubernetes official documentation on how to deploy example PHP Guestbook application with Redis it should give you a practical example on how to deploy from scratch. It also uses a service of a type LoadBalancer which will use a controller to tell GCP to create a LoadBalancer that will expose your application to Internet so you do not have to deal with anything to expose the app.

About your Docker file, the workflow will look something like this: Push your Dockerfile to a registry (some useful materials here), you will put that docker image into a deployment for easier future management and then create a service because pods are mortal and replaceable and service will take care of traffic send to right pods even when they will be recreated, you might also need some persistent volume but this will be specific to your application. And here you will find another good how-to by Google.

Try this and if you will have issues just ask another question with details of the problems that occurred.

-- aurelius
Source: StackOverflow

7/3/2019

See below to make changes in dockerfile

FROM nginx:alpine RUN apt-get update COPY hey.html /usr/share/nginx/html EXPOSE 80

-- Keerthishwaran R A
Source: StackOverflow