How to go inside into the one of the node in K8S

4/14/2019

I have a single node kubernetes cluster running locally in my system AND some pods are running in that cluster.

Now i want to go inside the node and change directory and do some testing

exactly like this

enter image description here

How to do this ?

-- PRUDHVI CHOWDHARY NEKKALAPUDI
kubernetes

1 Answer

4/14/2019

Can you try hostpath persistent volume

follow the below steps

  1. Create a directory on the host say, /mnt/test-vol
  2. add a label to node say, test-vol=y
  3. Deploy a pod with hostpath as persistent volume using node selector as test-vol=y
  4. the pod gets deployed on the node matching label test-vol=y
  5. now you should be able to test the test-vol.
  6. create some files in /mnt/test-vol on the host
  7. you should see those files in the pod that is using /mnt/test-vol as hostpath
  8. you can also create or modify the files from pod and the same gets reflected on the node
-- P Ekambaram
Source: StackOverflow