Persistent Volumes in Kubernetes HTTPD Pod

Ticker

6/recent/ticker-posts

Persistent Volumes in Kubernetes HTTPD Pod

Question : The Nautilus DevOps team is working on a Kubernetes template to deploy a web application on the cluster. There are some requirements to create/use persistent volumes to store the application code, and the template needs to be designed accordingly. Please find more details below:

  1. Create a PersistentVolume named as pv-devops. Configure the spec as storage class should be manual, set capacity to 4Gi, set access mode to ReadWriteOnce, volume type should be hostPath and set path to /mnt/security (this directory is already created, you might not be able to access it directly, so you need not to worry about it).

  2. Create a PersistentVolumeClaim named as pvc-devops. Configure the spec as storage class should be manual, request 3Gi of the storage, set access mode to ReadWriteOnce.

  3. Create a pod named as pod-devops, mount the persistent volume you created with claim name pvc-devops at document root of the web server, the container within the pod should be named as container-devops using image httpd with latest tag only (remember to mention the tag i.e httpd:latest).

  4. Create a node port type service named web-devops using node port 30008 to expose the web server running within the pod.

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 services

    kubectl get pods


2.  Create yaml  file with all the parameters , you can copy form gitlab

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

    Refer Below Video for more clarity )


3.  Run below command to create pod

    kubectl create -f http.yaml


4.  Wait for  pods to get running status

        kubectl get pods


5.  Validate the task by running 


6.  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