<?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 Vishweshwaran M J on Medium]]></title>
        <description><![CDATA[Stories by Vishweshwaran M J on Medium]]></description>
        <link>https://medium.com/@mj.vishweshwaran?source=rss-4846d44292d7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Z4S08nrBSQRW-gvhEtThiQ.jpeg</url>
            <title>Stories by Vishweshwaran M J on Medium</title>
            <link>https://medium.com/@mj.vishweshwaran?source=rss-4846d44292d7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:29:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mj.vishweshwaran/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[Building a Kubernetes Cluster with kubeadm — A Simple, Practical Guide]]></title>
            <link>https://medium.com/@mj.vishweshwaran/kubernetes-cluster-with-kubeadm-production-approach-e3043ea66e39?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3043ea66e39</guid>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[control-plane]]></category>
            <category><![CDATA[kubeadm]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Wed, 10 Dec 2025 14:51:49 GMT</pubDate>
            <atom:updated>2025-12-10T14:51:49.664Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Kubernetes Cluster with kubeadm — Production Approach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1IXWx6FSL8IcmABq.png" /><figcaption>Kubeadm Setup</figcaption></figure><p>If you’re learning Kubernetes or setting up your own cluster for the first time, kubeadm is one of the cleanest ways to get started. It gives you full control over your nodes while keeping the setup predictable and production-friendly.</p><p>In this guide, I’ll walk you through the entire cluster creation process — from preparing your nodes all the way to joining worker nodes and deploying a Pod network. Everything is broken down step-by-step so you can follow along easily, even if you’re new to Kubernetes.</p><h4><strong>High Level Steps</strong></h4><p>Here’s the big picture of what we’re building:</p><ol><li>Decide number of master and worker nodes and have it provisioned</li><li>Install container runtime + Kubernetes packages</li><li>Install kubeadm, kubectl, kubelet tool (all same version)</li><li>Initialize the Kubernetes control plane (master node)</li><li>Install a Pod network so pods can communicate</li><li>Join worker nodes to the cluster</li></ol><p>By the end, you’ll have a running Kubernetes cluster that behaves just like one in real production environments.</p><h4>Official Docs</h4><ul><li><strong>Install kubeadm:</strong><br> <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/">https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/</a></li><li><strong>Create a cluster:</strong><br> <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/">https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/</a></li></ul><h3><strong>Step 1: Preparing the Master and Worker Nodes</strong></h3><p>Let’s start by setting up the required repositories and installing Kubernetes components.</p><p><strong>Add Kubernetes package repositories</strong></p><pre>sudo apt-get install -y apt-transport-https ca-certificates curl gpg<br><br>echo &quot;deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.34/deb/ /&quot; \<br>| sudo tee /etc/apt/sources.list.d/kubernetes.list<br><br>curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.34/deb/Release.key \<br>| sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg<br><br>sudo apt-get update</pre><p><strong>Check what versions are available</strong></p><pre>sudo apt-cache madison kubeadm<br>sudo apt-cache madison kubectl<br>sudo apt-cache madison kubelet</pre><p><strong>Unhold older versions (optional)</strong></p><pre>sudo apt-mark unhold kubelet kubectl kubeadm || true</pre><p><strong>Install Kubernetes binaries</strong></p><p>Replace x by the required version that we obtain from the available versions command</p><pre>sudo apt-get install -y kubeadm=&#39;1.34.x-*&#39; kubelet=&#39;1.34.x-*&#39; kubectl=&#39;1.34.x-*&#39;<br>sudo apt-mark hold kubeadm kubectl kubelet</pre><p><strong>Start and enable kubelet</strong></p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable --now kubelet<br>sudo systemctl restart kubelet</pre><p><strong>Verify installation</strong></p><pre>kubeadm version<br>kubectl version<br>kubelet --version</pre><p><strong>Enable IPv4 forwarding (important!)</strong></p><p>Kubernetes networking relies heavily on IP forwarding, so we must switch it on:</p><pre>cat &lt;&lt;EOF | sudo tee /etc/sysctl.d/k8s.conf<br>net.ipv4.ip_forward=1<br>EOF<br><br>sudo sysctl --system<br>sysctl net.ipv4.ip_forward</pre><h3>Step 2: Initializing the Control Plane</h3><p>Before running kubeadm init, make sure you know:</p><ul><li>The Pod CIDR (for example: 10.244.0.0/16)</li><li>The Service CIDR (commonly: 10.96.0.0/12)</li><li>The IP address of the interface you’ll use for the API server</li></ul><p><strong>Initialize the master node</strong></p><pre>kubeadm init \<br>  --apiserver-cert-extra-sans=controlplane \<br>  --apiserver-advertise-address=&lt;ipAddressOfDesiredInterface&gt; \<br>  --pod-network-cidr=&lt;podNWCIDR&gt; \<br>  --service-cidr=&lt;svcNWCIDR&gt;</pre><p>Once this finishes, you’ll see a kubeadm join command — <strong>copy it somewhere safe</strong> because worker nodes will need it.</p><p><strong>Configure kubectl for your user</strong></p><pre>mkdir -p $HOME/.kube<br>sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config<br>sudo chown $(id -u):$(id -g) $HOME/.kube/config</pre><p>Now kubectl get nodes will start working.</p><h3><strong>Step 3: Setting Up the Pod Network (Flannel)</strong></h3><p>Kubernetes won’t let pods talk to each other until you install a <strong>CNI plugin</strong>. Here we’ll use Flannel because it’s simple and widely used.</p><p><strong>Download the Flannel YAML</strong></p><pre>curl -LO https://raw.githubusercontent.com/flannel-io/flannel/v0.20.2/Documentation/kube-flannel.yml</pre><p><strong>Update the Pod CIDR</strong></p><p>Edit the yaml file with net-conf.json section to match the CIDR you used in <strong>kubeadm init</strong></p><pre>{<br>  &quot;Network&quot;: &quot;&lt;podNWCIDR&gt;&quot;,<br>  &quot;Backend&quot;: {<br>    &quot;Type&quot;: &quot;vxlan&quot;<br>  }<br>}</pre><p><strong>Set the right interface (optional)</strong></p><pre>args:<br>  - --ip-masq<br>  - --kube-subnet-mgr<br>  - --iface=eth0</pre><p><strong>Apply the network</strong></p><pre>kubectl apply -f kube-flannel.yml</pre><p>Give it a few seconds, then check:</p><pre>kubectl get nodes</pre><p>You should start seeing the nodes turn <strong>Ready</strong>.</p><h3>Step 4: Joining Worker Nodes</h3><p>Run the join command from you obtained from kubeadm init output on every worker node</p><pre>kubeadm join &lt;master-ip&gt;:6443 --token &lt;token&gt; --discovery-token-ca-cert-hash &lt;hash&gt;</pre><p>After a few moments, you should see all the nodes when you run and in <strong>ready </strong>state</p><pre>kubectl get nodes</pre><p>At this point, your cluster is up and running!</p><p>And that’s it — you now have a fully operational Kubernetes cluster built the same way many production environments are set up.</p><h3>Quick Note: Why Kubernetes Needs IP Forwarding</h3><p>One of the most common networking issues in Kubernetes happens when net.ipv4.ip_forward=1 is missing.</p><p>In simple terms:</p><blockquote><em>Kubernetes needs to route packets between different network interfaces so that pods and services can reach each other. Without IP forwarding, the entire cluster networking falls apart.</em></blockquote><p>So that one little kernel setting is incredibly important.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3043ea66e39" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mount & Attach EBS Volume to EC2 Instance]]></title>
            <link>https://medium.com/@mj.vishweshwaran/mount-attach-ebs-volume-to-ec2-instance-74cb73239b77?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/74cb73239b77</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[fstab]]></category>
            <category><![CDATA[ebs-volume]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Fri, 03 Jan 2025 11:36:26 GMT</pubDate>
            <atom:updated>2025-01-03T11:36:26.507Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZOTYL-0rv2Mi3GxR" /></figure><p>In this blog we are going to mount an EBS volume to an EC2 instance and keep it mounted even after reboots.</p><p>Topics covered:</p><ul><li>Format disk &amp; make filesystem to make the disk usable</li><li>Update /etc/fstab/ to keep the volume attached to instance even after reboots</li></ul><p>Below are the detailed steps. Lets jump in!!</p><p>𝗦𝘁𝗲𝗽 𝟭: 𝗖𝗿𝗲𝗮𝘁𝗲 𝗮𝗻 𝗘𝗖𝟮 𝗜𝗻𝘀𝘁𝗮𝗻𝗰𝗲</p><p>Launch an EC2 instance with the following specs:</p><ul><li>Instance type: t2.micro</li><li>Root volume: 8 GB</li></ul><p>𝗦𝘁𝗲𝗽 𝟮: 𝗖𝗿𝗲𝗮𝘁𝗲 𝗮𝗻 𝗘𝗕𝗦 𝗩𝗼𝗹𝘂𝗺𝗲</p><p>Navigate to the EBS Dashboard and create a volume:</p><ul><li>Type: GP2</li><li>Size: 4 GB</li><li>Ensure the volume is in the same Availability Zone (AZ) as your EC2 instance.</li></ul><p>𝗦𝘁𝗲𝗽 𝟯: 𝗔𝘁𝘁𝗮𝗰𝗵 𝘁𝗵𝗲 𝗩𝗼𝗹𝘂𝗺𝗲</p><p>Attach the newly created EBS volume to your EC2 instance.</p><p>𝗦𝘁𝗲𝗽 𝟰: 𝗟𝗼𝗴𝗶𝗻 𝗮𝗻𝗱 𝗩𝗲𝗿𝗶𝗳𝘆 𝘁𝗵𝗲 𝗕𝗹𝗼𝗰𝗸 𝗗𝗲𝘃𝗶𝗰𝗲</p><p>SSH into your EC2 instance.</p><ul><li>List the block devices using 𝑪𝒐𝒎𝒎𝒂𝒏𝒅: lsblk</li><li>Confirm the new volume is listed and matches the size you created.</li></ul><p>𝗦𝘁𝗲𝗽 𝟱: 𝗙𝗼𝗿𝗺𝗮𝘁 𝘁𝗵𝗲 𝗗𝗶𝘀𝗸 𝗮𝗻𝗱 𝗖𝗿𝗲𝗮𝘁𝗲 𝗮 𝗣𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻</p><p>Start the disk partitioning tool using</p><ul><li>𝑪𝒐𝒎𝒎𝒂𝒏𝒅: sudo fdisk &lt;diskName&gt;</li></ul><p>Follow these steps in fdisk:</p><ul><li>Type n (new) to create a partition.</li><li>Type p (primary) to make it a primary partition.</li><li>Press Enter three times to accept defaults.</li><li>Type w to write changes and exit.</li></ul><p>𝗦𝘁𝗲𝗽 𝟲: 𝗩𝗮𝗹𝗶𝗱𝗮𝘁𝗲 𝘁𝗵𝗲 𝗣𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻</p><p>Run lsblk command again to ensure the partition is listed under the disk.</p><p>𝗦𝘁𝗲𝗽 𝟳: 𝗖𝗿𝗲𝗮𝘁𝗲 𝗮 𝗙𝗶𝗹𝗲𝘀𝘆𝘀𝘁𝗲𝗺</p><p>Format the partition with the ext4 filesystem using</p><ul><li>𝑪𝒐𝒎𝒎𝒂𝒏𝒅: sudo mkfs -t ext4 &lt;diskPartition&gt;</li></ul><p>𝗦𝘁𝗲𝗽 𝟴: 𝗣𝗿𝗲𝗿𝗲𝗾𝘂𝗶𝘀𝗶𝘁𝗲 𝘁𝗼 𝗠𝗼𝘂𝗻𝘁 𝘁𝗵𝗲 𝗗𝗶𝘀𝗸</p><p>Create a directory to mount the volume using</p><ul><li>𝑪𝒐𝒎𝒎𝒂𝒏𝒅: sudo mkdir /&lt;folderName&gt;</li><li>Add some test data to validate persistence later.</li></ul><p>𝗦𝘁𝗲𝗽 𝟵: 𝗠𝗼𝘂𝗻𝘁 𝘁𝗵𝗲 𝗣𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻</p><p>Mount the partition to the folder using 𝑪𝒐𝒎𝒎𝒂𝒏𝒅: sudo mount &lt;diskPartition&gt; /&lt;folderName&gt;</p><p>𝗦𝘁𝗲𝗽 𝟭𝟬: 𝗣𝗲𝗿𝘀𝗶𝘀𝘁 𝗠𝗼𝘂𝗻𝘁 𝗼𝗻 𝗥𝗲𝗯𝗼𝗼𝘁</p><p>Edit the fstab file using</p><ul><li>𝑪𝒐𝒎𝒎𝒂𝒏𝒅: sudo vi /etc/fstab</li><li>Add the line &lt;diskPartition&gt; /&lt;folderName&gt; ext4 defaults 0 0</li><li>Save and verify with using 𝑪𝒐𝒎𝒎𝒂𝒏𝒅: cat /etc/fstab</li></ul><p>𝗦𝘁𝗲𝗽 𝟭𝟭: 𝗧𝗲𝘀𝘁 𝗣𝗲𝗿𝘀𝗶𝘀𝘁𝗲𝗻𝗰𝗲</p><ul><li>Stop and start the EC2 instance.</li><li>Verify the mount and test data using 𝑪𝒐𝒎𝒎𝒂𝒏𝒅: ls /&lt;folderName&gt;</li></ul><p>That’s it, we have successfully attached an EBS volume to your EC2 instance and ensured it’s permanently available across reboots.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74cb73239b77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Cluster Deployment using KOPS]]></title>
            <link>https://medium.com/@mj.vishweshwaran/kubernetes-cluster-deployment-using-kops-b374caff875b?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b374caff875b</guid>
            <category><![CDATA[kops]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[orchestration]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[k8s]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Fri, 15 Nov 2024 16:44:16 GMT</pubDate>
            <atom:updated>2024-11-15T23:18:49.168Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*78GPyaNpa9cx9Y6bjgTtUQ.png" /><figcaption>Kubernetes Deployment using KOPS</figcaption></figure><p>In this blog we can set up a Kubernetes cluster using KOPS (Kubernetes Operations), this quick guide will walk you through the process, from preparing your environment to deploying and validating the cluster.</p><h3>Prerequisites:</h3><ul><li><strong>A DNS name</strong> (e.g: vishdevopslearn.xyz) registered</li><li>An <strong>S3 bucket</strong> for KOPS state storage (e.g: vish-kops-bucket)</li><li>An EC2 instance to serve as your management server with appropriate IAM roles and permissions</li></ul><h3>Step 1: Setting Up Your Management Server</h3><ol><li><strong>Create an EC2 instance</strong> to manage your cluster</li><li>Generate an <strong>SSH key pair</strong> for accessing your cluster nodes</li></ol><pre>ssh-keygen</pre><p>3. Assign the <strong>Administrator Access IAM Role</strong> to your instance to grant full administrative permissions for testing purposes</p><h3>Step 2: Installing KOPS and Kubectl</h3><ol><li>Download the binaries. Its good to download the previos version of latest to avoid any bugs/issues</li></ol><ul><li><strong>KOPS:</strong> <a href="https://github.com/kubernetes/kops">KOPS GitHub Releases</a></li><li><strong>Kubectl CLI:</strong> <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/">Kubernetes Docs</a></li></ul><p>2. Move the downloaded files to <strong>/usr/local/bin</strong> and make them executable</p><pre>chmod +x /usr/local/bin/kops<br>chmod +x /usr/local/bin/kubectl</pre><h3>Step 3: Configure Environment Variables</h3><ol><li>Edit your <strong>.bashrc</strong> file to add the following environment variables</li></ol><pre>export NAME=vishdevopslearn.xyz<br>export KOPS_STATE_STORE=s3://vish-kops-bucket<br>export AWS_REGION=ap-south-1<br>export CLUSTER_NAME=vish-kops-cluster<br>export EDITOR=&#39;/usr/bin/nano&#39;</pre><p>2. Apply the changes</p><pre>source ~/.bashrc</pre><h3>Step 4: Create the Cluster</h3><ol><li>Generate the cluster.yaml file with the following command to define the desired state of the K8s cluster using KOPS</li></ol><pre>kops create cluster --name=vishdevopslearn.xyz \<br>--state=s3://vish-kops-bucket --zones=ap-south-1a,ap-south-1b \<br>--node-count=2 --node-size=t2.micro --node-volume-size 10 \<br>--control-plane-count=1 --control-plane-zones=ap-south-1a --control-plane-size=t2.medium --control-plane-volume-size 10 \<br>--ssh-public-key /root/.ssh/id_ed25519.pub \<br>--dns-zone=vishdevopslearn.xyz --dry-run --output yaml &gt; cluster.yaml</pre><p>2. Use the created file to create the cluster</p><pre>kops create -f cluster.yaml<br>kops update cluster --name vishdevopslearn.xyz --yes --admin</pre><p>--admin: Generates an administrative kubeconfig file, allowing the user immediate access to manage the cluster.</p><h3>Explanation of Each Option of the create command</h3><ol><li><strong>kops create cluster</strong></li></ol><ul><li>This is the primary command to create a new Kubernetes cluster using KOPS</li></ul><p>2. <strong>--name=vishdevopslearn.xyz</strong></p><ul><li>Specifies the fully qualified domain name (FQDN) of the Kubernetes cluster</li><li>This name is essential for DNS-based discovery and communication within the cluster</li></ul><p>3. <strong>--state=s3://vish-kops-bucket</strong></p><ul><li>Indicates the S3 bucket where KOPS will store the cluster’s state and configurations</li><li>This bucket acts as the source of truth for the cluster’s configuration and is required for KOPS operations</li></ul><p>4. <strong>--zones=ap-south-1a,ap-south-1b</strong></p><ul><li>Specifies the availability zones (AZs) where the cluster nodes will be deployed</li><li>Using multiple AZs ensures high availability and fault tolerance</li></ul><p>5. <strong>--node-count=2</strong></p><ul><li>Defines the number of worker nodes in the cluster</li><li>In this case, there will be <strong>2 worker nodes</strong></li></ul><p>6. <strong>--node-size=t2.micro</strong></p><ul><li>Specifies the EC2 instance type for worker nodes (e.g., t2.micro)</li><li>This determines the compute capacity and cost of the nodes</li></ul><p>7. <strong>--node-volume-size=10</strong></p><ul><li>Sets the size (in GB) of the EBS volume attached to each worker node</li><li>Here, each worker node will have a 10GB disk</li></ul><p>8. <strong>--control-plane-count=1</strong></p><ul><li>Defines the number of control-plane (master) nodes in the cluster</li><li>A single control plane is used here for simplicity; multiple control planes provide high availability</li></ul><p>9. <strong>--control-plane-zones=ap-south-1a</strong></p><ul><li>Specifies the availability zone for the control plane</li><li>In this case, the control plane will reside in ap-south-1a</li></ul><p>10. <strong>--control-plane-size=t2.medium</strong></p><ul><li>Specifies the EC2 instance type for the control-plane node (e.g., t2.medium)</li><li>The control plane typically requires more resources than worker nodes</li></ul><p>11.<strong>--control-plane-volume-size=10</strong></p><ul><li>Sets the size (in GB) of the EBS volume attached to the control-plane node</li></ul><p>12. <strong>--ssh-public-key /root/.ssh/id_ed25519.pub</strong></p><ul><li>Provides the public SSH key to enable secure access to the cluster nodes</li><li>This key will be used for accessing nodes via SSH for troubleshooting or management</li></ul><p>13. <strong>--dns-zone=vishdevopslearn.xyz</strong></p><ul><li>Specifies the Route 53 DNS zone where the cluster’s DNS records will be created</li><li>This ensures proper DNS setup for cluster services and components</li></ul><p>14. <strong>--dry-run</strong></p><ul><li>Generates the configuration without actually creating the cluster</li><li>This is useful for reviewing or modifying the configuration before applying it</li></ul><p>15. <strong>--output yaml &gt; cluster.yaml</strong></p><ul><li>Outputs the cluster’s configuration in <strong>YAML</strong> format to a file named cluster.yaml</li><li>The YAML file can be edited before applying it to create the cluster if required</li></ul><h3>Step 5: Validate the Cluster</h3><ol><li>Validate the cluster</li></ol><pre>kops validate cluster --wait 10m</pre><p>2. Check nodes and pods</p><pre>kubectl cluster-info<br>kubectl get nodes -o wide<br>kubectl get pods -o wide</pre><h3>Step 6: Delete the Cluster</h3><pre>kops delete -f cluster.yaml --yes<br></pre><p>KOPS is generally used for Production deployment with no administrative permissions, am too exploring what all necessary permissions are required and update the same here. Happy Learning!!</p><h3>My Cluster Command Screenshots</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCMpdDh4p-DcfqBWkoZ4sw.png" /><figcaption>Generate Cluster.yaml file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GStpbpZbSnqdohLSB5Cpvw.png" /><figcaption>Create &amp; Update cluster</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mlnB74TsoUlBfeSGXe8UXw.png" /><figcaption>Cluster validation for 10 mins</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MW284n-x_dFm3fjWFLxfrw.png" /><figcaption>Cluster Readiness with Nodes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kZBPmSLmgJ0K4wGPR5xg6w.png" /><figcaption>Cluster Info</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vD-BvWLebdUUGqcdmKAXjA.png" /><figcaption>Cluster Nodes and its IP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxv6nb9Xddbk5m9LHAnN0w.png" /><figcaption>AWS Console created resources</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hp-LzF4DP2A8HotkWosHhg.png" /><figcaption>All resources created by KOPS — kubectl get all -A</figcaption></figure><p>Please feel free to reach out to me for any questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b374caff875b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vish DevOpsMiniBytes]]></title>
            <link>https://medium.com/@mj.vishweshwaran/vish-devopsminibytes-10f2df902b04?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/10f2df902b04</guid>
            <category><![CDATA[vishdevopsminibytes]]></category>
            <category><![CDATA[devops-interview]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[devopsminibytes]]></category>
            <category><![CDATA[vishbraintuning]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Sat, 31 Aug 2024 14:13:48 GMT</pubDate>
            <atom:updated>2024-12-08T16:24:14.943Z</atom:updated>
            <content:encoded><![CDATA[<p>Vish’s Quick BrainTuning to Interview Scenarios &amp; DevOps concepts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RpeWdxC6BhfjLMDI" /><figcaption>Home Img</figcaption></figure><p>Hi all, this blog consists of quick small concepts to revise/braintune the DevOps concepts. This blog can also be used for interview purposes where I would append with new content on regular basis.</p><h3>Contents</h3><ul><li>𝗦𝗲𝘁/𝗖𝗵𝗮𝗻𝗴𝗲 𝗧𝗶𝗺𝗲 𝗭𝗼𝗻𝗲 𝗼𝗳 𝗮 𝗟𝗶𝗻𝘂𝘅 𝗠𝗮𝗰𝗵𝗶𝗻𝗲</li><li>𝗟𝗶𝗺𝗶𝘁 𝗖𝗣𝗨 &amp; 𝗠𝗲𝗺𝗼𝗿𝘆 𝗼𝗳 𝗗𝗼𝗰𝗸𝗲𝗿 𝗖𝗼𝗻𝘁𝗮𝗶𝗻𝗲𝗿</li><li>𝗖𝗿𝗼𝗻𝘁𝗮𝗯 &amp; 𝗖𝗿𝗼𝗻 𝗘𝘅𝗽𝗿𝗲𝘀𝘀𝗶𝗼𝗻</li><li>𝗤𝘂𝗶𝗰𝗸𝗹𝘆 𝗦𝗲𝗮𝗿𝗰𝗵 𝗙𝗶𝗹𝗲𝘀/𝗙𝗼𝗹𝗱𝗲𝗿𝘀 𝘂𝘀𝗶𝗻𝗴 𝗟𝗼𝗰𝗮𝘁𝗲 𝗖𝗼𝗺𝗺𝗮𝗻𝗱</li><li>𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗩𝗮𝗿𝗶𝗮𝗯𝗹𝗲 𝗢𝗿𝗱𝗲𝗿 𝗼𝗳 𝗣𝗿𝗲𝗰𝗲𝗱𝗲𝗻𝗰𝗲</li><li>𝗠𝘆 𝗳𝗿𝗲𝗾𝘂𝗲𝗻𝘁𝗹𝘆 𝘂𝘀𝗲𝗱 𝘃𝗶 𝗲𝗱𝗶𝘁𝗼𝗿 𝗸𝗲𝘆𝗯𝗼𝗮𝗿𝗱 𝘀𝗵𝗼𝗿𝘁𝗰𝘂𝘁𝘀</li><li>𝗧𝗿𝗶𝗴𝗴𝗲𝗿 𝗖𝗹𝗼𝘂𝗱𝗪𝗮𝘁𝗰𝗵 𝗔𝗹𝗮𝗿𝗺 𝗳𝗼𝗿 𝘁𝗲𝘀𝘁𝗶𝗻𝗴</li><li>𝗦𝗰𝗵𝗲𝗱𝘂𝗹𝗲 𝗞𝘂𝗯𝗲𝗿𝗻𝗲𝘁𝗲𝘀 𝗣𝗼𝗱 𝗼𝗻 𝗽𝗮𝗿𝘁𝗶𝗰𝘂𝗹𝗮𝗿 𝗡𝗼𝗱𝗲 𝗶𝗻 𝗖𝗹𝘂𝘀𝘁𝗲𝗿</li><li>𝗦𝗽𝗹𝗶𝘁 𝘀𝗶𝗻𝗴𝗹𝗲 𝘁𝗲𝗿𝗺𝗶𝗻𝗮𝗹 𝘁𝗼 𝗺𝘂𝗹𝘁𝗶𝗽𝗹𝗲 𝗼𝗻𝗲𝘀</li></ul><h3>1.⏰𝗦𝗲𝘁/𝗖𝗵𝗮𝗻𝗴𝗲 𝗧𝗶𝗺𝗲 𝗭𝗼𝗻𝗲 𝗼𝗳 𝗮 𝗟𝗶𝗻𝘂𝘅 𝗠𝗮𝗰𝗵𝗶𝗻𝗲 ⏰</h3><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: timedatectl<br>📝 shows the current timezone with additional details related to datetime</p><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: timedatectl list-timezones<br>📝 used to list all the available timezones</p><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: timedatectl set-timezone Asia/Kolkata<br>📝 used to set the timezone Asia/Kolkata</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y_5-MKsO7Xd2DJe5" /><figcaption>timedatectl</figcaption></figure><h3>2.💻 𝗟𝗶𝗺𝗶𝘁 𝗖𝗣𝗨 &amp; 𝗠𝗲𝗺𝗼𝗿𝘆 𝗼𝗳 𝗗𝗼𝗰𝗸𝗲𝗿 𝗖𝗼𝗻𝘁𝗮𝗶𝗻𝗲𝗿 ⚙️</h3><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱:<br>💻 docker run -dt — name vish_cont — memory 100m — cpus 0.5 busybox<br>📝📝starts a container named 𝘃𝗶𝘀𝗵_𝗰𝗼𝗻𝘁 with 𝟭𝟬𝟬 𝗠𝗕 of memory and 𝟬.𝟱 𝗰𝗼𝗿𝗲𝘀 of CPU</p><p>🔹𝗩𝗮𝗹𝗶𝗱𝗮𝘁𝗶𝗼𝗻 𝗼𝗳 𝗠𝗲𝗺𝗼𝗿𝘆:<br>💻 docker stats vish_cont<br>📝📝 shows the stats of the running container</p><p>💻 docker exec -it vish_cont sh<br>📝📝 gets into the running container named vish_cont</p><p>💻 cat /sys/fs/cgroup/memory.max<br>📝📝 shows the output max memory in bytes<br>📝📝📝 divide the number by 1024*1024 to get in MB</p><p>🔹𝗩𝗮𝗹𝗶𝗱𝗮𝘁𝗶𝗼𝗻 𝗼𝗳 𝗖𝗣𝗨<br>💻 docker exec -it vish_cont sh<br>📝📝 gets into the running container named vish_cont</p><p>💻 cat /sys/fs/cgroup/cpu.max<br>📝📝 shows the output of the number of cores used<br>📝📝📝 divide the output first number with the second to get the number of cpu cores</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HgzzSJ8bH4W1mL1V" /><figcaption>Docker Exec</figcaption></figure><h3>3.🕒 𝗖𝗿𝗼𝗻𝘁𝗮𝗯 &amp; 𝗖𝗿𝗼𝗻 𝗘𝘅𝗽𝗿𝗲𝘀𝘀𝗶𝗼𝗻🕒</h3><p>🕒 𝗖𝗿𝗼𝗻𝘁𝗮𝗯 🕒<br>📝📝 crontab aka 𝑪𝒓𝒐𝒏 𝑻𝒂𝒃𝒍𝒆 is a configuration file to schedule &amp; automate tasks</p><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: crontab -l<br>📝📝 used to list the available cron jobs scheduled</p><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: crontab -e<br>📝📝 used to list the available cron jobs scheduled</p><p>🕒 𝗖𝗿𝗼𝗻 𝗘𝘅𝗽𝗿𝗲𝘀𝘀𝗶𝗼𝗻 🕒 — Refer post picture to understand the expression<br>📝📝 visit the website to generate cron expression — <a href="https://crontab.guru/">https://crontab.guru/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/0*6Hf1XYEA8X57vwfR" /><figcaption>Crontab syntax</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zkgHXXRkGQcRkzDg" /><figcaption>Crontab list</figcaption></figure><h3>4.🔍 𝗤𝘂𝗶𝗰𝗸𝗹𝘆 𝗦𝗲𝗮𝗿𝗰𝗵 𝗙𝗶𝗹𝗲𝘀/𝗙𝗼𝗹𝗱𝗲𝗿𝘀 𝘂𝘀𝗶𝗻𝗴 𝗟𝗼𝗰𝗮𝘁𝗲 𝗖𝗼𝗺𝗺𝗮𝗻𝗱 🔍</h3><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: sudo apt install plocate<br>📝📝 install the plocate on debian based systems</p><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: updatedb<br>📝📝 updates the database that locate uses<br>📝📝📝 locate is faster because it uses this prebuilt database instead of filesystem</p><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: locate &lt;file/folder pattern&gt;<br>📝📝 used to quickly find location of files and directories<br>📝📝📝 returns the absolute path of the file/folder mentioned<br>📝📝📝📝 example: locate add.txt, locate *.tar</p><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: locate -i &lt;file/folder pattern&gt;<br>📝📝 case insenstive search</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EoNnN9LWDpMHDSDS" /><figcaption>Search, Find, Locate</figcaption></figure><h3>5.🔢 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗩𝗮𝗿𝗶𝗮𝗯𝗹𝗲 𝗢𝗿𝗱𝗲𝗿 𝗼𝗳 𝗣𝗿𝗲𝗰𝗲𝗱𝗲𝗻𝗰𝗲 🔢</h3><p>Terraform variables take the following precedence:<br><strong>🔹 Environment Variables</strong><br>📝📝 terraform environment variables starts with TF_VAR_&lt;variableName&gt;</p><p><strong>🔹 Variable Defaults</strong><br>📝📝 variable blocks consisting the default value</p><p><strong>🔹 Terraform tfvars (terraform.tfvars)</strong><br>📝📝 seperate file named terraform.tfvars with variables defined</p><p><strong>🔹 CLI (using -var and -var-file)</strong><br>📝📝 passing variable name (-var=&lt;varName=varValue&gt;)<br>📝📝 📝 passing variable filename (-var-file=&lt;fileNmae&gt;)</p><h3>6.⌨️ 𝗠𝘆 𝗳𝗿𝗲𝗾𝘂𝗲𝗻𝘁𝗹𝘆 𝘂𝘀𝗲𝗱 𝘃𝗶 𝗲𝗱𝗶𝘁𝗼𝗿 𝗸𝗲𝘆𝗯𝗼𝗮𝗿𝗱 𝘀𝗵𝗼𝗿𝘁𝗰𝘂𝘁𝘀 ⌨️</h3><p>📝 𝗖𝘂𝗿𝘀𝗼𝗿 𝗢𝗽𝗲𝗿𝗮𝘁𝗶𝗼𝗻𝘀<br>🔹Move cursor to start of the line — “𝗴𝗴”<br>🔹Move cursor to end of the line — “𝘀𝗵𝗶𝗳𝘁 + 𝗴”</p><p>📝 𝗙𝗶𝗻𝗱 &amp; 𝗥𝗲𝗽𝗹𝗮𝗰𝗲 𝗢𝗽𝗲𝗿𝗮𝘁𝗶𝗼𝗻𝘀<br>🔹Search for a pattern &amp; move cursor to it — “/&lt;𝘀𝗲𝗮𝗿𝗰𝗵𝗣𝗮𝘁𝘁𝗲𝗿𝗻&gt;”<br>🔹Find &amp; replace old text to new text — “:%𝘀/𝗼𝗹𝗱𝗧𝗲𝘅𝘁/𝗻𝗲𝘄𝗧𝗲𝘅𝘁”</p><p>📝 𝗗𝗲𝗹𝗲𝘁𝗲 𝗢𝗽𝗲𝗿𝗮𝘁𝗶𝗼𝗻𝘀<br>🔹Delete the current line — “𝗱𝗱”<br>🔹Delete all contents of file — “𝗴𝗴 𝗱𝗚”<br>🔹Delete current line &amp; next desired number of lines — “𝗱&lt;𝗻𝘂𝗺𝗯𝗲𝗿𝗢𝗳𝗟𝗶𝗻𝗲𝘀&gt;”</p><p>📝 𝗠𝗶𝘀𝗰 𝗢𝗽𝗲𝗿𝗮𝘁𝗶𝗼𝗻𝘀<br>🔹Undo the operation — “𝘂”<br>🔹Set the line numbers — “:𝘀𝗲𝘁 𝗻𝘂”</p><h3>7.🛠️ 𝗧𝗿𝗶𝗴𝗴𝗲𝗿 𝗖𝗹𝗼𝘂𝗱𝗪𝗮𝘁𝗰𝗵 𝗔𝗹𝗮𝗿𝗺 𝗳𝗼𝗿 𝘁𝗲𝘀𝘁𝗶𝗻𝗴 🛠️</h3><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: Using AWS CLI<br>📝📝 aws cloudwatch set-alarm-state — alarm-name “VishCPU_70” — state-value ALARM — state-reason “Testing Vish Alarm”<br>📝📝📝 This helps in quickly testing the alarm when the threshold is not reached.<br>📝📝📝📝 Sets the VishCPU_70 alarm to ALARM state and can send notifications based on the alarm configured.</p><p>𝗘𝘅𝘁𝗿𝗮𝘀:<br>𝗔𝗹𝗮𝗿𝗺 𝗦𝘁𝗮𝘁𝗲𝘀:<br>𝗢𝗞 𝗦𝘁𝗮𝘁𝗲 — alarm is within the threshold defined<br>𝗔𝗟𝗔𝗥𝗠 𝗦𝘁𝗮𝘁𝗲 — alarm crossed the threshold defined<br>𝗜𝗡𝗦𝗨𝗙𝗙𝗜𝗖𝗜𝗘𝗡𝗧_𝗗𝗔𝗧𝗔 𝗦𝘁𝗮𝘁𝗲 — Dont have much data to trigger the alarm</p><h3>8.💻 𝗦𝗰𝗵𝗲𝗱𝘂𝗹𝗲 𝗞𝘂𝗯𝗲𝗿𝗻𝗲𝘁𝗲𝘀 𝗣𝗼𝗱 𝗼𝗻 𝗽𝗮𝗿𝘁𝗶𝗰𝘂𝗹𝗮𝗿 𝗡𝗼𝗱𝗲 𝗶𝗻 𝗖𝗹𝘂𝘀𝘁𝗲𝗿💻</h3><p>By default, K8s assigns a node label named 𝒌𝒖𝒃𝒆𝒓𝒏𝒆𝒕𝒆𝒔.𝒊𝒐/𝒉𝒐𝒔𝒕𝒏𝒂𝒎𝒆 automatically to each node in the cluster. This represents the hostname of the node which is a unique identifier in the cluster</p><p>We can use this label along with 𝒏𝒐𝒅𝒆𝑺𝒆𝒍𝒆𝒄𝒕𝒐𝒓 to schedule pods on particular required node.</p><p>𝙣𝙤𝙙𝙚𝙎𝙚𝙡𝙚𝙘𝙩𝙤𝙧:<br> 𝙠𝙪𝙗𝙚𝙧𝙣𝙚𝙩𝙚𝙨.𝙞𝙤/𝙝𝙤𝙨𝙩𝙣𝙖𝙢𝙚: “𝙣𝙤𝙙𝙚-𝙣𝙖𝙢𝙚”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*zcSO24AVvgnlugxHoY_7yg.png" /><figcaption>Deployment NodeSelector</figcaption></figure><h3>𝟵. ⌨️ 𝗦𝗽𝗹𝗶𝘁 𝘀𝗶𝗻𝗴𝗹𝗲 𝘁𝗲𝗿𝗺𝗶𝗻𝗮𝗹 𝘁𝗼 𝗺𝘂𝗹𝘁𝗶𝗽𝗹𝗲 𝗼𝗻𝗲𝘀 ⌨️</h3><p>🔹 𝗖𝗼𝗺𝗺𝗮𝗻𝗱: tmux <strong>(Terminal Multiplexer)</strong></p><p><em>This document is a growing document and VishDevOpsMiniBytes will be added on regular basis. Do follow me for more such content related to DevOps world. Thanks.</em></p><p><em>Cheers, Vish. Happy Learning!!</em></p><p><em>LinkedIn Profile: </em><a href="https://www.linkedin.com/in/vishweshwaran-mj/">https://www.linkedin.com/in/vishweshwaran-mj/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10f2df902b04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ECS Service & Task Creation — EC2 Launch Type]]></title>
            <link>https://medium.com/@mj.vishweshwaran/ecs-service-task-creation-ec2-launch-type-8e849c362e5f?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e849c362e5f</guid>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[elastic-container-service]]></category>
            <category><![CDATA[auto-scaling-groups]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Thu, 15 Aug 2024 20:48:50 GMT</pubDate>
            <atom:updated>2024-08-15T20:50:14.135Z</atom:updated>
            <content:encoded><![CDATA[<h3>ECS Service &amp; Task Creation — EC2 Launch Type</h3><p>This blog will give you the steps with screenshots to create a the <strong>ECS Service &amp; Task </strong>for an <strong>EC2 launch type</strong>. To know more about creation of a cluster you can refer to my first blog <a href="https://medium.com/@mj.vishweshwaran/ecs-cluster-creation-ec2-launch-type-bb4aa868636d">here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*kIF7TnBz2W9sHoaN.png" /><figcaption>AWS ECS Service</figcaption></figure><h3>Prerequistes:</h3><ul><li>ECS Cluster Creation</li><li>IAM Role</li><li>Task Definitions</li></ul><h3><strong>ECS Cluster Creation:</strong></h3><ul><li>Please refer to my previous blog where I have written steps on the <strong>ECS Cluster </strong>creation. Refer <a href="https://medium.com/@mj.vishweshwaran/ecs-cluster-creation-ec2-launch-type-bb4aa868636d">here</a> for the same</li></ul><h3>IAM Role:</h3><ul><li>Create this IAM role which will be required while creating the <strong>Task Definition</strong></li><li>This is required to run ECS taskson the ECS cluster</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K-A5mtXDFciaCpGrXodQlA.png" /></figure><h3><strong>Task Definitions:</strong></h3><ul><li>In the ECS console, from the left hand side create a <strong>Task Definition </strong>to use for creating the service</li><li>Select <strong>Amazon EC2 Instances</strong> for the infrasturcture requirements</li><li>Select <strong>Network mode </strong>to be <strong>bridge. </strong>This is required to create containers in bridge mode inside the EC2 instances</li><li>Input the <strong>CPU </strong>and <strong>Memory </strong>to <strong>0.1 vCPU</strong> and <strong>0.2 GB</strong> since I have used <strong>t2.micro</strong> in the launch template for the EC2 instances to keep the containers up and running</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a78RAtAGAUHLw5rACL3-eQ.png" /><figcaption>Task Def</figcaption></figure><ul><li>Select the <strong>Task Execution Role</strong> to the role that we created above ie <strong>ec2TaskExecutionRole</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jH_WpMhJOFAT1Pve9QNdyw.png" /><figcaption>Task Def</figcaption></figure><ul><li>Give the container details with the image name, image and the port details</li><li>Give <strong>Host Port to 0 </strong>since ECS will dynamically allocate the ports</li><li>Leave all the rest as it is and clic on <strong>Create</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKX4dYY7j3drInl0GtMJeQ.png" /><figcaption>Image Details</figcaption></figure><ul><li>Task Definition is created</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMDx_vZR-rvdmLJ1xa79YQ.png" /><figcaption>Created TD</figcaption></figure><h3><strong>Service Creation:</strong></h3><ul><li>In the Cluster created, on the <strong>Services </strong>section click on <strong>Create</strong></li><li>Select EC2 Launch Type as the Compute Configuration</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZT5DplgyWnmuY_wk1xxaLA.png" /><figcaption>Serv Creation</figcaption></figure><ul><li>In the deployment configuration, select the task definition to be used for the service and input the service name with the desired tasks</li><li>Desired tasks help in running the desired number of containers in the ECS cluster on the bootstarped EC2 instances launched by the ASG</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LCn1MV6FBY3SAjEGThQNCg.png" /><figcaption>Deployment Config</figcaption></figure><ul><li>Configure the already created Load Balancer to use the same.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RVgP7BUlZHmohBAxOf7UmA.png" /><figcaption>LB</figcaption></figure><ul><li>Rest leave everything to its defaults and click on <strong>Create</strong></li><li>Nginx Service got created</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ixtQgKGgsO2d6335cR3I2A.png" /><figcaption>Nginx serv</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X1J8Lw72uQAQjbnpj4NtWA.png" /><figcaption>Status</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s8EExfxtmfeU8ytLmuyb-Q.png" /><figcaption>Nginx Serv</figcaption></figure><ul><li>Get the Load Balancer URL and try to hit and you should be able to connect to the nginx containers</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pXs9wtJJaiLmB3AmBOw05g.png" /><figcaption>LB URL</figcaption></figure><ul><li>Container verified</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vqPk_05m-2LHrUKA_Xv6Lw.png" /><figcaption>LB Hit</figcaption></figure><ul><li>ECS and its service with EC2 Launch Type is working as expected</li></ul><h3>Debugging:</h3><ul><li>If the contianers are not getting registered to the ECS cluster, navigate to the EC2 instance created by the ASG and see if the ECS agent is running of not.</li><li>See if the cluster name is set appropriately that we defined the the user data of the launch template. Command — <strong>cat /etc/ecs/ecs.config. </strong>This should return the cluster name created</li><li>If running, check the ECS logs. Command — <strong>cat /var/log/ecs/ecs-agent.log. </strong>This can give info for any errors and fix accordingly.</li><li>Verify the service events to get insights whats happening in the cluster</li><li>Verify for any insufficient memory issues with respect to the configured cpu and memory in the task definition</li></ul><p>Thats it, Happy learning!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e849c362e5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ECS Cluster Creation — EC2 Launch Type]]></title>
            <link>https://medium.com/@mj.vishweshwaran/ecs-cluster-creation-ec2-launch-type-bb4aa868636d?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb4aa868636d</guid>
            <category><![CDATA[ec]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[auto-scaling-groups]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Tue, 13 Aug 2024 20:03:56 GMT</pubDate>
            <atom:updated>2024-08-15T18:49:44.815Z</atom:updated>
            <content:encoded><![CDATA[<h3>ECS Cluster Creation — EC2 Launch Type</h3><p>This blog will give you the steps with screenshots to create a the <strong>ECS Cluster</strong> for an <strong>EC2 launch type</strong>.</p><p>I will also cover the ECS Services and Tasks in the next blogs. Happy Learning !!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*Z8a2fOXp-URYAbJg.png" /><figcaption>AWS ECS</figcaption></figure><h3>Prerequistes:</h3><ul><li>IAM Roles</li><li>Auto Scaling Group (ASG)</li><li>Load Balancer (Application Load Balancer)</li><li>Security Groups</li><li>SSH Keys</li></ul><h3><strong>IAM Roles</strong></h3><ul><li>Create this IAM role to attach to the EC2 instance which will be needed during the launch type creation</li><li>This is required for EC2 to communicate with the ECS cluster</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CFukeAX3XhjpB_LSlQqPng.png" /><figcaption>EC2 Role Creation</figcaption></figure><h3><strong>Auto Scale Group Creation:</strong></h3><ul><li>Create <strong>ASG </strong>with <strong>mininum</strong>, <strong>desired</strong> and <strong>maximum </strong>capacity. Attach it to the created A<strong>pplication Load Balancer</strong>.</li><li>In the launch template use the below <strong>AMI (Amazon Machine Image) </strong>as docker is installed and runs an ecs agent container. Use <strong>AMI ID — ami-02da1a19f6ce5e079.</strong></li><li>The need for the ecs agent is to register the EC2 instance to our desired cluster</li><li><strong><em>Note:</em></strong><em> Use the above AMI ID mentioned else the containers will not be registered to the ECS Cluster</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0E8F5FCAZ-Zd5kMANIgGdg.png" /><figcaption>AMI Selection</figcaption></figure><ul><li>Add the below lines of code to the user data script in the launch template. Replace with your cluster name as needed</li></ul><pre>#!/bin/bash<br>echo ECS_CLUSTER=Vish_ECS_Medium_Cluster &gt;&gt; /etc/ecs/ecs.config</pre><ul><li>The need for the user data is to tell the EC2 instance to attach to the container instances of the cluster when the instance is spinned up by the ASG.</li></ul><h3><strong>Cluster Configuration Steps:</strong></h3><ul><li>Navigate <strong>Elastic Container Service </strong>from AWS Console</li><li>Click on <strong>Create Cluster </strong>button on the right hand top</li><li>In the <strong>Cluster Configuration</strong>, input the name of the cluster, check the <strong>EC2 launch type </strong>and select the <strong>ASG </strong>created</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mcCxKcqytXlYrjRmpz1V4Q.png" /><figcaption>Cluster Details Inputs</figcaption></figure><ul><li>Click on <strong>Create Cluster </strong>buttom at the bottom and wait for sometime for the cluster to be create, status can be verified in the CloudFormation.</li><li><strong><em>Note:</em></strong> If the creation of the cluster fails retry the CloudFormation stack and you should be successful this time. At this point a IAM role will be created named <strong>AWSServiceRoleForECS</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eEYBlBcvXm6l8O6R41uMTQ.png" /><figcaption>CFT Stack result</figcaption></figure><ul><li>Cluster created successfully after retry and the capacity provider is the ASG that we created.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3JDLOvQhXtOBJvcXgLRkPA.png" /><figcaption>Cluster Created</figcaption></figure><ul><li>The container instances as well got registered successfully to the ECS cluster created. This can be verified for the container instances</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuMsQW-87_J_onPU_G5ehQ.png" /><figcaption>Container Instance of ECS</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2YdT5UvLx4utNX0j7I744A.png" /><figcaption>EC2 instances created by ASG</figcaption></figure><h3>Debugging:</h3><ul><li>If the contianers are not getting registered to the ECS cluster, navigate to the EC2 instance created by the ASG and see if the ECS agent is running of not.</li><li>See if the cluster name is set appropriately that we defined the the user data of the launch template. Command — <strong>cat /etc/ecs/ecs.config. </strong>This should return the cluster name created</li><li>If running, check the ECS logs. Command — <strong>cat /var/log/ecs/ecs-agent.log. </strong>This can give info for any errors and fix accordingly.</li></ul><p>Now we can be ready to launch the services and use the cluster which we can see it in the next blog.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb4aa868636d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shell Scripting made Easy!!]]></title>
            <link>https://medium.com/@mj.vishweshwaran/shell-scripting-made-easy-856d3650f806?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/856d3650f806</guid>
            <category><![CDATA[shell-script]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[shell]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 09:03:55 GMT</pubDate>
            <atom:updated>2025-02-12T12:50:06.559Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*Sf_eEMP7ZmZyhq2jssdyBg.png" /></figure><p>In this article, I have covered the basics and the syntaxes that will be required for our shell scripting journey in DevOps which you can learn easily without the need of you practicing it. So let’s go!!</p><h3>Shell Scripting</h3><p>Shell scripting is a <strong>scripting language</strong> that runs on top of a <strong>shell environment</strong> which is used to perform automation for <strong>repetitive tasks</strong>, <strong>manage system configurations</strong>, and <strong>execute a series of commands</strong> by writing it in a script and running it. Some of the requirements where shell script will help us is system administration, software installations, file manipulations, etc.</p><p>The basic syntax of Shell Script is below and the filename ends with .sh file extension.</p><pre>#!/bin/bash<br><br># variable declaration / series of commands / functions / functions calls etc</pre><h3>Shebang</h3><p>The first line of a shell script is always a <strong>shebang</strong> usually the bash #!/bin/bash which specifies the <strong>interpreter</strong> to execute the script. When the script is executed the <strong>kernel</strong> reads the shebang line and uses that interpreter to execute that script.</p><ul><li>echo $SHELL - displays the current shell type you are working on.</li><li>cat /etc/shells - displays the available shells of that machine.</li></ul><pre>echo &quot;The first line in this script above is the &#39;shebang&#39;&quot;</pre><blockquote><strong><em>Note:</em></strong><em> Basically, </em><em>#!/bin/bash is the superset of </em><em>#!/bin/sh (shell) so in your scripts always incorporate the use of the bash shebang as it is universally used and I have used the same to explain the syntaxes.</em></blockquote><h3>Steps to run a Shell Script</h3><p>To run a shell script we need to follow the below two steps:</p><ul><li>make the script executable by giving execute permission chmod u+x &lt;scriptFile&gt;</li><li>./&lt;fileName&gt; to run the shell script from the terminal.</li></ul><p>Now let’s learn the concepts available in Shell Scripting. Boom!!</p><h3>Reading Input from User</h3><p>The read command helps in <strong>reading</strong> the user input (i.e. line of text) from the <strong>standard input</strong> stdin.</p><pre>#!/bin/bash<br><br># reads input from the user and puts it in the username variable<br>echo &quot;Enter Username: &quot;<br>read username<br>echo $username<br><br># displays the prompt message<br># -p stand for prompt<br># reads input from the user and puts it in the newusername variable<br>read -p &quot;Enter the new username: &quot; newusername<br>echo $newusername<br><br># reads input from the user &amp; hides the text from echoing in the terminal<br># -s stands for silent<br>read -sp &quot;Enter Password: &quot; password<br>echo &quot;&quot;<br>echo $password</pre><p>if you don’t wish to specify the variable name for the read we can use $REPLY to echo the value</p><pre>#!/bin/bash<br><br>echo &quot;Enter the username: &quot;<br>read<br>echo &quot;Read without variable name assignment: &quot;$REPLY</pre><h3>Command Substitution</h3><p><strong>Command substitution</strong> enables the output of the command to be substituted as a value to the variable. It can be done in two ways:</p><ol><li>Using backticks (`)</li><li>Using the dollar sign ($)</li></ol><pre>#!/bin/bash<br><br>echo &quot;Method 1 - using backticks&quot;<br>working_dir=`pwd`<br>echo $working_dir<br><br>echo &quot;Method 2 - using $ sign&quot;<br>working_dir=$(pwd)<br>echo $working_dir</pre><h3>Argument Passing</h3><p>We can pass arguments that can be used inside the scripts when it is executed. Those arguments can be accessed by the script using special variables like $1 $2 $3 etc.</p><ul><li>$0 - returns the file name of the shell script.</li><li>$@ - returns all arguments passed from cli.</li><li>$# - returns the no of arguments passed from cli.</li></ul><p>Let’s say we have a script file named argument_passing.sh and let&#39;s pass 2 arguments to it.</p><pre>argument_passing.sh &quot;Vish&quot; &quot;DevOps Engineer&quot;</pre><pre>#!/bin/bash<br><br># gives the filename of the script itself<br>echo &quot;FileName Argument: &quot;$0 # argument_passing.sh<br><br># gives the first argument passed<br>echo &quot;First Argument: &quot;$1 # Vish<br><br># gives the second argument passed<br>echo &quot;Second Argument: &quot;$2 # DevOps Engineer<br><br># displays all arguments passed<br>echo &quot;All Arguments: &quot;$@ # Vish DevOps Engineer<br><br># displays number of arguments passed<br>echo &quot;No of Arguments: &quot;$# # 2</pre><h3>Arithmetic Operations</h3><p>In shell scripting, to perform arithmetic operations we need to use <strong>double parenthesis</strong> (( )) which is used for <strong>arithmetic expansion</strong> on integers. The <strong>double parenthesis</strong> (( )) is also called a unary operator.</p><pre>#!/bin/bash<br><br>n1=10<br>n2=5<br><br>echo &quot;Sum of two numbers: &quot;$(($n1+$n2)) # Addition<br>echo &quot;Sub of two numbers: &quot;$(($n1-$n2)) # Substraction<br>echo &quot;Mul of two numbers: &quot;$(($n1*$n2)) # Mulitplication<br>echo &quot;Div of two numbers: &quot;$(($n1/$n2)) # Division<br>echo &quot;Modulus of two numbers: &quot;$(($n1%$n2)) # Modulus</pre><p>We can also use test command to work with arithmetic and string operations which provide more flexibility along with unary operators.</p><h3>Conditionals</h3><p>In shell scripting, [[ ]] or test command can be used for evaluating conditional expressions. Below are certain unary operators that can be used for testing the conditions</p><h3>Conditions</h3><ul><li>[[ -z STRING ]] - Empty string</li><li>[[ -n STRING ]] - Not empty string</li><li>[[ STRING == STRING ]] - Equal</li><li>[[ STRING != STRING ]] - Not equal</li><li>[[ NUM -eq NUM ]] - Equal</li><li>[[ NUM -ne NUM ]] - Not equal</li><li>[[ NUM -lt NUM ]] - Less than</li><li>[[ NUM -le NUM ]] - Less than or equal</li><li>[[ NUM -gt NUM ]] - Greater than</li><li>[[ NUM -ge NUM ]] - Greater than or equal</li><li>[[ ! EXPR ]] - Not</li><li>[[ X &amp;&amp; Y ]] - And</li><li>[[ X || Y ]] - Or</li></ul><h3>File Conditions</h3><ul><li>[[ -e FILE ]] - Exists</li><li>[[ -r FILE ]] - Readable</li><li>[[ -h FILE ]] - Symbolic link</li><li>[[ -d FILE ]] - Directory</li><li>[[ -w FILE ]] - Writable file</li><li>[[ -s FILE ]] - File size is &gt; 0 bytes</li><li>[[ -f FILE ]] - File</li><li>[[ -x FILE ]] - Executable file</li></ul><pre>#!/bin/bash<br><br>a=10<br>b=20<br><br># less than using square brackets<br>if [[ $a -lt $b ]]<br>then<br>   echo &quot;a is less than b&quot;<br>else<br>   echo &quot;a is not less than b&quot;<br>fi<br><br># less than using test command<br>if test &quot;$a&quot; -lt &quot;$b&quot;<br>then<br>   echo &quot;a is less than b&quot;<br>else<br>   echo &quot;a is not less than b&quot;<br>fi</pre><h3>Loops</h3><h3>if else</h3><p>if else loop is a conditional statement that allows executing different commands based on the condition true/false. Here square brackets [[ ]] are used to evaluate a condition.</p><p>Let’s create a file named ifelse.sh and input the below code</p><pre>#!/bin/bash<br><br># -e stands for exists<br>if [[ -e ./ifelse.sh ]]<br>then<br>  echo &quot;File exists&quot;<br>else<br>  echo &quot;File does not exist&quot;<br>fi</pre><h3>elif</h3><p>elif is a combination of both else and if. It is used to create multiple conditional statements and it must be always used in conjunction with if else statement</p><pre>#!/bin/bash<br><br>read -p &quot;Enter the number between 1 to 3: &quot; number<br><br>if [[ $number -eq 1 ]]<br>then<br>        echo &quot;The number entered is 1&quot;<br>elif [[ $number -eq 2 ]]<br>then<br>        echo &quot;The number entered is 2&quot;<br>elif [[ $number -eq 3 ]]<br>then<br>        echo &quot;The number entered is 3&quot;<br>else<br>        echo &quot;Invalid Number&quot;<br>fi</pre><h3>for</h3><p>The for loop is used to iterate over a sequence of values and below is the syntax</p><pre>#!/bin/bash<br><br>for i in {1..10}<br>do<br>  echo &quot;Val: $i&quot;<br>done<br><br># C style/Old Style of for loop<br>for((i=0;i&lt;=10;i++))<br>do<br>  echo &quot;Val: $i&quot;<br>done</pre><h3>while</h3><p>The while loop is used to execute a set of commands repeatedly as long as a certain condition is true. The loop continues until the condition is false.</p><pre>#!/bin/bash<br><br>count=0<br><br>while [ $count -lt 5 ]<br>do<br>  echo $count<br>  count=$(($count+1))<br>done</pre><h3>until</h3><p>The until loop in shell scripting is used to execute a block of code repeatedly until a certain condition is met.</p><pre>#!/bin/bash<br><br>count=1<br><br>until [ $count -gt 5 ]<br>do<br>    echo $count<br>    count=$(($count+1))<br>done</pre><h3>Arrays</h3><p>An array is a variable that can hold multiple values under a single name</p><ul><li>${arrayVarName[@]} - displays all the values of the array.</li><li>${#arrayVarName[@]} - displays the lenght of the array.</li><li>${arrayVarName[0]} - displays the first element of the array</li><li>${arrayVarName[-1]} - displays the last element of the array</li><li>unset arrayVarName[2] - deletes the 2 element</li></ul><pre>#!/bin/bash<br><br># Declare an array of fruits<br>fruits=(&quot;apple&quot; &quot;banana&quot; &quot;orange&quot; &quot;guava&quot;)<br><br># Print the entire array<br>echo &quot;All fruits using @ symbol: ${fruits[@]}&quot;<br>echo &quot;All fruits using * symbol: ${fruits[*]}&quot;<br><br># Print the third element of the array<br>echo &quot;Third fruit: ${fruits[2]}&quot;<br><br># Print the length of the array<br>echo &quot;Number of fruits: ${#fruits[@]}&quot;</pre><h3>Break Statement</h3><p>break is a keyword. It is a control statement that is used to exit out of a loop ( for, while, or until) when a certain condition is met. It means that the control of the program is transferred outside the loop and resumes with the next set of lines in the script</p><pre>#!/bin/bash<br><br>count=1<br><br>while true<br>do<br>  echo &quot;Count is $count&quot;<br>  count=$(($count+1))<br>  if [ $count -gt 5 ]; then<br>    echo &quot;Break statement reached&quot;<br>    break<br>  fi<br>done</pre><h3>Continue statement</h3><p>continue is a keyword that is used inside loops (such as for, while, and until) to skip the current iteration of the loop and move on to the next iteration. It means that when the continue keyword is encountered while executing a loop the next set of lines in that loop will not be executed and moves to the next iteration.</p><pre>#!/bin/bash<br><br>for i in {1..10}<br>do<br>  if [ $i -eq 5 ]<br>  then<br>    continue<br>  fi<br>  echo $i<br>done</pre><h3>Functions</h3><p>Functions are a block of code which can be used again and again for doing a specific task thus providing code reusability.</p><h3>Normal Function</h3><pre>#!/bin/bash<br><br>sum(){<br>        echo &quot;The numbers are: $n1 $n2&quot;<br>        sum_val=$(($n1+$n2))<br>        echo &quot;Sum: $sum_val&quot;<br>}<br><br>n1=$1<br>n2=$2<br>sum</pre><h3>Function with return values</h3><p>To access the return value of the function we need to use $? to access that value</p><pre>#!/bin/bash<br><br>sum(){<br>        echo &quot;The numbers are: $n1 $n2&quot;<br>        sum_val=$(($n1+$n2))<br>        echo &quot;Sum: $sum_val&quot;<br>        return $sum_val<br>}<br><br>n1=$1<br>n2=$2<br>sum<br><br>echo &quot;Retuned value from function is $?&quot;</pre><h3>Variables</h3><p>The variable is a <strong>placeholder</strong> for saving a value which can be later accessed using that name. There are two types of variable</p><ul><li>Global - Variable defined outside a function which can be accessed throughout the script</li><li>Local - Variable defined inside a function and can be accessed only within it</li></ul><pre>#!/bin/bash<br><br># x &amp; y are global variables<br>x=10<br>y=20<br><br>sum(){<br>        sum=$(($x+$y))<br>        echo &quot;Global Variable Addition: $sum&quot;<br>}<br><br>sum<br><br>sub(){<br>        # a &amp; b are local variables<br>        local a=20<br>        local b=10<br>        local sub=$(($a-$b))<br>        echo &quot;Local Variable Substraction: $sub&quot;<br>}<br><br>sub</pre><h3>Dictionaries</h3><p>In shell scripting, dictionaries are implemented using associative arrays. An associative array is an array that uses a string as an index instead of an integer</p><pre>#!/bin/bash<br><br># declare a associative array<br>declare -A colours<br><br># add key value pairs<br>colours[&#39;apple&#39;]=red<br>colours[&#39;banana&#39;]=yellow<br>colours[&#39;orange&#39;]=orange<br>colours[&#39;guava&#39;]=green<br>colours[&#39;cherry&#39;]=red<br><br>echo &quot;Size of dict: ${#colours[@]}&quot;<br>echo &quot;Color of apple: ${colours[&#39;apple&#39;]}&quot;<br>echo &quot;All dict keys: ${!colours[@]}&quot;<br>echo &quot;All dict values: ${colours[@]}&quot;<br><br># Delete cherry key<br>unset colours[&#39;cherry&#39;]<br>echo &quot;New dict: ${colours[@]}&quot;<br><br># iterate over keys<br>for key in ${!colours[@]}<br>do<br>        echo $key<br>done<br><br># iterate over values<br>for value in ${colours[@]}<br>do<br>        echo $value<br>done</pre><h3>Set Options — The Saviour</h3><p>The set command allows us to <strong>change or display</strong> the values of <strong>shell options</strong>. We can use it to set options to turn certain shell options on &amp; off.</p><p>set -x - it&#39;s like a <strong>debug</strong> mode. whatever commands are being performed will be printed first then the output of the command will be displayed</p><p>set -e - <strong>immediately exits</strong> the script when a non zero exit code is occurred. But when we have commands with pipe say sdfdsf | echo &#39;vish&#39;. Here since the last command executed in the line is echo which returns zero exit code so the entire line of command is considered success but the previous command sdsds will return non zero which is wrong. To catch this we can use the below set option with pipefail.</p><p>set -o pipefail - To overcome the above pipe command error we can use pipefail option which will catch and stop the script immediately. So here each command should return a zero exit code. If not the script will fail.</p><h3>Extras</h3><p>shift — removes first positional parameter and shifts all the other parameters one position to the left</p><p>So that’s it about Shell scripting. With the above basic syntaxes understanding now we are in a position to develop complex shell scripts. Hope I was able to make a good understanding of the concept. Thank you.</p><p>You can refer to all the shell script files in my GitHub repo: <a href="https://github.com/devopsvish/shell-scripting">https://github.com/devopsvish/shell-scripting</a></p><blockquote><em>Please let me know in the comment section about any corrections/mistakes, am open to improvements and suggestions.</em></blockquote><blockquote><em>Please do follow me for more such content related to DevOps world</em></blockquote><blockquote><em>Cheers, Vish. Happy Learning!!!</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=856d3650f806" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom Module Ansible]]></title>
            <link>https://medium.com/@mj.vishweshwaran/custom-module-ansible-fcdeb9b48a0c?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcdeb9b48a0c</guid>
            <category><![CDATA[infrastructure-automation]]></category>
            <category><![CDATA[ansible-modules]]></category>
            <category><![CDATA[custom-module]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[configuration-management]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Sun, 10 Sep 2023 11:30:37 GMT</pubDate>
            <atom:updated>2023-09-10T11:34:15.788Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ansible Custom Modules</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lH_bj29wMhbMj2NsDUW9xA.png" /></figure><p>In this article, I have covered how to write/understand custom modules that can be used in our Ansible Playbooks for performing certain tasks. This blog can be a kick-start for you to understand and help write your custom modules.</p><h3>What is Custom Module in Ansible</h3><p>Ansible is a powerful <strong>Configuration Management tool</strong> that has many built-in modules to configure target systems but there would be cases where we would need to perform tasks that are not provided by Ansible. So we have the flexibility of writing our custom modules and using them. These modules can be written in any language of our choice and I have preferred writing here with the help of <strong>Python</strong>.</p><h3>Folder Structure</h3><p>Here is the link to the project which I have pushed to GitHub — <a href="https://github.com/devopsvish/ansible-custom-module">https://github.com/devopsvish/ansible-custom-module</a></p><p>Let me go step by step so you can understand the concept with ease. I have also dockerized this project so you can quickly try it out on your machine.</p><p>I have followed the below project structure and let’s go thru it real quick</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/0*Bmad4CZW3jM88i4j" /></figure><p>inventory.ini - contains the lists of our target hosts. In my case am targeting my local host.</p><p>vish_module.py - this is a custom module that I have written to walkthru the blog which outputs us a small employee information</p><p>employee_info.yml - the playbook which uses the custom module to give us the result</p><p>vishtest_playbook.yml - a test playbook to check if ansible is working on our local machine</p><p>ansible.cfg - this is the ansible configuration file where am mentioning where the custom module resides</p><h3>Custom Module Explanation</h3><p>Usually, Custom modules are placed inside the library folder and the same path is configured in the ansible.cfg file to pick the modules from the right location during our playbook execution.</p><p>Here is the full code of the custom module and I will have it explained line by line.</p><pre>from ansible.module_utils.basic import AnsibleModule<br><br>def main():<br>    parameters = {<br>        &#39;name&#39;: {&quot;required&quot;: True, &quot;type&quot;: &#39;str&#39;},<br>        &#39;designation&#39;: {&quot;required&quot;: True, &quot;type&quot;: &#39;str&#39;},<br>        &#39;skills&#39;: {&quot;required&quot;: True, &quot;type&quot;: &#39;str&#39;},<br>        &#39;location&#39;: {&quot;required&quot;: False, &quot;type&quot;: &#39;str&#39;}<br>    }<br><br>    module = AnsibleModule(argument_spec=parameters)<br><br>    name = module.params[&#39;name&#39;]<br>    designation = module.params[&#39;designation&#39;]<br>    skills = module.params[&#39;skills&#39;]<br>    location = module.params[&#39;location&#39;]<br><br>    output = {<br>        &#39;name&#39;: name,<br>        &#39;designation&#39;: designation,<br>        &#39;skills&#39;: skills,<br>        &#39;location&#39;: location,<br>        &#39;message&#39;: f&quot;{name} is a {designation} with {skills} from {location}&quot;,<br>        &#39;location_type&#39;: f&quot;{type(location)}&quot;<br>    }<br><br>    module.exit_json(changed=False, **output)<br><br>if __name__ == &#39;__main__&#39;:<br>    main()</pre><h3>1. Import the module</h3><pre>from ansible.module_utils.basic import AnsibleModule</pre><p>This line imports the AnsibleModule class from the ansible.module_utils.basic module which can be used to interact with Ansible.</p><h3>2. Main function</h3><pre>def main():<br> # logic of the code goes here</pre><p>The logic of the custom module goes here which can be used on performing tasks on target systems</p><h3>3. Argument Specification</h3><pre>parameters = {<br>   &#39;name&#39;: {&quot;required&quot;: True, &quot;type&quot;: &#39;str&#39;},<br>   &#39;designation&#39;: {&quot;required&quot;: True, &quot;type&quot;: &#39;str&#39;},<br>   &#39;skills&#39;: {&quot;required&quot;: True, &quot;type&quot;: &#39;str&#39;},<br>   &#39;location&#39;: {&quot;required&quot;: False, &quot;type&quot;: &#39;str&#39;}<br>}</pre><p>The parameters dictionary defines the expected arguments for the module. Each argument is specified with its name, required status and datatype.</p><ul><li>Let me take designation argument for example</li><li>Name of the argument: designation</li><li>Required status of the argument: True (accepts a boolean)</li><li>The datatype of the argument: str (accepts str, bool, int, list, dict, float)</li></ul><h3>4. Instantiate AnsibleModule</h3><pre>module = AnsibleModule(argument_spec=parameters)</pre><p>The AnsibleModule class is instantiated with the argument specification defined earlier and this allows the module to receive and validate the arguments passed by Ansible</p><h3>5. Retrieve the values of the arguments</h3><pre>name = module.params[&#39;name&#39;]<br>designation = module.params[&#39;designation&#39;]<br>skills = module.params[&#39;skills&#39;]<br>location = module.params[&#39;location&#39;]</pre><p>The values of the arguments are retrieved with the help of params attribute of the module object</p><h3>6. Output dictionary</h3><pre>output = {<br>    &#39;name&#39;: name,<br>    &#39;designation&#39;: designation,<br>    &#39;skills&#39;: skills,<br>    &#39;location&#39;: location,<br>    &#39;message&#39;: f&quot;{name} is a {designation} with {skills} from {location}&quot;,<br>}</pre><p>Here an output dictionary is created with the desired key-value pair and the values are obtained from the arguments passed to the module. This is the dictionary am going to output during our playbook execution</p><h3>7. Exit the Module</h3><pre>module.exit_json(changed=False, **output)</pre><ul><li>The module execution is completed by calling the exit_json method</li><li>The changed parameter is set to false as the module does not make any change to the target system. If it changes anything on the target system we can set this to True and the same will be reflected in the Ansible playbook result execution</li><li>The result of the module is provided as a keyword argument using the **output syntax</li></ul><h3>Playbook Execution</h3><pre>- name: Execute vish module for testing<br>  hosts: vish-localhost<br>  become: true<br>  gather_facts: true<br>  tasks:<br>    - name: Get the Employee info<br>      vish_module:<br>        name: &quot;Vish&quot;<br>        designation: &quot;DevOps Engineer&quot;<br>        skills: &quot;Linux, Docker, etyc&quot;<br>        location: &quot;Bangalore&quot;<br>      register: output<br>    - name: Show the employee info output<br>      debug:<br>        var: output</pre><ul><li>Inside the playbook of the first task, the module written can be called just by its name. Here the name of the module is vish_module which I have mentioned in Get the Employee info task.</li><li>Inside the module, I have passed the arguments as required by the module where the required status is mentioned in the module</li><li>Am using the register keyword to store the output</li><li>In the second task, am using the debug module to output values for us to verify.</li></ul><h3>Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zqDYk-hhxpT_XLp6" /></figure><p>so by writing custom modules the similar way we can make changes to the target system as per our requirements.</p><p>Thats it!! It’s very easy, right? Try writing your own modules and start testing it. Happy Learning.</p><blockquote><em>Please let me know in the comment section about any corrections/mistakes, am open to improvements and suggestions.</em></blockquote><blockquote><em>Please do follow me for more such content related to DevOps world</em></blockquote><blockquote><em>Cheers, Vish. Happy Learning!!!</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcdeb9b48a0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Sed, Awk and Find Commands]]></title>
            <link>https://medium.com/@mj.vishweshwaran/vish-demystifying-sed-awk-and-find-commands-332c63d5b641?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/332c63d5b641</guid>
            <category><![CDATA[de]]></category>
            <category><![CDATA[awk]]></category>
            <category><![CDATA[locate]]></category>
            <category><![CDATA[find]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 08:44:18 GMT</pubDate>
            <atom:updated>2025-01-21T16:39:28.409Z</atom:updated>
            <content:encoded><![CDATA[<h4>Mastering Sed, Awk, and Find Commands with Ease</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNStcBIFuDOHlj4jYecjZA.png" /></figure><p>In this article, we are going to look into the powerful commands for text processing and file manipulation with detailed syntax explanations to have a better understanding of the concept.</p><p>Without further ado let’s dive in and look at the commands sed, awk, find</p><h3>SED Command</h3><p>The sed command stands for Stream Editor which is one of the text processing tools used to perform various operations on text files like find &amp; replace (substitution), insertion &amp; deletion of lines.</p><p>The basic syntax of the sed command is</p><pre>sed [options] [command] [file]</pre><ul><li>options - specifies the behavior of the sed command</li><li>command - operation the sed command should perform</li><li>file - name of the file the sed command should operate on</li></ul><h3>Find and Replace (Substitution)</h3><h3>1. Replace the first occurrence of each line</h3><pre>sed &#39;s/&lt;old_text&gt;/&lt;new_text&gt;/&#39; &lt;fileName&gt;</pre><ul><li>s stands for substitute</li><li>/ is the delimiter. We can use other delimiters like ., space as well.</li><li>this replaces the first occurrence of the old text with new text in each line and displays the output on the screen leaving the original file unmodified</li></ul><h3>2. Replace all occurrences</h3><pre>sed &#39;s/&lt;old_text&gt;/&lt;new_text&gt;/g&#39; &lt;fileName&gt;</pre><ul><li>g stands for global replacement</li><li>this replaces all occurrences of the old text with new text in each line and displays the output on the screen leaving the original file unmodified</li></ul><h3>3. Replace all occurrences &amp; modify the original file</h3><pre>sed -i &#39;s/&lt;old_text&gt;/&lt;new_text&gt;/g&#39; &lt;fileName&gt;</pre><ul><li>i stands for in-place (edits the original file)</li><li>this replaces all occurrences of the old text with new text and updates the original file as well</li></ul><h3>Insertion</h3><h3>1. Insert text at a specific line number</h3><pre>sed &#39;&lt;lineNumber&gt; i\&lt;text&gt;&#39; &lt;fileName&gt;</pre><ul><li>i stands for insert</li><li>this inserts the text at the specific line number of the file mentioned and leaves the original file unaffected</li><li><strong><em>Example 1: </em></strong>sed &#39;2 i\Vish - DevOps Engineer&#39; samplefile.txt &gt; outputfile.txt - Inserts the text &quot;Vish - DevOps Engineer&quot; at the 2nd line of the file and writes it back to the output file</li></ul><h3>Deletion</h3><h3>1. Delete based on line number</h3><pre>sed &#39;&lt;lineNumber&gt;d&#39; &lt;fileName&gt;</pre><ul><li>d stands for delete</li><li>deletes the exact line number from the file and displays the output on the terminal</li><li><strong><em>Example 1:</em></strong> sed &#39;2d&#39; samplefile.txt - deletes the 2nd line of the file mentioned</li><li><strong><em>Example 2:</em></strong> sed &#39;2,5d&#39; samplefile.txt - deletes the range of lines from 2nd to 5th of the file mentioned</li></ul><h3>2. Delete based on text/regex</h3><pre>sed &#39;/&lt;text_or_regex&gt;/d&#39; &lt;fileName&gt;</pre><ul><li>deletes the exact line containing the text/regex of the file mentioned and displays the output on the terminal leaving the file unmodified</li><li><strong><em>Example 1:</em></strong> sed &#39;/DevOps/d&#39; samplefile.txt - delete the line containing &quot;DevOps&quot; and prints the other lines in the terminal leaving the file unmodified</li></ul><h3>Text Filtering</h3><h3>1. Print lines that match a text/pattern</h3><pre>sed -n &#39;/&lt;search_text&gt;/p&#39; &lt;file&gt;</pre><ul><li>p stands for print which is used to display the matches lines</li><li>n used to print only matched lines and suppresses non-matching lines</li><li><strong><em>Example 1: </em></strong>sed -n &#39;/docker/p&#39; samplefile.txt - displays only the lines in the terminal where the search text docker is present</li></ul><h3>2. Conditional replacement</h3><pre>sed &#39;/&lt;conditional_text&gt;/s/&lt;old_text&gt;/&lt;new_text&gt;/&#39; &lt;file&gt;</pre><ul><li>s stands for substitute</li><li>replaces the old text with the new text where the line contains the conditional text</li><li><strong><em>Example 1: </em></strong>sed &#39;/fruit/s/apple/orange/&#39; samplefile.txt - replaces the apple text with orange where the line contains only fruit text and displays the changes on the terminal</li><li><strong><em>Example 2:</em></strong> sed &#39;/^food/s/apple/orange/&#39; filename - replaces the apple text with orange where the line only starts with food and displays the changes on the terminal</li></ul><h3>AWK Command</h3><p>awk is another powerful text processing tool used to process and manipulate structured data such as log files and command outputs. It is used to print specific column values for us as required</p><p>The basic syntax of the awk command is</p><pre>awk &#39;pattern { action }&#39; &lt;file&gt;</pre><ul><li>pattern - specifies the pattern or condition that should match</li><li>action - specifies the action to be performed when the pattern is matched</li><li>file - name of the file the awk command should operate on</li></ul><h3>1. Print specific columns containing a text/pattern</h3><pre>awk &#39;/text_or_pattern/ { action }&#39; &lt;file&gt;</pre><ul><li>filters the lines based on the pattern or text on the file mentioned and does the appropriate action mentioned.</li><li><strong><em>Example 1: </em></strong>awk &#39;/TRACE/ { print $1, $5 } samplefile.txt&#39; - the command searches for lines in the file samplefile.txt that contain the word &quot;TRACE&quot; and when a match is found, the print statement displays the 1st &amp; 5th column on the terminal. Perfect use cases for awk command is for log file filtering.</li></ul><h3>2. Print specific columns with input from the command</h3><pre>&lt;linux_command&gt; | awk { print $columnNumber, $columnNumber }</pre><ul><li>the output of the Linux command is fed as the input to the awk command using the | pipe filter</li><li>here , is used as a separator where column data is printed with a space in the terminal</li><li><strong><em>Example 1: </em></strong>df -h | awk &#39;{ print $1, $4 }&#39; - prints the filesystem ($1) &amp; the total available space ($4)</li><li><strong><em>Example 2: </em></strong>ls -al | awk &#39;{ print $9 }&#39; - prints the filename of the directory ($9)</li><li><strong><em>Example 3: </em></strong>date | awk -F &quot; &quot; &#39;{ print $1, $2, $3, $5}&#39; - splits the command output with the help of delimiter and prints the specifed columns. -F stands for feild delimiter.</li></ul><h3>3. Print specific columns from a file</h3><pre>awk &#39;{ print $columnNumber, $columnNumber }&#39; &lt;file&gt;</pre><ul><li>displays the mentioned columns of the structured data file in the terminal</li><li><strong><em>Example 1: </em></strong>awk { print $2, $4 } samplefile.txt - displays the 2nd &amp; 4th column of the file</li></ul><blockquote>Note: Awk is a programming language by itself, allowing you to write more complex scripts for text-processing tasks.</blockquote><h3>Find Command</h3><p>find command is used to search for files and folders in a specific directory based on various criteria.</p><p>It can locate files based on names, types, sizes, permissions, timestamps and other attributes</p><p>The basic syntax of the find command is</p><pre>find &lt;target_directory_path&gt; -&lt;attribute&gt; &lt;fileName_or_directoryName&gt;</pre><h3>1. Find files by name</h3><pre>find &lt;target_directory_path&gt; -name &lt;fileName&gt;</pre><ul><li>searches for files with the name attribute in the target directory &amp; its subdirectories and displays the output in the terminal</li><li><strong><em>Example 1: </em></strong>find / -name samplefile.txt - searches for the samplefile.txt in the root directory (/ stands for root directory)</li></ul><h3>2. Find files by type</h3><pre>find &lt;target_directory_path&gt; -type f</pre><ul><li>f stands for file</li><li>locates regular files</li></ul><pre>find &lt;target_directory_path&gt; -type d</pre><ul><li>d stands for directory</li><li>locates directories</li></ul><pre>find &lt;target_directory_path&gt; -type l -name &quot;symbolic_link_name&quot;</pre><ul><li>l stands for symbolic link</li><li>locates the symbolic link with a specific name</li></ul><h3>3. Find files by size</h3><pre>find &lt;target_directory_path&gt; -size &lt;+/-size&gt;</pre><ul><li>searches for files based on size</li><li><strong><em>Example 1: </em></strong>find . -size +1G - searches for files which are greater than 1G (+ indicates larger/greater than)</li><li><strong><em>Example 2: </em></strong>find . -size -1G - searches for files which are lesser than 1G (- indicates smaller/lesser than)</li></ul><p>T — terabytes G — gigabytes, M — megabytes, k — kilobytes, c — bytes</p><h3>4. Find files by permissions</h3><pre>find &lt;target_directory_path&gt; -perm &lt;octalNumber&gt;</pre><ul><li>searches for files based on octal number permissions</li><li><strong><em>Example 1: </em></strong>find /home/ubuntu/vish -perm 744 - displays all files which are having permissions with 744 in the mentioned directory</li></ul><h3>5. Find files by specific user</h3><pre>find &lt;target_directory_path&gt; -user &lt;userName&gt;</pre><ul><li>searches and displays files whose owner is as mentioned by the user name</li><li><strong><em>Example 1: </em></strong>find /home/ubuntu/vish -user vish - displays all files which has the owner name vish inside the mentioned directory</li></ul><h3>Extras</h3><h3>Locate Command</h3><p>The locate command in Linux is used to quickly search for files and directories on the system based on their names. It relies on a pre-built database called the locatedb for faster searching</p><p>Initially perform updatedb to refresh the locatedb to have uptodate information</p><pre>locate &lt;fileName&gt;</pre><ul><li>displays the matching file name path in the terminal</li><li><strong><em>Example 1: </em></strong>locate samplefile.txt - locates &amp; displays the absolute path of samplefile.txt</li><li><strong><em>Example 2: </em></strong>locate &quot;*.txt&quot; - locates &amp; displays all files ending with .txt</li><li><strong><em>Example 3: </em></strong>locate -i samplefile.txt - case insensitive search and displays the absolute path of samplefile.txt (i - case insensitive)</li></ul><h3>Cut Command</h3><p>The cut command is used to extract sections from each line of files or input based delimiters</p><ul><li><strong><em>Example 1: </em></strong>cut -d &quot; &quot; -f 2,3 &lt;file&gt; - splits the file content by space and displays the feilds 2 &amp; 3. -d (delimiter), -f (feilds)</li></ul><p>Superb, you should be now proficient in sed, awk, find commands. Hope I was able to make a good understanding of the concept. Thank you.</p><p><em>This blog page covers most of the majorly used linux commands for DevOps Warriors and </em>is a growing document. Commands will be added as the days go and when I find some interesting commands on the same.</p><p><em>Do follow me for more such content related to DevOps world.</em></p><p><em>Cheers, Vish. Happy Learning!!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=332c63d5b641" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Intro to the World of DevOps]]></title>
            <link>https://medium.com/@mj.vishweshwaran/vish-an-intro-to-the-world-of-devops-6b06b22bad3e?source=rss-4846d44292d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b06b22bad3e</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Vishweshwaran M J]]></dc:creator>
            <pubDate>Thu, 10 Aug 2023 16:30:09 GMT</pubDate>
            <atom:updated>2023-08-10T16:30:09.366Z</atom:updated>
            <content:encoded><![CDATA[<h4>Quick guide to understand DevOps</h4><p>In this article, we will look into some basic details of what is DevOps, CICD and some frequently used terms related to DevOps.</p><p>Without further ado let’s dive in.</p><h3>What is DevOps?</h3><p>DevOps is a process/methodology which brings the <strong>Development</strong> <strong>(Dev)</strong> and <strong>Operations (Ops)</strong> teams together to collaborate and deliver high-quality software.</p><p>Here DevOps helps in improving the <strong>efficiency </strong>of application/product delivery by ensuring <strong>Automation, Quality, Continuous Testing and Continuous Monitoring</strong> are in place.</p><p>It also ensures there is no manual intervention and fastens up the delivery process thus enhancing quicker feedback for developers with the help of <strong>CICD (Continuous Integration and Continuous Delivery)</strong></p><p>Mainly, DevOps Engineers are responsible for automating and improving the efficiency of the <strong>Build, Testing and Deployment</strong> stages in the Software Development Life Cycle (SDLC)</p><h3>The DevOps buzz word — CICD</h3><p>When we say <strong>DevOps</strong>, one thing that always comes to IT Engineers’ mind is CICD — <strong>Continuous Integration, Continuous Delivery and Continuous Deployment</strong>. Let’s discuss the same briefly below</p><h3>Continiuos Integration (CI)</h3><p>When a developer commits (integrates) his code to the source code management system like Git, the CI tool automatically pulls the code and runs the build and unit tests. At the end of the integration artifacts are generated (say war file). This is called <strong>Continuous Integration.</strong></p><blockquote><strong><em>Some CI tools:</em></strong><em> Jenkins, CircleCI, GitLab and etc</em></blockquote><h3>Continuous Delivery (CD)</h3><p>Once the Continous Integration (CI) process is successfully completed we get artifacts. We deploy those artifacts onto the next available environment (say Dev) where performance and functional tests are carried out. Once the tests are successful we deploy the artifacts to the Production environment <strong>manually</strong>. This is called <strong>Continuous Delivery.</strong></p><h3>Continuous Deployment (CD)</h3><p>In Continuous Deployment, once the performance and functional test are successful the artifacts are automatically deployed onto the next available environment upto the Production environment without manual intervention. This is called <strong>Continous Deployment.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hTyRN-VwUwJ6bR04" /></figure><h3>Why DevOps is important?</h3><p>DevOps ensures the following and can be important</p><ul><li>Quicker feedback on the build to developers with the help of CI/CD</li><li>Faster software delivery and time to market</li><li>Improved communication between multiple teams</li><li>Increased software quality</li><li>Continuous Development, Integration, Testing, Deployment and Monitoring</li></ul><h3>Important Terms in DevOps</h3><h3>Cloud Computing</h3><p>Cloud Computing means delivery of the <strong>IT computing resources</strong> like <strong>servers, storage, databases, networks</strong>, etc over the internet or the cloud. These are remote resources available with the private Cloud providers which can be <strong>scaled </strong>easily ensuring <strong>high availability</strong> without the need for the physical infrastructure. This is like a service where you pay only for the resources you use which is cost friendly with no management and maintenance needed from us.</p><blockquote><strong><em>Some Cloud Providers:</em></strong><em> AWS, GCP, Azure, Alibaba, etc</em></blockquote><p><strong><em>High Availability:</em></strong> Let’s say one server goes down and if there are other working servers somewhere else for the same application, we can be served the content with the help of those other servers.</p><h3>Auto Scaling</h3><p>Scaling means the ability of the application/system to <strong>automatically increase/decrease</strong> the performance based on the processing needs thus providing <strong>high availability</strong>.</p><p>There are two types of scaling:</p><ul><li><strong>Vertical Scaling:</strong> Increasing the system resources like CPU, RAM, Storage, etc. Eg: AWS instance size t2.micro to t2.large.</li><li><strong>Horizontal Scaling:</strong> Increasing the number of instances. Eg: AWS Auto Scaling Groups.</li></ul><h3>Containerization</h3><p>Containerization is a process of <strong>packaging </strong>an application along with its dependencies into a <strong>single container image</strong>. The advantage of this image is it will run on all environments without any compatibility issues (i.e.) platform independent thus refraining the famous dialogue “<strong>It works on my machine</strong>”</p><p>Containers can also Scale out and Scale in automatically based on demand ensuring high availability of software.</p><p>Some Containerization Tools: Docker, Podman, Containerd, Kubernetes, etc.</p><h3>Version Control</h3><p>It is a system that <strong>tracks &amp; records</strong> the changes carried out on a file or set of files over time. It means that when a file is created and updated/modified several times it’s possible to go to a specific version of the file using its <strong>revision history</strong>. It also helps multiple people working on the same file simultaneously ensuring collaboration between people.</p><blockquote><strong>Some Version Control systems:</strong> Git, SVN, etc.</blockquote><h3>Monitoring</h3><p>It is a process of continuously <strong>monitoring </strong>the system or application to detect any issues or errors which can affect performance and security. The sources of monitoring are <strong>logs</strong>, <strong>metrics </strong>and <strong>traces </strong>of the data which helps in minimizing <strong>downtime </strong>and increasing the overall user experience.</p><blockquote><strong>Some Monitoring Tools: </strong>Prometheus, Grafana, Splunk, Nagios, etc.</blockquote><h3>Infrastructure</h3><p>In computing, Infrastructure/Infra means we talk about the <strong>computer hardware &amp; software, networking, Operating systems, etc.</strong></p><p>Talking the same with respect to the Cloud world, one such complete infrastructure can be provided by <strong>AWS, Azure, GCP</strong> and other cloud providers to work with ease. These cloud providers have their own infrastructure like servers, storage, networks, operating systems, etc which are always highly available.</p><blockquote><strong>Some Infrastructure Automation Tools:</strong> Terraform, CloudFormation, etc.</blockquote><p>These tools are also called Infrastructure as a Code (IaC).</p><h3>Automation</h3><p>Let’s say we do a repetitive manual task daily and if that manual work is done with the help of a script/tool that’s called <strong>Automation</strong>. It makes things faster, less error-prone and no manual intervention.</p><p>Similarly in DevOps, we can increase efficiency with the help of Automation. Automating the <strong>Build, Test and Deploy</strong> stages of the SDLC process with the help of DevOps tools thus ensuring delivery of the product/application quicker with quality and faster time to market.</p><p>Some Automation Tools:</p><ul><li><strong><em>Building:</em></strong><em> Maven, Gradle.</em></li><li><strong><em>Testing:</em></strong><em> Selenium WebDriver.</em></li><li><strong><em>Deploying:</em></strong><em> Jenkins, Docker, Kubernetes.</em></li></ul><p>Hope I was able to make a good understanding of the concept. Thank you.</p><p><em>Please let me know in the comment section about any corrections/mistakes, am open to improvements and suggestions.</em></p><p><em>Do follow me for more such content related to DevOps world.</em></p><p><em>Cheers, Vish, and Happy Learning!!!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b06b22bad3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>