I a working on deploying a multi service application using Okteto & I have hit a bit of a snag with persistent volumes. My application has multiple containers, one of which requires data persistence between restarts. I have gone through the Okteto documentation but still can not quite figure out how to set up a persistent volume for just one of the services in the deployment.
In my AWS devops .workflows I am familiar with configuring persistent storage but Okteto approach is a bit different in a multi container setup. Is there a way to configure persistent volumes to work with a single service without affecting the others? Are there any best practices or things to watc out for??
As well, I found these resources when doing research on this; How to do run two okteto services with one `okteto up`? & if anyone have any resources, tutorials or personal experiences please share with me It would be appreciated!!
Thanks for reaching out. I can help you with your questions.
I a working on deploying a multi service application using Okteto & I have hit a bit of a snag with persistent volumes.
What is the deployment mechanism for your application? (i.e. helm charts, kubernetes manifests, docker-compose).
The approach to set up volumes will depend on the mechanism you are using, and I can help you in more detail with that information. But if you’d like to take a look at setting up persistent volumes based on the approach, you can take a look at the following:
The Docker compose volumes. This approach allows you to specify the use of a volume by only one service. In one of our public repos, movies-with-compose, you can see an example of a mongodb service, which uses the volume, data.
The Helm chart volumes approach relies entirely on your chart to set up a specific service with a volume. In another of our public repos, movies-with-compose, you can see an example of how the mongodb service is also set up to use the data volume.
My application has multiple containers, one of which requires data persistence between restarts.
When you mention “restarts”, I just want to make sure I fully understand what it entails. Is it on of the following, or are you referring to another approach as a “restart”:
The series of commands:
Run okteto up <your service>.
Run okteto down <your service>.
Run okteto up <your service> again.
Restarting the application server within your container. For example:
Run okteto up <some node service> to open a shell within your development container.
Start the node server within the container, like with the command npm start.
Stop the server (Ctrl + c).
Run npm start again to start up the server within the container.