Container Registry, docker, docker, GCP, kubernetes

Deploy sample web application in kuberenetes cluster

Please refer my previous post on Install Kubernetes cluster on CentOS 8 in order to setup your k8s cluster. The blog post is prepared to see the k8s cluster looks well

I have used GCP to setup the 3 nodes cluster (One master and two workers).

Download the Dockerfile from GitHub repo

You may build the image and upload to your docker hub with this Dockerfile by using the two docker commands here:

docker build -t manuphilip/k8s-example .
docker push manuphilip/k8s-example

I already have uploaded the image in DockerHub. You can use the image also

docker push manuphilip/k8s-example

Kubernetes Deployment file and Service files are uploaded in Github as follows:

deployment.yml

service.yml

Now, you can start deploying the image in to the cluster using the following commands

kubectl apply -f deployment.yml
kubectl apply -f service.yml

Get the status of pods, deployment, service etc.

kubectl get pods

kubectl get deployment

kubectl get service

Note that the service is deployed n port 30000. The application will be accessible in http://<public ip of k8s master>:30000

I have used Tomcat latest version as the test application in a CentOS base and if all steps goes well, you will be prompted for a similar page as below: Enjoy K8S Cluster deployment 🙂