Pod not sharing directory - Kubernetes volume Hostpath

0 votes

I am trying to use kubernetes as my default development environment. I've set up the cluster locally with docker.

My set up steps after having a kubernetes cluster running were:

cd cluster_config/app && docker build --tag=k8s_php_dev . && cd ../..
kubectl -s http://127.0.0.1:8080 create -f cluster_config/app/app.rc.yml
kubectl -s http://127.0.0.1:8080 create -f cluster_config/app/app.services.yml

I am trying to map a local directory as a volume inside my app pod so I can share dynamically the files in there between my local host and the pod, so i can develop, change the files; and dynamically update on the service.

I use a a volume with a hostPath. The pod, replication controller and service are created successfully but the pod do not share the directory not even have the file on the supposed on the mountPath.

What I'm doing wrong?

Aug 28, 2018 in Kubernetes by lina
• 8,220 points
2,250 views

1 answer to this question.

0 votes

he issue was on the volume definition, the hostPath.path property should hold the absolute address of the directory to mount.

Example:

hostPath:
  path: /home/bitgandtter/Documents/development/php/k8s_devel_env
answered Aug 28, 2018 by Kalgi
• 52,350 points

Related Questions In Kubernetes

0 votes
1 answer

Pod not running as expected in kubernetes

Heyy @Hannah, It may be that there ...READ MORE

answered Oct 26, 2018 in Kubernetes by Kalgi
• 52,350 points
1,040 views
0 votes
1 answer

Configure a Kubernetes-pod to use persistent volume for storage.

The output shows that the PersistentVolume has ...READ MORE

answered Jul 23, 2019 in Kubernetes by Sirajul
• 59,230 points
2,807 views
+1 vote
1 answer

How to use a Volume to communicate between two Containers running in the same Kubernetes-Pod?

Create a Pod that runs two Containers Create a ...READ MORE

answered Jul 23, 2019 in Kubernetes by Sirajul
• 59,230 points
2,586 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,925 views
0 votes
1 answer

Not able to access kubernetes api from a pod in azure

Follow these steps Add --bind-address=0.0.0.0 option to the line https://github.com/kubernetes/kubernetes/blob/v1.2.0/docs/getting-started-guides/coreos/azure/cloud_config_templates/kubernetes-cluster-main-nodes-template.yml#L218  Created ...READ MORE

answered Aug 30, 2018 in Kubernetes by Kalgi
• 52,350 points
1,015 views
0 votes
1 answer

Pod status not ready always - kubernetes

I was having the same issue. In the ...READ MORE

answered Sep 6, 2018 in Kubernetes by Kalgi
• 52,350 points
3,668 views
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