'Converting from docker-compose to Kubernetes - how to deal with volumes on local
I'm try to get my local development environment converted from docker-compose to a flavour of lightweight Kubernetes, since our production environments are all Kubernetes (like). With the help of Kompose I could convert my settings. The part however I struggle with is the conversion of Docker volumes to a local developer machine Volume and Volume claim. Most examples I found cover drivers for S3 or NFS, which isn't what my development laptop offers.
So when I have in my docker-compose.yml a setting like this, what's the local development equivalent in k8s?
version: "3.6"
services:
my_test:
image: "myregistry.com/my_test"
container_name: "demo"
hostname: "demo.acme.local"
stop_grace_period: 120s
cap_add:
- SYS_PTRACE
ports:
- 80:80
volumes:
- my_vol:/local/my_app
volumes:
my_vol:
name: "/local/containers/my_app"
external: false
I'm "only" looking for the volume part. The rest seems clear.
Help is appreciated
Solution 1:[1]
Yes you can use the host path or you can use the emptydir that's on you
Probably hostpath would be a better option.
If you are planning to use the minikube you can also check out the PV and PVC option which is mostly for the persistence storage in Kubernetes.
Hostpath : https://kubernetes.io/docs/concepts/storage/volumes/#hostpath-configuration-example
emptydir : https://kubernetes.io/docs/concepts/storage/volumes/#emptydir
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Harsh Manvar |
