<?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 Sajawal Awan on Medium]]></title>
        <description><![CDATA[Stories by Sajawal Awan on Medium]]></description>
        <link>https://medium.com/@i191707?source=rss-f32a7abc573------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*O5rTftxRR1S2mEfC</url>
            <title>Stories by Sajawal Awan on Medium</title>
            <link>https://medium.com/@i191707?source=rss-f32a7abc573------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:20:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@i191707/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[StatefulSet in Kubernetes]]></title>
            <link>https://medium.com/@i191707/statefulset-in-kubernetes-f8e6cb4ba091?source=rss-f32a7abc573------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8e6cb4ba091</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[statefulsets]]></category>
            <category><![CDATA[container-orchestration]]></category>
            <dc:creator><![CDATA[Sajawal Awan]]></dc:creator>
            <pubDate>Tue, 13 Dec 2022 22:33:54 GMT</pubDate>
            <atom:updated>2022-12-13T22:33:54.585Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*UWwvI8JSxpanPNw-CyhD1g.png" /></figure><h3>What is a stateful set?</h3><p>Stateful set is a workload Api object for managing stateful applications available in Kubernetes 1.9 and later.It manages scaling and deployment of a set of pods and guarantees the ordering and uniqueness of these pods.</p><p>Kubernetes Users most of the time don’t care how the pods are scheduled but sometimes there is a need to take care of the order the pods are deployed in; they have unique network identifiers and that they have persistent storage volume. In cases like these you need the help of Stateful set to accomplish what you desire.</p><p>All the pods created by stateful set have an ordinal value of 0-(num of replicas-1) and a stable network id. Moreover, you can also create a persistent volume for each pod through volumechaintemplate. On deployment by Stateful set the pods will be created in the order from 0 to the final pod requiring that each pod behind in the order is running and ready.</p><h3>Cases to use Stateful Set</h3><ul><li>A Redis pod that has access to a volume ad you want it to remain the access to the same volume even if it is restarted or redeployed</li><li>A webapp that needs to communicate with its replicas using predefined network identifiers</li><li>A Cssandra cluster where each node maintains access to its data</li><li>You need ordered and automated rolling updates</li><li>You need ordered and graceful deployment and scaling of your application</li></ul><h3>Creating a Stateful Set</h3><p>Stateful set require a headless service and can be configured using a manifest file. In the following example we will be creating a headless service named nginx, a stateful set named web indicating that 3 replicas of niginx will be launched in unique pods and a volumeclaimtemplate that will provide persistent volume.</p><pre>apiVersion: v1 <br>kind: Service <br>metadata: <br> name: nginx <br> labels: <br> app: nginx <br>spec: <br> ports: <br> - port: 80 <br> name: web <br> clusterIP: None <br> selector: <br> app: nginx <br> - - <br>apiVersion: apps/v1 <br>kind: StatefulSet <br>metadata: <br> name: web <br>spec: <br> selector: <br> matchLabels: <br> app: nginx # has to match .spec.template.metadata.labels <br> serviceName: &quot;nginx&quot; <br> replicas: 3 # by default is 1 <br> minReadySeconds: 10 # by default is 0 <br> template: <br> metadata: <br> labels: <br> app: nginx # has to match .spec.selector.matchLabels <br> spec: <br> terminationGracePeriodSeconds: 10 <br> containers: <br> - name: nginx <br> image: registry.k8s.io/nginx-slim:0.8 <br> ports: <br> - containerPort: 80 <br> name: web <br> volumeMounts: <br> - name: www <br> mountPath: /usr/share/nginx/html <br> volumeClaimTemplates: <br> - metadata: <br> name: www <br> spec: <br> accessModes: [ &quot;ReadWriteOnce&quot; ] <br> storageClassName: &quot;my-storage-class&quot; <br> resources: <br> requests: <br> storage: 1Gi</pre><p>Finally, you will need to use the following command to create the pods</p><pre>kubectl apply -f web.yaml</pre><h3>Limitations</h3><ul><li>Stateful sets currently require a headless service to be responsible for the identity of pods over the network and the user is responsible for creating the headless service</li><li>When Roling updates with the default Pod Management Policy there is a possibility to get into broken state that will require you to manually repair</li><li>The storage for a given pod must either be pre provisioned by an admin or provisioned by a persistent volume provisioner.</li><li>Stateful sets do not provide any guarantees of termination of pods when a stateful is deleted.</li></ul><h3>Last thoughts</h3><p>Despite the limitations Statefulsets are easy to create and update providing a lot of value if you need persistent volume or network id for a pod but can be hard to monitor with traditional tools.</p><h3>Refrences</h3><ul><li><a href="https://www.bluematador.com/blog/an-introduction-to-kubernetes-statefulset">What is a Kubernetes StatefulSet?</a></li><li><a href="https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/">StatefulSet Basics</a></li></ul><p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#:~:text=StatefulSet%20is%20the%20workload%20API,on%20an%20identical%20container%20spec">https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#:~:text=StatefulSet%20is%20the%20workload%20API,on%20an%20identical%20container%20spec</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8e6cb4ba091" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD pipeline and Kubernetes]]></title>
            <link>https://medium.com/@i191707/ci-cd-pipeline-and-kubernetes-29d2a1dcfaf0?source=rss-f32a7abc573------2</link>
            <guid isPermaLink="false">https://medium.com/p/29d2a1dcfaf0</guid>
            <category><![CDATA[jenkins-pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[drone-ci]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Sajawal Awan]]></dc:creator>
            <pubDate>Mon, 14 Nov 2022 22:37:07 GMT</pubDate>
            <atom:updated>2022-11-14T22:37:07.966Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*f0LBlfQpoufm6kJ1CFA0TA.png" /></figure><h3>Introduction</h3><p>CI/CD pipeline is an essential component of devops.CI abbreviation for continuous integration and cd standing for continuous deployment is an essential part of software delivery process. The ci/cd pipeline automates these task and helps the user to build, run tests and safely deploy the new version of application with minimal intervention.</p><h4>CI/CD Pipeline Elements</h4><p>CI/CD pipeline may sound intimidating but it is simply automating the process that a software developer would have to do manually otherwise, which is far less productive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rQBHxniW0CUyYDxm8aor3g.png" /></figure><h4>Source stage</h4><p>Source stage mainly consists of a git-push .It initiates the pipeline by generating the request, for which a corresponding pipeline is run as a response.</p><h4>Build stage</h4><p>This stage consists of combining thee source code and its dependencies ,Though this is limited to programming languages like java and go. Python on the other hand skips this step.</p><p>The main task of this stage is to build a docker container and failure to pass this stage means problem in a software’s configuration</p><h4>Test stage</h4><p>This stage as the name suggests consists of testing the code for easily reproducible bugs. The stage can last from mere seconds to hours depending on the complexity of the project and the number of tests.</p><p>This stage needs to provide instant feedback to the developer in case of a failed test so the developer can fix it while the code is still in its mind</p><h4>Deploy stage</h4><p>Once we have attained a runnable instance of the project the project is ready to be deployed and available for the end user.</p><h3>Tools for building pipeline inside K8’s Cluster</h3><p>Now that we are familiar with ci/cd pipeline lets discuss about tools that make it possible to build a ci/cd pipeline inside a k8 cluster</p><h4>JenkinsX</h4><p>It was first introduced in 2018 by James Starchen and is built from ground up to be cloud native and kubernetes only.It dosen’t only allow to efficiently build a ci/cd pipeline but also akes working with kubernetes as easily as possible.Some of it’s useful features are:</p><p><strong>Automated CI /CD</strong></p><p><strong>Environment Promotion via GitOps</strong></p><p><strong>Extensions</strong></p><p><strong>Preview Environments</strong></p><p><strong>Server less Jenkins</strong></p><h4>Drone CI</h4><p>Drone is an open-source project with over 25,700 GitHub stars and 300 plus contributers .It is a cloud native CI that offers a mature container based system that leverages the scaling and fault-tolerance characteristics of cloud native architectures. It lets you run any existing containers as part of your pipeline or package your build logic into reusable containers called Drone Plugins.</p><h4>GitLab</h4><p>It is a complete DevOps platform that allows the user to perform all the required tasks. It is a web-based Git repo that provides free open and private repos. It helps the development team in reducing the product lifecycle and increase productivity. Its main benefit being the fact that it allows the team members to collaborate in every phase of the project. It also offers tracking from planning to creation to help developers automate the entire DevOps lifecycle and achieve the best possible results.</p><h3>Conclusion</h3><p>CI/CD is an essential part of software development life cycle and an increasing need of faster pipelines is their .Kubernetes aids the purpose of cloud native approach while the pipeline compliments the process. A good pipeline can deduct days in development lifecycle aiding both the developer and user.</p><h4>References</h4><p><a href="https://www.simplilearn.com/tutorials/git-tutorial/what-is-gitlab#:~:text=GitLab%20is%20a%20web%2Dbased,management%20to%20monitoring%20and%20security.">What is GitLab and How to Use It?</a></p><p><a href="https://boom.co/blogs/drone-ci-for-engineering-teams/">Bring Continuous Integration to Your Laptop With the Drone CI Docker Extension</a></p><p><a href="https://medium.com/edureka/jenkins-x-d87c0271af57">What is Jenkins X and how is it Different from Jenkins?</a></p><p><a href="https://semaphoreci.com/blog/cicd-pipeline">CI/CD Pipeline: A Gentle Introduction</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29d2a1dcfaf0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Swarm: Power Multiplied]]></title>
            <link>https://medium.com/@i191707/docker-swarm-power-multiplied-261e7203696d?source=rss-f32a7abc573------2</link>
            <guid isPermaLink="false">https://medium.com/p/261e7203696d</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-swarm]]></category>
            <dc:creator><![CDATA[Sajawal Awan]]></dc:creator>
            <pubDate>Tue, 20 Sep 2022 20:24:17 GMT</pubDate>
            <atom:updated>2022-09-20T20:24:17.307Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/246/1*2WYRzqGc6s6-uqXLp57geA.png" /><figcaption>image source: <a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fgcallah.github.io%2FDevOps%2Fdeployment%2FdockerSwarm.html&amp;psig=AOvVaw3mJDP0xvGagrMlv0m0JKuk&amp;ust=1663791399697000&amp;source=images&amp;cd=vfe&amp;ved=2ahUKEwjrtpKMmKT6AhUWHd8KHRciDAsQjRx6BAgAEAs">internet</a></figcaption></figure><p>In the contemporary world, when automating the administration of application micro services is more crucial than ever, workload orchestration is essential and Dockers Swarm is the tool for cluster<br>orchestration, but it also included certain functionality that was previously found in the Dockers engine itself before Dockers Compose.<br><strong>What is a docker Swarm?</strong><br>A cluster of physical or virtual machines that are all running the Docker application is referred to as a “docker swarm”. Once a set of computers has been clustered together, you may still give Docker instructions; however, the machines in your cluster will now carry out your orders.<br>Nodes are the computers that have joined the cluster, and a swarm manager is in charge of overseeing its activities.<br>Let’s take a step back and clarify some of the more fundamental words connected to containers and the docker program in order to frame our understanding of a Dockers installation.<br><strong>Dockers </strong>Software platform Dockers makes it simple for programmers to include the use of containers into their development workflows. Since the Dockers platform is open source and available for both Windows and Mac, developers using different platforms may use it .An interface for control between the host operating system and containerized applications is provided by the application.<br><strong>Containers </strong>The docker application’s primary focus is on containers and how to use and manage them during the software development process. With the use of containers, programmers may bundle apps with all the dependencies and code required for them to run in any computer environment. As a result, containerized program function consistently when switched between computer environments. Running<br>an image launches a container in the docker application.<br>Images All of the code, libraries, runtime, binaries, and configuration files required to operate a program are included in an image, which is a collection of executable files. The runtime instance of an image may<br>be thought of as being in a container.<br><strong>The docker file</strong> the sort of file that specifies the elements of a portable image is known as a Dockers file.<br>Just for fun, supposing that you were going to create a Java program. You’ll need a method to translate your code into machine code because your computer cannot grasp Java on its own. “The Java Runtime Environment (JRE)” refers to the set of applications, configuration files, and libraries required for this. All of these resources would be contained in the Dockers file if using Dockers.</p><p><strong>How docker swarm works?<br></strong>Managers and workers are the two different categories of nodes. Tasks including upholding cluster state, scheduling services, and providing swarm mode HTTP API endpoints are handled by manager nodes. Using an implementation of the Raft algorithm, the managers keep the swarm and the services that are executing on it in a consistent state. You may utilize the fault-tolerance capabilities of swarm mode by running numerous management nodes. However, more managers do not always imply more<br>scalability or improved performance. The contrary is typically true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*Wf8qO1PHuQq13aXOB1b-lw.png" /><figcaption>image source: <a href="https://www.google.com/imgres?imgurl=https%3A%2F%2Fstatic.javatpoint.com%2Fblog%2Fimages%2Fdocker-swarm4.jpg&amp;imgrefurl=https%3A%2F%2Fwww.javatpoint.com%2Fdocker-swarm&amp;tbnid=kxr2OVONZeFSTM&amp;vet=12ahUKEwi8suvTl6T6AhUsn3IEHf0gB3UQMyhEegUIARCHAQ..i&amp;docid=3FgafMAbvNK77M&amp;w=1496&amp;h=795&amp;q=docker%20swarm&amp;ved=2ahUKEwi8suvTl6T6AhUsn3IEHf0gB3UQMyhEegUIARCHAQ">internet</a></figcaption></figure><p>Implementing an odd number of management nodes is what Docker advises. A three-manager swarm may function without interruption with a maximum loss of one manager. Maximum simultaneous loss of two management nodes is tolerated by a five-manager swarm. An N manager cluster will typically accept the loss of no more than (N-1)/2 managers. Services continue to operate when managers fail after this point, but you must construct a new cluster to recover. Worker nodes are additional Dockers Engine instances whose only function is to run containers. To work, there must be at least one management node. All managers are workers by default. You may use commands like dicker service<br>create in a cluster with a single management node, and the scheduler will place all jobs on the local Engine.<br>Set a management node’s availability to Drain to stop it from carrying out tasks. Dockers node promote may be used to elevate a worker node to manager status. For instance, while a management node is down for maintenance, you might want to promote a worker node. Node demote can also be used to downgrade a management node to a worker node.<br>Developers are increasingly using the Dockers engine and docker swarms to more quickly create, maintain, and consume apps. Even industry leaders in software, like Google, are embracing container-based approaches like docker swarm.<br>Because docker swarm completely utilizes the architectural advantages provided by containers, developers like employing it. Containers make it possible for developers to distribute applications or services in isolated virtual environments, a task formerly reserved for virtual machines. Due to their architecture, containers are proven to be a more lightweight alternative to virtual machines in terms of CPU resources.</p><p>Redundancy helps docker swarms increase application availability, which is one of their key advantages. A docker swarm needs a swarm manager who can delegate tasks to worker nodes in order to operate. Developers make sure the system can continue to run even if one of the management nodes fails by implementing numerous managers. Each cluster should have no more than seven management nodes,<br>according to Dockers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=261e7203696d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>