Posts

Showing posts with the label Hands-On

Installing Your Kubernetes Cluster: A Comprehensive Guide

 Kubernetes is a difficult concept to learn. It has so many moving parts. But as we all know, the best way to learn a difficult concept is to practice it. It is no different for kubernetes. For that, we need a kubernetes cluster. The problem is, kubernetes is such a complicated tool that even installing it is very difficult. I will guide you through it here. What will we do? Before we do something, I like outlining what exactly we will accomplish in this blog post. We are going to install a tool called kubeadm.. What is kubeadm? If you have ever tried to install kubernetes the traditional way, you will know that the process is extremely complicated and error-prone. You will also do a lot of very complicated configuration configuration, install tools with very specific steps, and make everything work together perfectly. That is extremely difficult. This is why, over the years, there have been many other tools created to aid in this process. One of the most popular is kubeadm. How does k

Persistent Data in Docker: Explanation + Hands-On Demo

Docker containers, by nature, are ephemeral. They are not designed to stay without being deleted for long periods of time. While you could, theoretically never delete the image, most of the benefits of docker are realized when containers are temporary. There is something wrong with this approach, though. Almost all the data in the world is designed to be persistent. This poses a problem that docker volumes can solve. What are docker volumes? Docker volumes are a method of ensuring data persistence in a containerized environment. To comply with best practices, you need to make sure that spontaneously losing a container or 2 does not have an impact on anything but the performance of your infrastructure. To do this, all the important data in your containers needs to be put somewhere. Somewhere which is not liked to the life-cycle of the container itself. That somewhere is a volume. A docker volume is little more than a place to store data. From the point of view of the container, nothing

Hands-on docker: Deploying Your First Containerized App

This post and all of it's content has been written with the assumption that you are familiar with basic Docker concepts. If you are not, or just need a review of the topic, please click here. Once you have learnt the basics of docker, I am sure you want to implement you knowledge, right? I certainly know I was. I believe the best way to learn is by doing. So let's learn Docker in the most effective way we can, by using it. ALL THE COMMANDS IN THIS WALK-THROUGH NEED TO BE RUN WITH ADMIN PRIVILEGES The first step in this process is to install docker. I am assuming you do not have docker installed. If you do, you can skip this part. The docker installation steps are quite complex and differ for every OS. You will find several OS-specific guides to install docker if you look for them. There is actually an installation guide on the docker website itself. Here is the link to it https://docs.docker.com/engine/install/ . Before we create the container, we need the image. To create the

Hands-On Docker Compose Guide

In a world where it is not uncommon for companies to have millions of containers, simply managing them through the docker CLI will not suffice. We need a tool that can help us manage chunks of containers and define them in a human-readable format. That is exactly what docker compose does. Basics At the most basic level, docker compose uses code to manage your infrastructure. This code is written in yaml format. The file that the code is written in is called docker-compose.yaml . Here is a basic docker-compose.yaml file: version : ' 3.8 ' services : service1 : image : nginx:alpine ports : - " 80:80 " service2 : image : alpine networks : mynetwork : As you can see, the structure of the file is quite basic. Let's go through everything 1 by 1. version : This specifies the version of docker compose in use by the file. services : This specifies the services that the file defines. Each service is, essentially, just the definition for a con

K3s Installation Guide for Your Kubernetes Sandbox

  The best way to learn is by doing. Everybody knows that. That is the central idea of this blog. That means we also need a way to install and use kubernetes. This blog post is going to teach you precisely that. How to install Kubernetes? What we will do I have seen many posts that just dive straight into the content and how to install kubernetes, but they do not take the time to explain what exactly they will do in the post. While that sounds like a very trivial thing, I would have benefited hugely from knowing what exactly I was going to do. So, here it is. We are not exactly going to install Kubernetes. Kubernetes is very hard to install and configure. It is also very resource intensive. Maybe I will make a post about installing that someday. This is why we will use a distribution of Kubernetes called K3s. This is a lightweight, easy to install version of kubernetes created by a company called Rancher. Rancher is an awesome company that makes many useful, open source and enterprise

Pods to Deployments | Kubernetes Architecture Evolution

Image
When I was learning the basic kubernetes concepts, I was confused between pods, replicasets, and deployments. Each one seemed to have the other inside of it. I remained confused for a long time. I kept trying to avoid the topic. When I actually understood, it felt great. I do not want you to have that confusion when you are learning these concepts. That is why I created this post. Manifest files As we talked about in our previous post, to access your cluster, you use a tool called kubectl . While you can execute commands to deploy and manage resources, there is a better way of doing it. As you must know if you have read my posts about docker compose , Infrastructure As Code is often more efficient and easier to manage when compared to traditional CLI tools. This is why kubernetes also supports infrastructure as code. It is written in yaml. Those files are called kubernetes manifest files. It is best practice to use them. That is why we are going to be using them here. Step 1: Deploying