Kubernetes Shared Volumes

Ticker

6/recent/ticker-posts

Kubernetes Shared Volumes

 Question : We are working on an application that will be deployed on multiple containers within a pod on Kubernetes cluster. There is a requirement to share a volume among the containers to save some temporary data. The Nautilus DevOps team is developing a similar template to replicate the scenario. Below you can find more details about it.

Create a pod named volume-share-datacenter.

For first container, use image centos with latest tag only and remember to mention tag i.e centos:latest, container should be named as volume-container-datacenter-1, and run a command '/bin/bash', '-c' and 'sleep 10000'. Volume volume-share should be mounted at path /tmp/news.

For second container, use image centos with latest tag only and remember to mention tag i.e centos:latest, container should be named as volume-container-datacenter-2, and run a command '/bin/bash', '-c' and 'sleep 10000'. Volume volume-share should be mounted at path /tmp/cluster.

Volumes to be named as volume-share and use emptyDir: { }.

After creating pods, exec into the first container volume-container-datacenter-1, and create a file news.txt with content Welcome to xFusionCorp Industries! under the mount path of first container i.e /tmp/news.

The file news.txt should be present under the mounted path /tmp/cluster of second container volume-container-datacenter-2 as they are using shared volumes.



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 )


4.  Run below command to create pod

    kubectl create -f /tmp/volume.yaml


5.  Wait for  pods to get running status

        kubectl get pods

        

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