Stefan Kecskes

Never stop learning, because life never stops teaching

Using Volumes in Kubernetes

Volumes in Kubernetes are used to store data used by our applications. So that concept is very similar to volumes in docker containers. But there are some subtle differences, as always in life; nothing can be simple. :) There are many types of volumes in Kubernetes, and in this post, we will group them by properties and see the some of the most common types. Like with docker, we will group them to local and remote volumes.


Declarative Kubernetes

Declarative Kubernetes

With docker, we used docker run ... for each docker instance. We came at some point to situation where our commands became too long with many parameters or that running the same command again and again was time-consuming and mroe error-prone. That is where stopped using imperative approach and started to use declarative approach with docker-compose yaml files. Same is with imperative approach using kubectl .... as I showed you in the previous blog post about Kubernetes basics. This time lets look into how we can achieve same more advanced stuff but with declarative approach with Kubernetes Resource definition files.


Kubernetes basics

Kubernetes basics

For some time there were two great tools called DockerSwarm and Kubernetes, both trying to achieve similar goals, to be orchestration tools for containerized applications, but at some point it was clear that one of them became more popular among developers and became an industry standard. We could speculate saying that developers are lazy, and they don’t want to write complex yaml files for their deployments, but the truth is that Kubernetes is more flexible and extensible tool, provides more mature features, like self-healing, rollouts and rollbacks, secret management, auto-scaling and I mean really large scale applications, adoption by big companies like Google, Microsoft, Amazon, IBM, etc. and can run in single cloud, multi-cloud, on-premises, hybrid cloud, etc. This might take longer to learn, but at the end it is worth it. So buckle up and let’s dive into the Kubernetes basics.


Docker Volumes

Docker Volumes

I am using docker in personal and professional projects for a couple of years now. Like everybody else, I learned it as I went along and learned as little as I needed to know to be able to deliver what I wanted. I never had a chance to sit down and look deeper into it (as no one does these days). But from time to time, I like to dive deeper to figure out more about handling data with docker. And then I thought to myself that what I summarized for myself mighy actually be helpful for someone else too. Therefore, if you are interested in knowing more about docker volumes, you are in the right place. All code covered in this blog post is also in github repo if you would like to follow along. And if you are not interested, you are still in the right place, but you can skip this article.