kubectl bind mount a volume like docker

3/5/2018

I have a docker image which I run it as below in my local mac:

1) creating filesystem --> mkdir data & mkdir license

2)Docker Run : ---> docker run \ --rm \ -u id -u:id -g \ -p 11225:11225 \ -p 9090:9090 \ -v pwd/data:/data \ -v pwd/license:/license \

Now, I would like to run this in Kubernetes. While I expose the ports as service , How can I create the folders (data and license) and then expose that as bind volume in kubernetes cluster ? sample yml or kubectl command helps

-- Rajesh K Jeyapaul
docker
kubernetes

1 Answer

3/5/2018

You can find explanation of kubernetes Volumes in https://kubernetes.io/docs/concepts/storage/volumes/ which is what you really need to look into and decide which volume type is best for your particular case/environment.

https://kubernetes.io/docs/concepts/storage/persistent-volumes/ is a good reading further to expand your understanding of persistent storage management in kubernetes with PVC/PV concepts.

-- Radek 'Goblin' Pieczonka
Source: StackOverflow