How do I create a volume in kubernetes so that it doesn t get detroyed when pods die

0 votes

I am having a docker image which when created should check if the volume is empty, in case it should be initialized with some data. This saved data must remain available for other pods with the same or different image.

enter image description here

Can anyone resolve this query?

Thanks.

Aug 16, 2018 in Kubernetes by shubham
• 7,340 points
1,670 views

2 answers to this question.

0 votes

Here is a solution to your problem:

You can mount the pod into the node and hence save the data in the node so when new pod will create in the same node it will have an access to the same volume.

Pods on the same node can create deadlock for the same resource. So what can we do is share storage meaning and create one storage and every pod will claim storage in the same storage.

Just watch this webinar to clear your doubts :https://www.youtube.com/watch?v=n06kKYS6LZE

I hope it would help you resolve your query.

answered Aug 20, 2018 by anonymous
0 votes

if you need to do this is a multi node enviroment u need a persistenct volume mount whics should be shared like NFS 

and then u just need to define  as part of your deployment yaml

- name: app-data-vol (your nfs storage name)
  mountPath: /var/opt/app/conf app directory to mount
  subPath: app/conf  ( relative  path for the mount)
answered Jul 26, 2020 by Akash Gupta

Related Questions In Kubernetes

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How do I create a service account for my dashboard and get all the credentails

Run the following commands: This command will create ...READ MORE

answered Oct 8, 2018 in Kubernetes by Kalgi
• 52,350 points
1,714 views
+2 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
3,961 views
0 votes
2 answers
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP