Containerization has become very popular during the last few years, especially given the growth of microservices architectures and cloud services. Using a stack such as Docker, Kubernetes and Helm can make one’s life easier in terms of building, running and deployment options as an introduction to containerization and Azure API Management.
Let’s go through the basics of each of the three tools, understand how they work, and the benefits they could bring to our day-to-day activities.
Using Docker for containerization
Docker is a software program that performs operating-system-level virtualization, also known as “containerization”. You can create Docker image files in which you describe what will be copied in the Docker “image”, what will be run, dependencies and so on. Then you can run that image as a “container” in Docker. Images can be saved to a repository so anyone can run it without having to take the code and build it.
Having all libraries and dependencies built as a single package in the Docker image you can run the application on any machine and have the same behavior. This way you can avoid conflicts between libraries or system settings that sometimes appear when running an application directly in the OS or in an application server.
You can install Docker from here.
Leverage Kubernetes in containerized applications
Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
Kubernetes is even more helpful when running a complex application based on containers. It interacts with several groups of containers and automates various manual processes: controls which server will host the container, how it will be launched etc.
These are some key features of Kubernetes:
- Provides additional services: management of containers, security, networking and storage services
- Self-monitoring: checks constantly the health of nodes and containers
- Horizontal scaling: scale resources not only vertically but also horizontally, easily and quickly
- Storage orchestration: mounts and add storage system of your choice to run apps
- Automates rollouts and rollbacks: if something goes wrong after a change in your application, Kubernetes will rollback for you
- Container balancing: Kubernetes always knows where to place containers, by calculating the “best location” for them
- Run everywhere: Kubernetes is an open-source tool and gives you the freedom to take advantage of on-premises, hybrid, or public cloud infrastructure, letting you move workloads to anywhere you want
Kubernetes cluster structure
A Kubernetes cluster consists of a set of worker nodes that run containerized applications. The nodes host pods which are parts of the application. The cluster is controlled through a master. The master contains an API server that receives commands (as JSON or YAML) from kubectl (a CLI on the local workstation).
- Kubernetes cluster structure
Simplify packaging and deployment of applications with Helm
Handling a complex application on Kubernetes can be quite difficult and would involve many Kubernetes resources. Helm steps in to simplify things; it allows the packaging and deployment of applications on a Kubernetes cluster.
Helm is a package manager, it bundles files for an application (config-map.yaml, deployment.yaml, service.yaml). The files are templatesthat are combined with configurable valuesthat are set in files (values.yaml) or during runtime. The collection of templates and value files is called a Helm chart.
Once you have the application described as a Helm chart you can install, update or delete the chart from the Kubernetes cluster using Helm. Helm also allows you to install the same chart multiple times with different runtime values, thus obtaining multiple releases for the same application.
Another advantage of Helm is the installation of 3rd party applications or community charts. You can simply add the Helm repository that contains the community chart you need, and in one command you can install it in the cluster.
Key features of using Helm:
- Manage complexity: define, install, and upgrade even the most complex Kubernetes application
- Simple sharing: charts are easy to create, version, share and publish
- Easy updates
- Rollbacks with Helm rollback
Docker, Kubernetes, and Helm are useful tools to master. With Docker you can easily run an application on multiple machines and be sure you obtain the same behavior, you can scale up with Kubernetes and deploy multiple services into a cluster, and then package all your services into a proper multiservice application with a Helm chart.
Containerization and Azure API Management have been the topic of the most recent meetup in Craiova. Learn more about our upcoming events here and join our MeetUp group to stay up to date with future sessions. For more information on an introduction to containerization and Azure API Management or complex project deployments, don’t hesitate to contact us.