<?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[devopsanswers - Medium]]></title>
        <description><![CDATA[Devops Publications - Medium]]></description>
        <link>https://medium.com/devopsanswers?source=rss----b3da587c253a---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>devopsanswers - Medium</title>
            <link>https://medium.com/devopsanswers?source=rss----b3da587c253a---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 28 May 2026 12:17:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/devopsanswers" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Terraform 101]]></title>
            <link>https://medium.com/devopsanswers/terraform-101-94bf91df1f74?source=rss----b3da587c253a---4</link>
            <guid isPermaLink="false">https://medium.com/p/94bf91df1f74</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rumesh Bandara]]></dc:creator>
            <pubDate>Thu, 12 Jan 2023 13:56:58 GMT</pubDate>
            <atom:updated>2023-01-21T02:52:18.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ATNMu1nQTnIXauJYXlDDGw.png" /><figcaption>Terraform by <a href="https://developer.hashicorp.com/terraform/tutorials/aws-get-started/infrastructure-as-code">Hashicorp</a></figcaption></figure><h4>Introduction</h4><p><a href="https://www.terraform.io/">Terraform</a> is an open-source tool created by <a href="https://www.hashicorp.com/">HashiCorp</a>, and it has gained popularity in recent years as more and more companies are moving towards cloud-based infrastructure. It supports multiple cloud providers, such as Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform (GCP) as well as on-premises and other custom solutions.</p><h4>Features</h4><p>One of the key features of Terraform is its ability to represent infrastructure as code. This means that infrastructure can be defined using a simple, human-readable programming language, rather than manually configuring resources through a web interface. This has several benefits including version control, collaboration and repeatability.</p><p>Another important feature of Terraform is its ability to manage infrastructure across multiple cloud providers. This is particularly useful for organizations that use multiple cloud providers, or that need to migrate workloads between cloud providers. Terraform can also manage on-premises resources, such as servers and networking equipment, in addition to cloud-based resources.</p><h4>Terraform Workflow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*vDWKKtD-Oizb85e1BWE6yQ.png" /><figcaption>Terraform Workflow by <a href="https://developer.hashicorp.com/terraform/tutorials/automation/github-actions">Hashicorp</a></figcaption></figure><p>Terraform includes a built-in plan and apply workflow, which allows users to preview changes to infrastructure before they are applied. This can help prevent mistakes and unintended changes to resources. Additionally, Terraform’s <strong>state</strong> management capabilities allow users to keep track of the current state of their infrastructure, and roll back changes if necessary.</p><p>The typical workflow for using Terraform includes the following steps:</p><ol><li><strong>Initialize</strong> Terraform: Before you can start using Terraform, you need to initialize it by running the <strong>terraform init </strong>command. This command downloads the required providers and sets up the necessary files for Terraform to run.</li><li>Write Terraform Configuration: Next, you need to write your Terraform configuration, which defines the resources you want to create, modify, or delete. Terraform configuration files use the HashiCorp Configuration Language (HCL) and are saved with the <strong>.tf</strong> file extension.</li><li><strong>Plan</strong> the Changes: Once you have written your Terraform configuration, you can use the <strong>terraform plan</strong> command to create an execution plan. This command shows you what changes Terraform will make to your infrastructure and allows you to preview the changes before they are applied.</li><li><strong>Apply</strong> the Changes: If the plan looks good, you can apply the changes by running the <strong>terraform apply</strong> command. This command creates or modifies the resources defined in your Terraform configuration.</li><li>Monitor and Manage <strong>State</strong>: After applying the changes, you can use the <strong>terraform show</strong> command to view the current state of your infrastructure, and the <strong>terraform state</strong> command to manage the state of your resources.</li><li><strong>Destroy</strong> the Resources: When you no longer need the resources created by Terraform, you can use the <strong>terraform destroy</strong> command to delete them.</li></ol><h4>Why Terraform State?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vTRRwTMTKTGJ7MUlQ-hUsQ.png" /><figcaption>Terraform State by <a href="https://blog.gruntwork.io/how-to-manage-terraform-state-28f5697e68fa">gruntwork</a></figcaption></figure><p>In Terraform, the state refers to the current configuration of your infrastructure as Terraform understands it. This includes information about all the resources that Terraform is managing, such as their current properties, IDs, and dependencies. The state is stored in a file called the <strong><em>state file</em></strong>, which is typically saved locally but can also be stored remotely.</p><p>The state file is used by Terraform to keep track of the current state of your infrastructure, and it is updated every time you run the terraform apply command. This allows Terraform to know what changes need to be made to your infrastructure in order to bring it in line with your configuration files.</p><p>Terraform uses the state file to know what resources need to be created, updated, or deleted. It also uses the state file to track the metadata of the resources, such as their unique identifiers and properties. This information is used to ensure that Terraform makes the correct changes to your infrastructure when you run the terraform apply command.</p><h4>Remote State</h4><p>There are different state management options that Terraform provides, such as storing the state file locally, in a remote backend like S3, Consul, or etcd. Remote state management is useful when you have a team working on the same infrastructure, it allows to share the state information and ensure consistency.</p><blockquote>Managing the state file is an important aspect of using Terraform, and it’s important to keep it safe and secure. It’s also important to make sure that you have a backup of the state file so that you can recover your infrastructure in case of an emergency.</blockquote><h4>Integration</h4><p>Also, Terraform has great integration with other tools like Ansible, Jenkins, and many other CI/CD tools, you can use Terraform in conjunction with these tools to automate your entire infrastructure provisioning and management workflow.</p><p>In summary, Terraform is a powerful tool for managing infrastructure as code, across multiple cloud providers and on-premises resources. Its ability to preview and track changes, along with its state management capabilities, make it a valuable tool for organizations looking to improve their infrastructure management processes.</p><p>Stay tuned for the next article which we can dive deep into Terraform in Action.</p><h4>More Cloud Learning Resources</h4><p><a href="https://medium.com/devopsanswers/kubernetes-the-easy-way-19f69e57738d">Kubernetes The Easy Way</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94bf91df1f74" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devopsanswers/terraform-101-94bf91df1f74">Terraform 101</a> was originally published in <a href="https://medium.com/devopsanswers">devopsanswers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes The Easy Way]]></title>
            <link>https://medium.com/devopsanswers/kubernetes-the-easy-way-19f69e57738d?source=rss----b3da587c253a---4</link>
            <guid isPermaLink="false">https://medium.com/p/19f69e57738d</guid>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Rumesh Bandara]]></dc:creator>
            <pubDate>Sun, 21 Aug 2022 17:54:41 GMT</pubDate>
            <atom:updated>2023-01-15T09:15:14.623Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kelsey Hightower on Twitter</h3><p>The cloud made the hypervisor disappear. Kubernetes will be next.</p><p><strong>Kubernetes</strong> is the go-to solution for microservices and container-based production implementations, which is trusted by the community and large web-scale companies. It’s backed and used by titans like Red Hat, IBM and Microsoft.</p><p>When I first got to know <a href="https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/">Kubernetes</a>, it was not a very simple concept to understand as we were working on bare-metal and hypervisor-based production implementations every day.</p><p>Industry experts like <a href="https://github.com/kelseyhightower">Kelsey Hightower</a> predict Kubernetes will be the next big thing after the hypervisors and the cloud era. So I thought of simplifying the Kubernetes concepts in easy to understand manner to help others who are eager to learn. I will explain the main components and practical usage by using exciting visuals wherever possible.</p><p>Let’s begin the very first article of my Kubernetes series, <strong><em>Kubernetes </em>-<em> The Easy Way</em></strong>.</p><h4>Pro Tip!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*595TRKfQ9DimsSyD1R_7yA.jpeg" /><figcaption>The Comfort Zone by <a href="https://www.fe.training/free-finance-resources/qa/is-your-comfort-zone-getting-in-the-way-of-success/">FinancialEdge</a></figcaption></figure><p>Please come out of your <strong><em>Comfort Zone</em></strong> and be in your <strong>Learning Zone</strong> to <strong>Ace</strong> the Kubernetes if you don’t have any basic understanding or experience before. There might be a lot of questions, but don’t give up :)</p><h4>A little bit of History</h4><p>Kubernetes was born as a result of Google’s decade of experience in managing containerized systems at a large scale using <a href="https://storage.googleapis.com/pub-tools-public-publication-data/pdf/44843.pdf">Borg and Omega</a>. They used to run hundreds of thousands of jobs, from many thousands of different applications, across many clusters. Later, Google introduced Kubernetes as an open-source version of Borg.</p><h4>Kubernetes and Containers</h4><figure><img alt="Containers vs VMs" src="https://cdn-images-1.medium.com/max/1024/1*mS5c8IKskvmz5fDeDacGdA.png" /><figcaption>Containers vs VMs by <a href="https://www.docker.com/resources/what-container">Docker</a></figcaption></figure><p><strong>Containers </strong>(Docker, rkt, Containerd) allow us to create, deploy, and run applications in a very effective way. It will package an application with required libraries and other dependencies, and ship it all out as one package. Not like Virtual Machines, it will share the same host operating system kernel across the containers.</p><p>In production, we need to ensure all the services will run with maximum availability. If a container dies, another container should spawn and continue the workload. But how to achieve this state will be a question if you are new to the container-centric world. A container orchestration system which will provision, schedule and manages containers at scalable manner would be the ideal choice.</p><p>That’s where Kubernetes will be the trusted platform to orchestrate, scale and failover the containerized applications. It adds more features like automating app deployments and updates, health-check and self-heal apps with <em>autorestart</em>, <em>autoreplication</em> and <em>autoscaling</em>.</p><h3>The Easy Way</h3><figure><img alt="Kubernetes Main Components as an example of a Sea Port" src="https://cdn-images-1.medium.com/max/1024/1*VstxxC2a3iMAKcEDto5inA.jpeg" /><figcaption>“Seaport Infographic” extracted from <a href="http://www.freepik.com">freepik.com</a> by <a href="https://www.freepik.com/free-vector/sea-port-isometric-infographics_4026477.htm">macrovector</a></figcaption></figure><p>Kubernetes contain a few main components as seen from the simplified diagram above, which displays a typical operation of a <strong>Maritime Port</strong> facility. I wanted to make things much easy to understand for everyone. So I will explain the main concepts using the above diagram as the starting point.</p><p>You could see that the <strong>Ships</strong> are doing the hard work of moving containers across the sea. The <strong>Main Control Center</strong> is responsible for communication, managing containers and monitoring the <strong>Ships</strong>.</p><p>According to the Kubernetes analogy, <strong>Ships</strong> will consider as <strong>Worker Nodes</strong> which can load containers.</p><p>The <strong>Main Control Center</strong> will load the containers to the <strong>Ships</strong> and identify which containers should go into which <strong>Ships</strong>. In addition, it will plan how to load containers, store information about the containers and ships, monitor the containers and ships including the loading and unloading process.</p><p>The <strong>Main Control Center</strong> has different departments to handle various tasks such as loading and moving containers between ships, monitoring the containers and workload, tools such as cranes to move containers and devices to communicate between ships and <strong>Main Control Center</strong>.</p><p>The <strong>Main Control Center</strong> will consider as the <strong>Kubernetes Master</strong> according to the Kubernetes terminology.</p><p>I will walk through each component briefly.</p><figure><img alt="Kubernetes Overview" src="https://cdn-images-1.medium.com/max/1024/1*Z2ed5gFtE4hiQgLsvUuQFg.png" /><figcaption>Kubernetes Overview</figcaption></figure><h4><strong>Master</strong></h4><p>Kubernetes Master (control plane) is the main component of managing a Kubernetes cluster deployment. According to the diagram, the <strong>Main Control Center</strong> of the port will be considered as our Master node.</p><p>Master has a few more components such as <strong>ETCD cluster, Kube API Server, Kube Controller Manager </strong>and<strong> Kube Scheduler</strong> which will combine together to control the Kubernetes cluster.</p><p>We need at least three masters to run a production Kubernetes cluster to facilitate high availability.</p><h4><strong>ETCD Cluster</strong></h4><p>There is much information you need to store regarding the port’s daily operations. The number of ships comes to the port, the number of containers loaded and unloaded, container load and unload timestamps and which ships handled which containers? etc. We need to ensure this data is recorded somewhere and available on-demand. The<strong> Data Store Facility</strong> in the Port will store all of the data.</p><p>In Kubernetes terms, the <strong>Data Store </strong>is considered as the<strong> ETCD cluster</strong>.<strong> </strong>It’s basically a key-value based distributed data store. It will actually store the critical data related to the Kubernetes cluster such as config data, cluster state and metadata.</p><p>Kubernetes use ETCD functionalities to monitor the cluster changes. When you interact with the Kubernetes cluster using the API, you will read the command output values (<em>kubectl get</em>) which are stored in ETCD. Same way, when you use API to create Kubernetes resources (<em>kubectl create</em>), it will write back to ETCD. So if you want to back-up cluster data, ETCD is the right pick.</p><blockquote><strong>Pro Tip!</strong></blockquote><blockquote>To backup a Kubernetes Cluster you can use a tool like <a href="https://github.com/vmware-tanzu/velero"><strong>Velero</strong></a><strong> </strong>from <strong>VMware </strong>or <a href="https://k8up.io/"><strong>k8up</strong></a><strong> </strong>which is an opensource project by Devops wizards at <a href="https://vshn.ch/"><strong>VSHN</strong></a></blockquote><h4><strong>Kube API Server</strong></h4><p>The API server will act as the backbone of the communication channel between the Kubernetes components. The end user can use <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/"><strong><em>kubectl</em></strong></a><em> </em>cli<em> </em>tool to manage the cluster deployments via API calls. When you send a command via API endpoint, k8s cluster will set this as the desired state of new or existing components.</p><p>The <strong>Communication Tower</strong> in port will be considered as the <strong>API Server</strong> which facilitates the communication between the ships and the control center.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bm2GoCigU8wBO_i5c3UhCQ.png" /><figcaption>Kubernetes Communication by <a href="https://kube.academy/">VMWare</a></figcaption></figure><h4><strong>Kube Controller Manager</strong></h4><p>This component manages various <strong>controllers</strong> in Kubernetes. <strong>Controllers</strong> are control loops that continuously watch the state of your cluster, and then make or request changes where needed. Each controller tries to move the current cluster state closer to the desired state.</p><p>In our example, <strong>Port Controller Room</strong> will be considered as Controller Manager.</p><p>There are number of controllers available. I’ll list down a few controllers with the usage.</p><ul><li><strong>Node Controller</strong> - responsible for monitoring the status of the nodes and taking necessary actions</li><li><strong>Replication Controller</strong> - monitoring the status of replica sets and ensuring that the desired number of PODs are available at all times within the ReplicaSet</li><li><strong>Deployment Controller </strong>- monitoring the status of the deployment and ensuring that the desired number of PODs are available at all times</li><li><strong>Job Controller </strong>-<strong> </strong>responsible for monitoring the status of the jobs and updating the job status to API Server</li></ul><h4><strong>Kube-Scheduler</strong></h4><p>The kube-scheduler is responsible for <strong>assigning</strong> pods to nodes in the cluster by making the decision of which pods go to which nodes.</p><p>In our example, the <strong>container handling</strong> <strong>crane</strong> is making sure which container goes to which ship.</p><blockquote><strong>Scheduler</strong> is only the decision maker for the pod assignment. Actual heavy lifting is done by <strong>kubelet </strong>by running the pods as underline containers.</blockquote><p>The scheduler will go through each pod to identify CPU and Memory requirements and it will skip the nodes which don’t have enough resources to run the containers.</p><p>The scheduler follows a ranking method for the remaining nodes to finalize a node to fit the pods. It prioritizes the node by following a scale which calculates the remaining resources, if it scheduled the pods in that node. The node which is having the highest number of free resources wins and gets a better rank.</p><p>The scheduler can be used to control the pod placement of the nodes using <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector">nodeSelector</a> and <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity">Node affinity</a> rules.</p><h4><strong>Worker Nodes</strong></h4><p>A worker node is basically a compute instance that will run the cluster workload as containers. There could be thousands of worker nodes in a high-end Kubernetes cluster.</p><p>According to the example, <strong>Ships</strong> will be the worker nodes.</p><p>It has important components such as <a href="https://kubernetes.io/docs/concepts/overview/components/#kubelet"><strong>Kubelet</strong></a><strong>, </strong><a href="https://kubernetes.io/docs/concepts/overview/components/#kube-proxy"><strong>Kube Proxy</strong></a><strong> </strong>and<strong> </strong><a href="https://kubernetes.io/docs/concepts/overview/components/#container-runtime"><strong>Container Runtime Interface</strong></a><strong> (CRI)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JNgT6W1tdZJUCRCwmEpsTQ.png" /></figure><h4><strong>Kubelet</strong></h4><p>Kubelet is the main component of the worker node, which manages the pod lifecycle.</p><p>In our example, the <strong>ship captain</strong> will be considered as the Kubelet. He will continuously communicate with the <strong>Main Control Center</strong> to give information about the remaining cargo space in the ship, destination country, fuel requirements etc.</p><p>In return, the Control Center will send instructions to the <strong>Crane operator (Scheduler) </strong>to stack containers which fit the ship&#39;s remaining space and destination.</p><p>In an actual k8s cluster, Kubelet communicates with the Master node via API Server and gives information about the remaining CPU, Disk and Memory resources. Also, Kubelet is the component which joins the node to the Kubernetes cluster by talking to the Master API endpoint and initiating the TLS handshake.</p><p>Master will send the instructions to Kubelet via API Server to run the POD. Kubelet will run the underline containers using the container run time engine (<strong>Docker/Containerd</strong>) by pulling the required Docker images.</p><p>The Kubelet then continues to monitor the state of the POD and reports to the Master via Kube API.</p><p>Refer to the highlighted parameters in the following Kubelet config file to understand how the Kubelet configures the client CA certificate, sets cluster DNS (for PODs) and Kubernetes manifest location to contain the static pod definitions(etcd, kube-apiserver, kube-controller-manager and kube-scheduler).</p><pre>apiVersion: kubelet.config.k8s.io/v1beta1<br>authentication:<br>  anonymous:<br>    enabled: false<br>  webhook:<br>    cacheTTL: 0s<br>    enabled: true<br>  x509:<br>    <strong>clientCAFile: /etc/kubernetes/pki/ca.crt</strong><br>cgroupDriver: systemd<br><strong>clusterDNS:<br>- 10.96.0.10</strong><br>clusterDomain: cluster.local<br>kind: KubeletConfiguration<br>resolvConf: /run/systemd/resolve/resolv.conf<br>rotateCertificates: true<br><strong>staticPodPath: /etc/kubernetes/manifests</strong></pre><h4><strong>Kube-Proxy</strong></h4><p>There is an interesting thinking behind the introduction of kube-proxy. Let’s have a look at the practical approach of the kube-proxy and what is the exact usage of this component.</p><p>Kubernetes Pods are designed to terminate and relaunch according to the Node status to facilitate self-healing and high availability of the running application. So if we use a k8s <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"><strong>Deployment</strong></a> or <a href="https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/"><strong>ReplicaSet</strong></a>, it will create and destroy the pods dynamically to maintain the desired state.</p><p>So if k8s rely on pod IPs to connect with other pods, it’s not a practical solution as the IPs keep changing on each new pod. So if you want to reach another pod without using its IP, you need to expose the pod as a <a href="https://kubernetes.io/docs/concepts/services-networking/service/">Service</a>.</p><blockquote>In a k8s cluster each pod should be able to reach all other pods by default. This can be controlled using <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/">Network Policies</a> in a production cluster to properly isolate pods.</blockquote><p>Here comes the fun part; if we keep creating new services, there should be a way to keep track of each service from each node. So two pods can communicate with each other regardless of the current node the pods are running.</p><p>The solution is <strong>Kube-Proxy</strong>. It looks for new services and it creates the appropriate rules on each node to forward traffic to those services to the backend pods. In a legacy cluster, kube-proxy will use <a href="https://opensource.com/article/18/9/linux-iptables-firewalld">Linux iptables</a> rules to forward traffic.</p><p>Kube-proxy is deployed as a process that runs on each node in the Kubernetes cluster as a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/">DaemonSet</a>.</p><h4>Happy Learning!</h4><p>This is the end of the first article of The Easy Way of learning Kubernetes series.</p><p>We can explore the best practices of k8s cluster design and practical ways of application deployments in upcoming articles.</p><p>Hands-on practice is the key for familiarize with k8s.</p><p>Currently, <a href="https://killercoda.com/playgrounds/">Killercoda</a> and <a href="http://labs.play-with-k8s.com/">Play with Kubernetes</a> provide all the Kubernetes Playgrounds for absolutely <strong>free</strong>. 🥳</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w2q2APZSANJZ0tWvPRHe7w.png" /></figure><h4>More Cloud Learning Resources</h4><p><a href="https://medium.com/devopsanswers/terraform-101-94bf91df1f74">Terraform 101</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19f69e57738d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devopsanswers/kubernetes-the-easy-way-19f69e57738d">Kubernetes The Easy Way</a> was originally published in <a href="https://medium.com/devopsanswers">devopsanswers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>