<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mani M on Medium]]></title>
        <description><![CDATA[Stories by Mani M on Medium]]></description>
        <link>https://medium.com/@maannniii?source=rss-257fc4a62357------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ar7WAA5AUkx6leLG-LuXAQ.jpeg</url>
            <title>Stories by Mani M on Medium</title>
            <link>https://medium.com/@maannniii?source=rss-257fc4a62357------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 03:34:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@maannniii/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Kubernetes Concepts and their related Docker swarm terminologies]]></title>
            <link>https://medium.com/devops-in-depth/kubernetes-concepts-and-their-related-docker-swarm-terminologies-76b0fbf97b62?source=rss-257fc4a62357------2</link>
            <guid isPermaLink="false">https://medium.com/p/76b0fbf97b62</guid>
            <category><![CDATA[container-orchestration]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker-swarm]]></category>
            <dc:creator><![CDATA[Mani M]]></dc:creator>
            <pubDate>Sat, 17 Oct 2020 12:27:40 GMT</pubDate>
            <atom:updated>2020-10-17T12:27:40.205Z</atom:updated>
            <content:encoded><![CDATA[<p>With the increase in the adoption of microservices, people use docker to isolate containers and better handle resources. With Kubernetes being a popular Orchestration tool, more and more people adopt it. Unfortunately, Kubernetes being a bit complex due to various functionalities being offered, Starters may feel it difficult or they take more time to understand it. Time is precious. Some people might opt for docker swarm due to its simplicity, Later they might think of moving to Kubernetes. I was one of them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_pBBuL_TDWKvljkh" /><figcaption>Photo by <a href="https://unsplash.com/@jbcreate_?utm_source=medium&amp;utm_medium=referral">Joseph Barrientos</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Due to docker swarm being simple and straight forward. It is easy to implement. It suits for managing simple applications. As <strong><em>Simplicity is the ultimate Sophistication</em></strong> most of the configurations/controls are abstracted and are handled by Docker Swarm. On the Other side, Kubernetes is complex in its own ways. My justification for this complexity is due to the providence of better control over the configurations.</p><blockquote>Mate, software is meant to evolve. 😉</blockquote><p>As a part of this evolution at One point, your application becomes complex and needs a better orchestration to handle workloads or you might need better control over your deployments. At this point, you might think of moving to Kubernetes. But it might be a little difficult initially to co-relate docker swarm and Kubernetes concepts. When I wanted to move from docker swarm to Kubernetes I found a lot of resources explaining about Kubernetes concepts. But, I couldn’t find anything giving an overall picture of Kubernetes functionalities in Docker swarm terms. Hence this article.</p><h3>Kubernetes Pod — Docker Swarm?</h3><p>Pods are the fundamental starting point in Kubernetes. In Docker Swarm, We run each docker container as a swarm service. These swarm services are grouped under a Stack. The only means of the relation between all the containers are either they will be attached to the same network or all of them share a volume. But in Kubernetes, containers can be grouped under a single object called Pod. i.e We can run a single container or a group of containers under a Pod. All these containers share the same container namespace. i.e same network namespace (same IP address and port space), IPC, and, optionally, they can use shared volumes. It is <em>like running a single Docker swarm service with multiple containers in it.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FaHB2zV7Nb2oqDZZ" /><figcaption>Photo by <a href="https://unsplash.com/@ishant_mishra54?utm_source=medium&amp;utm_medium=referral">Ishant Mishra</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Kubernetes Deployments — Docker Swarm Services</h3><p>Once we understand about Pods, The next confusion comes about handling Replicas. This is the part where I got confused to the core. Kubernetes have Replicaset, Deployments, Statefulset, Daemonsets to handle container replication whereas Docker swarm has only Swarm Services. All these tend to do the same(i.e controlling replication and High Availablity), Then what’s the difference?</p><p>To be simple, In Kubernetes, we actually have Replicaset to handle container replication, Deployment is just an upgraded version of ReplicaSet which additionally handles rollout and rollback of the new versions. Stateful sets are meant specifically to handle Stateful applications like Databases. For simplicity, It can be considered as an upgraded version of Deployments 😜</p><blockquote>So, Overall Kubernetes ReplicaSets, Deployments, StatefulSets tend to do the same which are being handled by Docker swarm Services. i.e managing replicas and rollout.</blockquote><h4>What about Daemonsets?</h4><p>These do the same work when we specify Docker swarm services with mode: global. I.e Running one replica of the container per node.</p><h3>Kubernetes Services — Docker?</h3><p>Before understanding Services, We need to understand how service discovery works. In Docker swarm, you can connect to any container if it is mounted to the same network either by using a container name or network alias. You can’t connect to the container attached to another network directly. In Kubernetes, everything runs under a namespace. To use Service Discovery, You need to explicitly create a service with ports that you want to expose. Pods/Deployments/ReplicaSets/DaemonSets/StatefulSets can be associated with these services by using labels. You can query these services and the exposed ports directly. When you want to connect to a Pod you can query the service name. You can query for services on other namespaces by using &lt;service_name&gt;.&lt;namespace_name&gt;.svc.cluster.local. Even if you query for services in the same namespace internally it gets translated to this format.</p><p>Ok, coming back to Kubernetes Services. Handling of open ports, network communication across pods, hosts are handled by Services, whereas in Docker Swarm we directly do the port binding. In Kubernetes, you will have two types of services, a Normal Service, and a Headless Service. The normal Service is as same as docker swarm service with endpoint_mode: vip , in which docker assigns a single IP and does load balancing across the replicas. Kubernetes Headless Service is an equivalent of docker swarm service with endpoint_mode: dnsrr which results in unique IPs for each replica. This results in interchanging IPs every time a service is queried.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IsYkb_I-X7qlkEoz" /><figcaption>Photo by <a href="https://unsplash.com/@calebrussell?utm_source=medium&amp;utm_medium=referral">Caleb Russell</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Kubernetes Probes — Docker Health Checks</h3><p>Docker uses health checks to determine whether a container is healthy, can service requests. In docker services, traffic will be routed only to healthy containers. In Kubernetes, this health check is further classified into different probes. You have livenessProbe to check whether a pod is alive, readinessProbe to tell whether a container can start serving requests, startupProbe to inform whether a pod has started. As long as readinessProbe returns success traffic is routed to it. As soon as it reports failure the pod gets removed and a new pod is scheduled. This new pod’s readinessProbe returns success traffic is not routed here. Just like docker routing traffic to healthy containers.</p><h4>Kubernetes Affinity, Anti-Affinity, Tolerations - Docker placement constraints</h4><p>In Docker swarm, we use placement preferences and placement constraints to control where a container gets deployed. The same can be mapped to Kubernetes to specify conditions to place and run a pod. We can even specify conditions like schedule pod only if 60% of node resources are free. Don’t schedule more than two replicas in the same node.</p><p>Of course, All multiple ways to achieve the same functionality makes Kubernetes more complicated. But you have better control of things when you get a fair idea of what you are doing. In nutshell, Docker swarm is like Windows which is easy to use and has limited functionalities, whereas Kubernetes is like Linux which is a bit difficult to start with. But once you understand it, You can do wonders with it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76b0fbf97b62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-in-depth/kubernetes-concepts-and-their-related-docker-swarm-terminologies-76b0fbf97b62">Kubernetes Concepts and their related Docker swarm terminologies</a> was originally published in <a href="https://medium.com/devops-in-depth">DevOps in Depth</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Foreground, Background — process’ playground in Linux]]></title>
            <link>https://medium.com/devops-in-depth/foreground-background-process-playground-in-linux-f48b5391d96a?source=rss-257fc4a62357------2</link>
            <guid isPermaLink="false">https://medium.com/p/f48b5391d96a</guid>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[linux-tutorial]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[process]]></category>
            <dc:creator><![CDATA[Mani M]]></dc:creator>
            <pubDate>Sun, 04 Oct 2020 14:07:56 GMT</pubDate>
            <atom:updated>2020-10-11T10:14:54.968Z</atom:updated>
            <content:encoded><![CDATA[<h3>Foreground, Background — process’ playground in Linux</h3><p>Developers, System Admins who have worked with Linux or a similar environment might have come across running the process in the foreground or putting it in the background. Most people move a process in the foreground to the background frequently when they are working in the command line without even knowing it. Devs who are aware of putting processes in the background aren’t aware of how to shift between foreground and background. Let’s try to understand how to do it and what happens at the other end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*ehMqRnLCbPAGJxKeOJIqfQ.jpeg" /><figcaption>Credits: <a href="https://minnie.tuhs.org/CompArch/Labs/week8.html">System Architecture(Foreground and Background Tasks)</a></figcaption></figure><h4>Process control</h4><p>So, when you run a command/process via terminal(can also be referred to as the console, shell, tty,…let’s stick to the terminal) what happens? All the inputs are fetched from the user, output, and error are written back to the terminal. (<em>Technically all the inputs are being read from </em><strong><em>stdin</em></strong><em>, an error is written to </em><strong><em>stderr</em></strong><em>, Output is written to </em><strong><em>stdout</em></strong><em>. These stdin, stdout, stderr are known as handlers. Whenever you run a command via an interactive terminal, all these handlers(stdin, stdout, stderr) refer to the terminal.</em>) There are some cases where you might be taking control of the process in between like pausing it, terminating it, resuming it. These kinds of actions are referred to as “process control”. All these processes which are being run can also be called jobs.</p><h4>Foreground</h4><p>Here the command is being executed in a terminal. The user provides input if needed and all the output and error are shown back to the user. If the terminal is closed in between the respective job gets terminated. In simple, the job is attached to the terminal session’s lifecycle. It is like watching a movie on your television where you get to see the visuals via a screen, hear audio via speakers. So if you close the movie all the visuals and vocals you experienced so far, are gone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*5QcZ-eQ-AQbA_DuwtJM-hQ.jpeg" /><figcaption><a href="https://www.reviewed.com/televisions/features/heres-the-one-mistake-everyone-makes-while-using-their-tv">From Reviewed</a></figcaption></figure><h4>Background</h4><p>You either run a job in the background or move an existing running job in the foreground to the background. All the inputs and outputs are supposed to be read and written back to the terminal. Unless they are being referred from some file. Due to this if you put a job in the background which prints back to the terminal you might still get to see the output of the job even though it is running in the background. The job in the background continues to run irrespective of the terminal from which it is being initiated. This kind of background job can be terminated using the process id. This is like playing audio/hearing songs switching off video. You still can hear the song but you don’t get to see the visuals.</p><h4>Suspend</h4><p>You pause a running job in between. You need to be aware of that you have paused a job and have not terminated it. So the resources are still being used up and are not being freed. It is like pausing a game in between. The intention of this is either to quit(terminate) it or to resume later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iY7C1-zonFlWO9yAXAdTrA.png" /><figcaption>Reference: <a href="https://www.reddit.com/r/gamedev/comments/gozdb2/how_would_you_implement_a_state_machine_with_a/">reddit</a></figcaption></figure><h4>Terminate</h4><p>You are interrupting a running job and ending its life. This is like exiting a game in between. <br> <em>Oh no! Whey did you do that? Maybe you are bored with it or you are done with it….</em></p><h4>Ok, How how to do all these, in the terminal?</h4><p>Let’s assume we are running an infinite loop in a script called test.bash</p><pre>#!/bin/bash<br>while true<br>do<br> echo “Linux is awesome”<br> sleep 60s<br>done</pre><p>This script keeps printing “Linux is awesome” once in a minute. When we run it in a terminal it runs in the foreground. i.e all the inputs and outputs are printed to the terminal. To put this in the background, we need to suspend it and then we can move it to the background. To suspend it we use <strong>Ctrl+Z</strong>. As soon as you do that, you can see <strong>[1]+ Stopped </strong>is printed, sometimes the number might be different based on the status of existing processes. This number is called as <strong><em>job id</em></strong>.</p><p>Once suspended, Now you can put the process in the background using bg command and pass the job id along with % like <strong>bg %1</strong>. Here the job is resumed in the background but the output is still written to the terminal as the script was printing back to the terminal. To prevent this we should have run the job along with output redirection. By the way, did you notice <strong><em>&amp;</em></strong> symbol getting added to the end of command? We will discuss it sooner.</p><p>To bring back the background job to the foreground, we use fg with % followed by job id like <strong>fg %1</strong>. This reverts to the previous state. To terminate a background or suspended job we can use the kill command with % followed by job id. When the job is in the foreground you can press <strong>Ctrl+C </strong>to terminate it.</p><blockquote>Kindly note these job IDs are local to the terminal session which means when you open a new tab or new window in a terminal, you can’t use existing job ids to refer to them, As those jobs are associated with a different session.</blockquote><p>All the jobs and their respective status can be viewed using the <strong>jobs</strong> command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBEEtDWw_-oOSeKlNWjT6Q.jpeg" /></figure><h4>What about the jobs that are yet to be run?</h4><p>If you want to run a job in the background you can add <strong>&amp;</strong> at the end of the command. As usual, it runs in the background and prints output to the terminal unless redirected. This is what happened above when we moved the foreground process to the background. The job can further be suspended, terminated, brought back to the foreground following above.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f48b5391d96a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-in-depth/foreground-background-process-playground-in-linux-f48b5391d96a">Foreground, Background — process’ playground in Linux</a> was originally published in <a href="https://medium.com/devops-in-depth">DevOps in Depth</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why are docker containers Ephemeral?]]></title>
            <link>https://medium.com/devops-in-depth/why-are-docker-containers-ephemeral-169c99d77455?source=rss-257fc4a62357------2</link>
            <guid isPermaLink="false">https://medium.com/p/169c99d77455</guid>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[ephemeral]]></category>
            <dc:creator><![CDATA[Mani M]]></dc:creator>
            <pubDate>Sat, 26 Sep 2020 09:15:41 GMT</pubDate>
            <atom:updated>2020-09-27T03:49:29.912Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why data in the docker container is destroyed at the end of the lifecycle?</h3><p>Everyone who has worked on Docker containers is aware of the fact that when containers are removed Data is cleared unless a volume is used. Due to this, Docker containers are termed to be <a href="https://www.dictionary.com/browse/ephemeral">ephemeral</a>, Meaning Data lasts for a short time. Here till the container is killed/removed. But most of us are not aware of the reason why are they so. Of course, I agree that there are ways to persist data (more on that later). However, let’s try to debunk why data by default is not retained.</p><h4>Storage Layers and Docker Images</h4><p>To understand this, let us first know how docker images are formed. Whenever You build a docker image each instruction creates a layer. These layers are ReadOnly(hereafter referred to as R/O), which means they can’t be edited again. At the end of the docker build, an image is created by stacking and stitching all these R/O layers. This kind of stacking, stitching, reusing is referred to as the “Union File system”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pXIEtoYY_xkzyGAHDeMqvg.jpeg" /><figcaption>Docker image layers. Source: <a href="https://championshuttler.github.io/docker-basicLearning/">champion shuttler’s docker-basic Learning</a></figcaption></figure><p>Since all the layers in docker images are R/O and follow the Union File system(termed as Unionfs) if we change the instructions and rebuild the image, all the layers beginning from the changed instruction get recreated, and the existing ones are discarded. The layers which were left unchanged before the edited layer gets reused.</p><h4>Copy On Write</h4><p>Whenever we create/run a docker container a thin Read-Write (hereafter referred to as R/W) layer is created on top of the docker image(a combination of multiple R/O layers). This newly created layer is called as the container layer. Whenever a file/folder is changed by any process, that particular object is copied to this R/W layer and is updated. Like this, all the changes performed in the container gets stored here. This type of copying Object and editing goes with the term Copy-On-Write(COW).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*l8YiwkfvUQsG_uGv9OyJDw.jpeg" /><figcaption>Docker container layers. Source: <a href="https://docs.docker.com/storage/storagedriver/">Docker Docs</a>.</figcaption></figure><p>As seen in the above image, the R/W layer stays at the top of the image layers. All the image layers are locked (they can’t be edited. Remember we were talking about R/O layers earlier?). This container layer(R/W) stays detached from the image layers and kind of floats. This layer is removed whenever the docker container is destroyed which leads to the removal of all changes so far. Hence the reason Docker containers are Ephemeral.</p><p>Thanks for all my mentors and well-wishers for the suggestions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=169c99d77455" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-in-depth/why-are-docker-containers-ephemeral-169c99d77455">Why are docker containers Ephemeral?</a> was originally published in <a href="https://medium.com/devops-in-depth">DevOps in Depth</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>