Persistent Volumes in Kubernetes

Ticker

6/recent/ticker-posts

Persistent Volumes in Kubernetes

 Question : We already created a directory /mnt/dba and a file index.html under the same on node01 (you need not to access node01), that location should be mounted within the container to web server's document root (keep in mind doc root can be different for Apache and Nginx web servers).

Create a PersistentVolume named as pv-nautilus. Configure the spec as storage class should be manual, set capacity to 7Gi, set access mode to ReadWriteOnce , volume type should be hostPath and set path to /mnt/dba.

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

Create a pod named as pod-nautilus, set volume as storage-nautilus, and persistent volume claim to be named as pvc-nautilus. Container name should be container-nautilus, use image nginx with latest tag only and remember to mention tag i.e nginx:latest , container port should be default port 80, mount the volume to mount path to default doc root of web server and should be named storage-nautilus.

You can check your static website, exec into the pod and use curl command, i.e curl http://localhost.



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 /tmp/pvc.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

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