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 my 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 by using the below command. This will download the image in to your local repository

docker pull manuphilip/k8s-example
docker images

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 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *