Deploy Guest Book App on Kubernetes

Ticker

6/recent/ticker-posts

Deploy Guest Book App on Kubernetes

Question : The Nautilus Application development team has finished development of one of the applications and it is ready for deployment. It is a guestbook application that will be used to manage entries for guests/visitors. As per discussion with the DevOps team, they have finalized the infrastructure that will be deployed on Kubernetes cluster. Below you can find more details about it.

BACK-END TIER

1. Create a deployment named redis-master for Redis master.

a.) Replicas count should be 1.

b.) Container name should be master-redis-devops and it should use image redis.

c.) Request resources as CPU should be 100m and Memory should be 100Mi.

d.) Container port should be redis default port i.e 6379.

2. Create a service named redis-master for Redis master. Port and targetPort should be Redis default port i.e 6379.

3. Create another deployment named redis-slave for Redis slave.

a.) Replicas count should be 2.

b.) Container name should be slave-redis-devops and it should use gcr.io/google_samples/gb-redisslave:v3 image.

c.) Requests resources as CPU should be 100m and Memory should be 100Mi.

d.) Define an environment variable named GET_HOSTS_FROM and its value should be dns.

e.) Container port should be Redis default port i.e 6379.

4. Create another service named redis-slave. It should use Redis default port i.e 6379.

FRONT END TIER

1. Create a deployment named frontend.

a.) Replicas count should be 3.

b.) Container name should be php-redis-devops and it should use gcr.io/google-samples/gb-frontend:v4 image.

c.) Request resources as CPU should be 100m and Memory should be 100Mi.

d.) Define an environment variable named as GET_HOSTS_FROM and its value should be dns.

e.) Container port should be 80.

2. Create a service named frontend. Its type should be NodePort, port should be 80 and its nodePort should be 30009.

Finally, you can check the guestbook app by clicking on + button in the top left corner and Select port to view on Host 1 then enter your nodePort.

You can use any labels as per your choice.

Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.



 Please Note :-  Perform the below commands based on your question  server,  user name & other details might differ . So please read task carefully before executing. All the Best 👍


Solution:  

1. At first  kubectl  utility configure and working from jump server, run below commands

    kubectl get deploy

    kubectl get services

    kubectl get pods

2.  Best practices its always good to have Multiple deployments and service YAML files rather than one single file.

    In this task I have created 6 Files  and have shown how to pull form Git repo. ( refer Vedio)

    Git clone https://gitlab.com/nb-tech-support/devops.git

    Back-end-Deploy-Redis-Master-Guest-Book-App.yaml

    Back-end-service-Redis-Master-Guest-Book-App.yaml

    Back-end-Deploy-Redis-slave-Guest-Book-App.yaml

    Back-end-service-Redis-slave-Guest-Book-App.yaml

    Front-end-Deploy-Redis-php-Guest-Book-App.yaml

    Front-end-service-Redis-php-Guest-Book-App.yaml


3. Create Backend Master deployment

    kubectl apply -f Back-end-Deploy-Redis-Master-Guest-Book-App.yaml

    Create Backend  Master service 

    kubectl apply -f Back-end-service-Redis-Master-Guest-Book-App.yaml

    Create Backend slave deployment

    kubectl apply -f Back-end-Deploy-Redis-slave-Guest-Book-App.yaml

    Create Backend slave service 

    kubectl apply -f Back-end-service-Redis-slave-Guest-Book-App.yaml

    Create frontend deployment

    kubectl apply -f Front-end-Deploy-Redis-php-Guest-Book-App.yaml 

    Create front-end-service 

    kubectl apply -f Front-end-service-Redis-php-Guest-Book-App.yaml


4. Check Deployment

    kubectl get deploy


5. Check  pods ( Make sure all pods are running)
     
    kubectl get pods 


6. Check the service 

    kubectl get service 
 

7. Validate the task by curl or open the browser by clicking 'Open Port on Host 1'




8.  Click on Finish & Confirm to complete the task successful

Happy Learning!!!!

Apart from this if you need more clarity,  I have made a  tutorial video on this , please go through and share your comments. Like and share the knowledge




























Post a Comment

0 Comments

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 4 |  Audit-policy | Install & configure falco utility | Inspect the API server audit logs and identify the user