Here’s how to run your web application on Google Kubernetes Engine.

Create a Dockerfile. Place your web pages in the public-html directory.

<pre lang="bash">FROM httpd:2.4
COPY ./public-html/ /usr/local/apache2/htdocs/

Build a container image for Google Container Registry (GCR).

<pre lang="bash"># set your project
export PROJECT_ID=[project_id]
# build a container image
docker build -t${PROJECT_ID}/your-app:v1 .
# verify docker images
docker images

Upload the container image to GCR.

<pre lang="bash"># authenticate
gcloud auth configure-docker
# upload image
docker push${PROJECT_ID}/your-app:v1

Create a container GKE cluster.

<pre lang="bash"># create cluster
gcloud container clusters create your-app-cluster \
# check clusters
gcloud compute instances list

Deploy your web application.

<pre lang="bash"># create deployment
kubectl create deployment your-app \${PROJECT_ID}/your-app:v1
# see the pods
kubectl get pods

Expose your application to the Internet.

<pre lang="bash"># expose your application
kubectl expose deployment your-app \
--type=LoadBalancer \
--port 80 \
--target-port 80
# get the external ip address
kubectl get service

Scale your application.

<pre lang="bash"># scale to 3 replicas
kubectl scale deployment your-app --replicas=3
# display the replicas
kubectl get deployment your-app


<pre lang="bash">kubectl delete service your-app
gcloud container clusters delete your-app-cluster