<?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 Payal on Medium]]></title>
        <description><![CDATA[Stories by Payal on Medium]]></description>
        <link>https://medium.com/@payalpawale010?source=rss-f8d1dea01693------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XSePHYzgKtPySJ9xH2O3DA@2x.jpeg</url>
            <title>Stories by Payal on Medium</title>
            <link>https://medium.com/@payalpawale010?source=rss-f8d1dea01693------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:45:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@payalpawale010/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[“ Dockerfile Syntax: A Beginner’s Guide to Dockerfile Instructions”]]></title>
            <link>https://medium.com/@payalpawale010/dockerfile-syntax-a-beginners-guide-to-dockerfile-instructions-c5a125753078?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5a125753078</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[docker-build]]></category>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Fri, 13 Dec 2024 17:37:54 GMT</pubDate>
            <atom:updated>2024-12-13T17:37:54.977Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction:</h4><p><strong>Dockerfile</strong> is a text file consists of Instructions to create a <strong>docker image</strong>. These instructions follow a specific syntax and allow us to define the behavior of the container that will be created from the image</p><h4>Dockerfile syntax:</h4><p>vim Dockerfile<br>we should name it as a <strong>Dockerfile</strong> only, it contains a data in below format</p><pre>INSTRUCTIONS argument</pre><p>So we have a multiple INSTRUCTIONS present inside dockerfile. We r gonna see those in detail. let’s get started</p><ol><li><strong>FROM Instruction :</strong> <br>The FROM instruction sets the <strong>base image</strong> for the Docker image you’re building. This is the starting point for your image, and it can be any image from Docker Hub or even a locally stored image.</li></ol><pre>FROM: &lt;image&gt;</pre><pre>FROM openjdk:17</pre><p>Here I am taking java (jdk) with version-17 .</p><p><strong>2. WORKDIR Instruction</strong>:<br>The WORKDIR instruction sets the working directory inside the container. If the directory doesn’t exist, Docker will create it for you. Any subsequent instructions of RUN, COPY, etc. will be executed here.</p><pre>WORKDIR /app</pre><p>here I have specified WORKDIR as /app. So, docker kit will create /app as a working directory and it will perform other Instructions operations inside this.</p><p><strong>3. COPY</strong> <strong>Instruction</strong>: <br>The COPY instruction copies files from your host machine into the Docker container. The first argument is the <strong>source</strong> (on your host), and the second is the <strong>destination</strong> (inside the container).</p><pre>COPY &lt;Source&gt; &lt;Destination&gt;</pre><pre>COPY . /app</pre><p>Here, I am copying my code my current directory to /app.</p><p><strong>4. ADD Instructions</strong>:<br> ADD is similar to COPY only but with additional feature such as the ability to download files from URLs or extract .tar archives automatically.</p><pre>ADD https://github.com/pawalepayal/Springboot-BankApp.git /app</pre><p>This downloads the specified GitHub repository and adds its contents to the /app directory inside the container.</p><p>now if wanna check whether these things r happing or not what i can i do is first i will build the image and i will run my image as a container and specify the commands to verify.<br>docker build -t java-app:17 .<br>docker run java-app:17 ls /app/<br>with this run command we can verify whther app data which we r adding from git is added or not.</p><p><strong>5. RUN Instruction </strong>: The RUN instruction executes commands in the container during the build process. This is commonly used to install dependencies or set up the environment.</p><pre>RUN mvn clean-install</pre><p>This command will run Maven’s clean and install tasks, building your Java application and downloading any necessary dependencies.</p><p><strong>6. EXPOSE</strong> <strong>Instruction: </strong><br>The EXPOSE instruction tells Docker that the container will listen on the specified network port at runtime.</p><pre>EXPOSE 8080</pre><p><strong>7. CMD </strong>and<strong> ENTRYPOINT</strong>: CMD is are the Instructions container looks for to run at starting of conatiner and it it always specified at the end of file.</p><ul><li><strong>ENTRYPOINT</strong>: Specifies the executable to run.</li><li><strong>CMD</strong>: Provides default arguments for the ENTRYPOINT.</li></ul><pre>ENTRYPOINT [&quot;executable&quot;,&quot;parameter1&quot;,&quot;parameter2&quot;]<br>CMD[&quot;executable&quot;,&quot;parameter1&quot;,&quot;parameter2&quot;]<br>or <br>ENTRYPOINT [&quot;executable&quot;]<br>CMD[&quot;parameter1&quot;]</pre><pre>ENTRYPOINT [&quot;java&quot;]<br>CMD[&quot;RUN&quot;]</pre><p>The CMD and ENTRYPOINT instructions define the default behavior when a container starts.</p><h4>Example of Dockerfile</h4><pre>#Taking maven and openjk image<br>FROM maven:3.8.4-openjdk-17-slim<br><br>#setting a working directory as /app<br>WORKDIR /app<br><br>#adding spring boot code into current directory<br>ADD https://github.com/pawalepayal/Springboot-BankApp.git /app<br><br>#running maven command to clean and install depedencies<br>RUN mvn clean install -DskipTests=true<br><br>#exposing to port 8080<br>EXPOSE 8080<br><br>#giving exectuable commands to CMD<br>CMD [&quot;java&quot;, &quot;-jar&quot;, &quot;/app/target/bankapp-0.0.1-SNAPSHOT.jar&quot;]<br></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5a125753078" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Kubernetes Workloads: A Deep Dive into Deployment, ReplicaSet, and StatefulSet”]]></title>
            <link>https://medium.com/@payalpawale010/kubernetes-workloads-a-deep-dive-into-deployment-replicaset-and-statefulset-6d086f50412e?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d086f50412e</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes-statefulset]]></category>
            <category><![CDATA[kubernetes-replicaset]]></category>
            <category><![CDATA[kubernetes-deployment]]></category>
            <category><![CDATA[k8s]]></category>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Mon, 09 Dec 2024 18:25:47 GMT</pubDate>
            <atom:updated>2024-12-09T18:25:47.170Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>The main aim of <strong>Deployment</strong>, <strong>ReplicaSet</strong>, and <strong>StatefulSet</strong> in Kubernetes is to maintain the desired state (replicas) of pods.</blockquote><h3>Deployment :</h3><p>Deployment file is written to achieve the desire state of <strong>pods.</strong><br>It ensures that the specified number of replicas are continuously running by ensuring <strong>scaling, autohealing</strong> and <strong>high availability</strong>.</p><p><strong>why it is required?</strong><br>lets see one example, if you specify that you want <strong>3 replicas</strong> of a Pod running, Kubernetes will ensure that there are always exactly 3 Pods running, and if one fails, it will be automatically replaced.<br>Hence, it ensource scaling, healing and high availability of pods.</p><h4>Deployment over Replica set?</h4><p>A <strong>ReplicaSet</strong> is responsible for ensuring that a specified number of replicas of a Pod are running at any given time. However, it does <strong>not</strong> support rolling updates and rollback. <br>When you update the Pod template in a ReplicaSet, it will typically delete all the existing Pods and create new ones to reflect the updated configuration. This behavior can result in <strong>downtime</strong></p><p>Whereas with the help of <strong>deployment</strong> we can perform <strong>rolling updates</strong> as well as <strong>rollback</strong>.</p><ul><li><strong>Rollback</strong> allows you to revert to a <strong>previous version</strong> of a Deployment if the new version causes issues.</li><li><strong>Rolling Updates</strong> are the mechanism for <strong>gradually updating Pods</strong> in a Deployment without downtime.</li><li>Both features are part of the <strong>Deployment</strong> object, and Kubernetes handles them automatically based on the configuration you specify in your Deployment YAML file.</li></ul><h4>Difference between Deployment and Stateful Sets?</h4><p><strong>Deployment</strong> is for <strong>stateless applications</strong>, where Pods are replaceable and do not need persistent storage.</p><p><strong>StatefulSet</strong> is for <strong>stateful applications</strong>, where Pods have unique identities, persistent storage, and the need for ordered scaling or updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gI4JSiH2XEHirFUJo-4cLw.png" /><figcaption>Difference between Deployment and Statefulset</figcaption></figure><ol><li><strong>How to create Deployment?<br></strong>vim deployment.yml</li></ol><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: nginx-deployment<br>spec:<br>  replicas: 3<br>  selector:<br>    matchLabels:<br>      app: nginx<br>  template:<br>    metadata:<br>      labels:<br>        app: nginx<br>    spec:<br>      containers:<br>      - name: nginx<br>        image: nginx:latest<br>        ports:<br>        - containerPort: 80<br><br></pre><p><strong>2. How to create yaml file for Replica sets<br></strong>vim replica.yml</p><pre>apiVersion: apps/v1<br>kind: ReplicaSet<br>metadata:<br>  name: my-replicaset<br>spec:<br>  replicas: 3  # Specify the number of Pods you want to run<br>  selector:<br>    matchLabels:<br>      app: my-app  # Pod label to identify the set of Pods<br>  template:<br>    metadata:<br>      labels:<br>        app: my-app  # Label that must match the selector<br>    spec:<br>      containers:<br>      - name: my-container<br>        image: nginx:latest  # Image to run in the container<br>        ports:<br>        - containerPort: 80  # Port to expose in the container</pre><p><strong>3. How to create yaml file for statefulset<br></strong>vim statefulset.yml</p><pre>apiVersion: apps/v1<br>kind: StatefulSet<br>metadata:<br>  name: my-statefulset<br>spec:<br>  serviceName: &quot;my-service&quot;  # The name of the service to be created for the StatefulSet<br>  replicas: 3  # The number of Pods to run<br>  selector:<br>    matchLabels:<br>      app: my-app  # Label selector for identifying Pods<br>  template:<br>    metadata:<br>      labels:<br>        app: my-app  # Label that should match the selector<br>    spec:<br>      containers:<br>      - name: my-container<br>        image: nginx:latest  # Image for the container<br>        ports:<br>        - containerPort: 80  # Port to expose inside the container<br>        volumeMounts:<br>        - name: my-storage<br>          mountPath: /data  # Mount the volume at /data<br>  volumeClaimTemplates:  # Create a persistent volume for each Pod<br>  - metadata:<br>      name: my-storage  # Volume name<br>    spec:<br>      accessModes: [ &quot;ReadWriteOnce&quot; ]  # Access mode for the volume<br>      resources:<br>        requests:<br>          storage: 1Gi  # Request 1Gi of storage for each Pod</pre><blockquote>Note: apiVersion of all deployment yaml file is <strong>apps/v1</strong><br>because these resources are part of the <strong>apps</strong> API group, which is designed to handle <strong>workload-related </strong>resources (i.e., managing Pods, scaling, updates, and persistent storage) in Kubernetes.</blockquote><h4>What to use when:</h4><ul><li><strong>ReplicaSet</strong>: Ensures that a specified number of identical Pods are running at all times. It’s commonly managed by a Deployment, but can be used independently for simple replication.</li><li><strong>Deployment</strong>: Ideal for stateless applications. Manages Pods, supports rolling updates, rollback, and ensures scalability and self-healing without the need for persistent storage.</li><li><strong>StatefulSet</strong>: Ideal for stateful applications, like databases, where each Pod has a stable identity and requires persistent storage.</li></ul><h4><strong>Commands:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YpDfV-lcmW2PqxogPjnXcA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d086f50412e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Kubernetes Helm: Simplifying Application Deployment]]></title>
            <link>https://medium.com/@payalpawale010/kubernetes-helm-c0db9390b1cc?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0db9390b1cc</guid>
            <category><![CDATA[helm-chart]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[helm]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes-helm]]></category>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Tue, 03 Dec 2024 16:06:54 GMT</pubDate>
            <atom:updated>2024-12-03T17:50:04.927Z</atom:updated>
            <content:encoded><![CDATA[<p>An essential tool for simplifying Kubernetes. When using Kubernetes for container management, we need to write multiple YAML files, such as a Pod for running containers, a Deployment for creating replicas, a Service for port management, and many more. Writing all these YAML files can be time-consuming and complex. This is where <strong>Helm</strong> comes to the rescue. Helm says, “Don’t worry about the YAML files — I will provide them for you; just customize them according to your needs.”</p><h4><strong>What is Kubernetes Helm?</strong></h4><p>Helm is a package manager for Kubernetes that provides a collection of YAML files required for deploying applications to a Kubernetes cluster.</p><p>A <strong>Helm chart</strong> is a packaged set of Kubernetes resources (like Pods, Deployments, Services, etc.) that can be easily installed, updated, and managed within a Kubernetes cluster.</p><h4>The key components of a <strong>Helm chart</strong> are:</h4><ol><li><strong>Chart.yaml</strong>:<br>This is the metadata file for the chart. It includes details like the chart name, version, description, and other important information about the chart.</li><li><strong>values.yaml</strong>:<br>This file contains the default configuration values for the chart. You can customize these values to configure the application to suit your needs, like setting image names, ports, replicas, and more.</li><li><strong>templates/</strong>:<br>The templates/ directory contains Kubernetes resource YAML files (like deployment.yaml, service.yaml, ingress.yaml,hpa.yaml). These files define the Kubernetes resources to be created when the chart is installed. The files in this directory contain placeholders that are replaced with values from values.yaml during installation.</li><li><strong>charts/</strong>:<br>This directory may contain other dependent charts. If your chart depends on other charts (for example, a database chart), they are listed here as subcharts.</li><li><strong>README.md (Optional)</strong>:<br>This is an optional file that provides documentation for the chart, explaining how to use it, configuration options, etc.</li></ol><h3>How Does Helm Work?</h3><ol><li><strong>Prerequisites to Use Helm</strong><br>You should have kubectl installed and properly configured to interact with your Kubernetes cluster.</li><li><strong>Installing Helm</strong><br>Let’s go ahead and install Helm.<br>This is a curl command to install helm on your system you can use EC2 instance to run.</li></ol><pre>curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3</pre><p>Inside this curl we have get_helm.sh file which is script to install a helm.<br>so we need to provide RWE permission to that file.</p><pre>chmod 700 get_helm.sh</pre><p>Execute the script<br>-./get_helm.sh this will execute get_helm.sh shell script located in current directory (./)</p><pre>./get_helm.sh</pre><p><strong>3. Create a Directory<br> </strong>Create a directory to store your Helm charts and related data</p><pre>mkdir helm-practice<br>cd helm-practice</pre><p><strong>4. Create a Helm Package<br></strong>Use the following command to create a Helm chart package. Replace &lt;specify the chart-name&gt; with your desired chart name.</p><pre>helm create &lt;chart-name&gt;</pre><p>Inside the chart directory, you will see multiple files and subdirectories, such as Chart.yaml, values.yaml, and templates/.</p><ul><li><strong>templates/</strong>: Contains the YAML files for Kubernetes resources like Deployment, Service, Ingress, and more.</li><li><strong>values.yaml</strong>: This file is where you specify configuration values to customize the Kubernetes application deployment, such as the Docker image, port, and other settings.</li></ul><p><strong>5. Update </strong><strong>values.yaml</strong></p><ul><li>Open the values.yaml file with vim values.yamlto update the configuration, here we can update image for your container, replicas for your container, server ports , etc.</li><li>After making your changes, navigate back to the <strong>helm-practice</strong> directory and install the Helm chart by specifying the chart name and new namespace name:</li></ul><pre>cd .. <br><br>helm install &lt;chart-name&gt;./&lt;chart-name&gt; --namespace &lt;namespace-name&gt; --create-namespace</pre><p><strong>6. verify:</strong><br> verify the pods are created and running</p><pre>kubectl get pods — namespace &lt;namespace_name&gt;</pre><p><strong>7.Port forward:</strong></p><pre>kubectl port-forward svc/&lt;service-name&gt; 8080:8000 -n &lt;namespace-name&gt;</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — see you :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0db9390b1cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Fundamentals]]></title>
            <link>https://medium.com/@payalpawale010/kubernetes-fundamentals-c26028e259c6?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/c26028e259c6</guid>
            <category><![CDATA[kubernetes-fundamentals]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Sat, 16 Nov 2024 15:53:06 GMT</pubDate>
            <atom:updated>2024-11-16T17:45:01.145Z</atom:updated>
            <content:encoded><![CDATA[<p>Kubernetes for DevOps</p><h4>What is kubernetes ?</h4><p>Kubernetes is a container orchestration platform designed to automate the scaling and management of containerized applications.</p><p>Key Functions of Kubernetes:</p><ol><li><strong>Autoscaling:</strong> It adjusts the number of running containers based on demand.</li><li><strong>Load Balancing:</strong> Distributes incoming traffic across multiple containers to ensure reliability.</li><li><strong>Self-healing: </strong>Automatically restarts failed containers or reschedules them to healthy nodes.</li><li><strong>Configuration management:</strong> Securely stores sensitive data and configuration</li></ol><h4>Why Kubernetes?</h4><p>Kubernetes solves problems that can arise in production. It is essential because it addresses challenges faced in production environments when managing containerized applications.</p><p>Problems faced without Kubernetes:</p><ol><li><strong>Manual Scaling:</strong> Manually scaling containers up and down based on traffic can be time-consuming.</li><li><strong>Lack of Fault Tolerance:</strong> Crashed containers are not automatically restarted, leading to downtime.</li><li><strong>Inefficient Resource Utilization:</strong> Resources are unevenly distributed across nodes, causing waste or overload.</li><li><strong>Complex Load Balancing:</strong> Traffic distribution must be handled manually, risking uneven workloads.</li></ol><h4>Kubernetes Architecture:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yAzaZPkMgNPV3UV07YcWXg.png" /><figcaption>Kubernetes Architecture</figcaption></figure><p>A Kubernetes cluster consists of one <strong>control plane</strong> (also known as the master node) and multiple <strong>worker nodes</strong> (or simply nodes).</p><h4><strong>Main Component of Kubernetes :</strong></h4><p>kubectl is the <strong>command-line tool</strong> used to interact with a Kubernetes cluster. It allows users to perform various tasks such as deploying applications, inspecting and managing cluster resources, and troubleshooting.</p><h4>Control Plane:</h4><ol><li><strong>API server:</strong><br>The API server is the main component of the control plane.<br>It acts as the central communication hub for almost all Kubernetes components. It interacts with the scheduler, the ETCD database, the controller manager, and worker nodes. <br>It processes REST requests and handles communication between the components of the control plane and the worker nodes.</li><li><strong>Scheduler: </strong><br>The scheduler is responsible for deciding which worker node.<br>It schedules containers based on resource requirements, policies, and available resources.<br>When the API server needs to schedule a container, it sends a request to the scheduler.</li><li><strong>etcd:</strong><br>ETCD is a key-value store used to store all cluster data, including configuration and state information. <br>It keeps track of everything happening in the cluster and ensures consistency.</li><li><strong>Control Manager:</strong><br>The controller manager is responsible for maintaining the desired state of the cluster. <br>It continuously monitors the state of the worker nodes and ensures that they are functioning properly. <br>If any worker node fails or encounters issues, the controller manager will take corrective action to ensure the cluster remains healthy.</li></ol><h4>Worker Node:</h4><p>Worker nodes are where the actual work happens. These nodes run the containerized applications.</p><ol><li><strong>Kubelet</strong>: <br>The Kubelet is an agent that runs on each worker node.<br>It ensures that the containers in the pods are running and healthy.<br>It communicates with the control plane and reports the status of the node and its containers.</li><li><strong>Kube / Sever Proxy:<br></strong>The Kube Proxy is responsible for managing network traffic between the user and the worker nodes. <br>It helps in load balancing and ensures that the requests are routed to the appropriate containers.</li><li><strong>Pods</strong>:<br>Pods are the smallest deployable units in Kubernetes, and they consist of one or more containers. <br>They are scheduled to run on worker nodes, and the kubelet ensures that containers in a pod are healthy.</li><li><strong>CNI (Container Network Interface)</strong>:<br>CNI is responsible for networking between the containers and worker nodes. It ensures that containers can communicate with each other within the cluster and with external systems.</li></ol><h4>Additional Components</h4><ol><li><strong>Namespaces</strong>:<br>Kubernetes supports the logical partitioning of the cluster into namespaces. Namespaces allow multiple users or teams to share a cluster while keeping their resources isolated.</li></ol><h4>Kubernetes setup on EC2 instance:</h4><ol><li>Create EC2 instancea and SSH on local terminal</li><li>Install Docker -&gt; sudo apt install -y docker.io <br> add user -&gt; sudo usermod -aG docker $USER<br> restart group-&gt;newgrp docker <br> check docker version-&gt; docker — — version</li><li>Install kind for k8s <br>install kind library-&gt; curl -Lo ./kind <a href="https://kind.sigs.k8s.io/dl/v0.18.0/kind-linux-amd64">https://kind.sigs.k8s.io/dl/v0.18.0/kind-linux-amd64</a><br>make it executable-&gt; chmod +x ./kind<br>move to specific path-&gt; sudo mv ./kind /usr/local/bin/kind<br>verify installation-&gt; kind — version</li><li>Install kubectl <br>curl -LO <a href="https://dl.k8s.io/release/v1.26.0/bin/linux/amd64/kubectl">https://dl.k8s.io/release/v1.26.0/bin/linux/amd64/kubectl</a><br>chmod +x ./kubectl<br>sudo mv ./kubectl /usr/local/bin/kubectl<br>sudo apt install -y kubectl<br>kubectl version</li></ol><h4>Common Kubectl Commands:</h4><ul><li>kubectl get – Lists resources (e.g., kubectl get pods to list all pods).</li><li>kubectl describe – Provides detailed information about a specific resource (e.g., kubectl describe pod &lt;pod_name&gt;).</li><li>kubectl apply – Applies a configuration to a resource (e.g., kubectl apply -f &lt;file.yaml&gt;).</li><li>kubectl delete – Deletes a resource (e.g., kubectl delete pod &lt;pod_name&gt;).</li><li>kubectl logs – Fetches logs for a pod or container (e.g., kubectl logs &lt;pod_name&gt;).</li><li>kubectl exec – Executes a command in a container (e.g., kubectl exec -it &lt;pod_name&gt; -- /bin/bash).</li></ul><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c26028e259c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Advance for DevOps]]></title>
            <link>https://medium.com/@payalpawale010/docker-advance-for-devops-c937117ab5b9?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/c937117ab5b9</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[multi-stage-dockerfile]]></category>
            <category><![CDATA[docker-registry]]></category>
            <category><![CDATA[docker-compose]]></category>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Sun, 10 Nov 2024 15:31:20 GMT</pubDate>
            <atom:updated>2024-11-10T15:40:11.607Z</atom:updated>
            <content:encoded><![CDATA[<p>Docker volume, Docker compose, Docker network, Docker multistage,</p><h4>A) Docker Volume</h4><p>Docker volumes are used to store data outside of the container, allowing persistent storage beyond the container’s lifecycle. This way, data remains available even if the container is restarted or removed.<br>Docker volumes are independent from docker container’s life.</p><h4>Types of Docker Volume:</h4><ol><li><strong>Named Volume: </strong>In Docker, a named volume is created first, and then the volume name is used to bind it to a specific path inside the container. This allows data to persist independently of the container’s lifecycle.<br><strong>Create docker volume:<br></strong>docker volume create &lt;volume_name&gt;<br><strong>Use named volume:<br></strong>docker run -d -v &lt;volume_name&gt;:/var/lib/mysql mysql:latest</li><li><strong>Unnamed volume: </strong>It is created in Docker without explicitly specifying a name. Docker automatically assigns a random name to this volume. You can inspect it to find its details, including its storage location or path on the host.<br>docker run -d -v /var/lib/mysql mysql:latest <br><br>In this command:<br><strong>/var/lib/mysql</strong>: This is the path inside the container where the unnamed volume will be mounted. Data written to this path will be stored in the unnamed volume.<br><strong>mysql:latest</strong>: This specifies the Docker image to use for creating the container.</li></ol><h4><strong>Creating Docker Volumes</strong></h4><p>1. To create a Docker volume, you can use the following command:<br>docker volume create &lt;volume_name&gt;</p><p>2. To list the volumes<br>docker ls</p><p>3. To inspects volumes<br>docker volume inspect &lt;volume_name&gt;</p><h4>B) Docker Networking</h4><p>In Docker, networking allows containers to communicate with each other and with external systems. This is essential when you have multiple services that need to interact.</p><p>For example, if you have two containers — one running a Java application and another running MySQL — the Java application needs to connect to the MySQL container to access the database. Docker networking provides the necessary connection to allow communication between these containers.</p><p>Create docker network<br>docker network create &lt;network_name&gt;</p><p>Use network to connect two containers<br>docker build -d --name mysql -e MYSQL_ROOT_DATABASE=root --network=&lt;network_name&gt; mysql:latest</p><p>docker build -d --name flask-app -e MYSQL_ROOT_DATABASE=root --network=&lt;network_name&gt; flask-app:latest</p><h4>Docker Network Types</h4><p><strong>Bridge (Default)<br>Description</strong>: This is the default network for containers when you don’t specify a network type. Containers on the default bridge network cannot communicate with each other by name unless they’re linked.<br><strong><br>Usage</strong>: Good for quick setups where container isolation is desired.</p><ol><li><strong>User-Defined Bridge<br>Description</strong>: This is a custom bridge network you create. Containers on the same user-defined bridge network can communicate with each other using container names as hostnames.<br><br><strong>Usage</strong>: Ideal for multi-container applications (e.g., Java and MySQL) that need to communicate with each other on the same Docker host.</li><li><strong>Host<br>Description</strong>: With host networking, the container shares the host’s network stack directly, which means there is no isolation between host and container network interfaces.<br><br><strong>Usage</strong>: Useful for high-performance networking needs, like applications that require very low latency, but it can reduce security since the container has direct access to the host network.</li><li><strong>Macvlan<br>Description</strong>: Macvlan networks allow you to assign MAC addresses to containers, making them appear as physical devices on the network. This allows containers to have their own MAC addresses and connect directly to the physical network.<br><br><strong>Usage</strong>: Suitable for legacy applications that expect a direct connection to the physical network, as it enables containers to bypass NAT.</li><li><strong>Ipvlan<br>Description</strong>: Similar to Macvlan, but with IP address management instead of MAC address management. Ipvlan allows containers to act as if they’re directly connected to the physical network, using unique IP addresses.<br><br><strong>Usage</strong>: Useful in environments that require more control over IP assignment without needing MAC address separation.</li><li><strong>Overlay<br>Description</strong>: This network type is used to connect containers across multiple Docker hosts, commonly used in Docker Swarm or Kubernetes clusters.<br><br><strong>Usage</strong>: Ideal for distributed applications or microservices that need to communicate across multiple servers.</li><li><strong>None<br>Description</strong>: The container has no network connection. This network type is useful if you want a fully isolated container with no network access.<br><br><strong>Usage</strong>: Often used for specialised tasks, like batch jobs, where network connectivity is unnecessary or should be restricted.</li></ol><h4>C) Docker compose</h4><p>In Docker Compose, we use YAML (Yet Another Markup Language) files. It uses key:value data format. This file allows us to define and run multiple containers simultaneously, specifying configurations such as environment variables, image names, ports, volumes, networks, and more.</p><p>To install Docker Compose, use the following command to install the latest version (v2):<br> sudo apt-get install docker-compose-v2</p><h4>Example:</h4><p>Creating a docker-compose.yml file from docker run commands</p><p>Here are the original docker run commands for reference:</p><pre>docker run -d --name flaskapp --network=twotier -e MYSQL_HOST=mysql -e MYSQL_USER=root -e MYSQL_PASSWORD=admin -e MYSQL_DB=mydb -p 5000:5000 flaskapp:latest<br>docker run -d --name mysql -v mysql-data:/var/lib/mysql --network=twotier -e MYSQL_DATABASE=mydb -e MYSQL_ROOT_PASSWORD=admin -p 3306:3306 mysql:5.7</pre><p>here’s a equivalent docker-compose.yaml file</p><pre><br>version: &quot;3.4&quot;<br><br>services:<br>  mysql:<br>    container_name: mysql<br>    image: mysql:5.7<br>    environment:<br>      MYSQL_DATABASE: mydb<br>      MYSQL_ROOT_PASSWORD: admin<br>    ports:<br>      - &quot;3306:3306&quot;<br>    networks:<br>      - twotier<br>    volumes:<br>      - mysql-data:/var/lib/mysql<br>    healthcheck:<br>      test: [&quot;CMD&quot;, &quot;mysqladmin&quot;, &quot;ping&quot;, &quot;-h&quot;, &quot;localhost&quot;, &quot;-uroot&quot;, &quot;-proot&quot;]<br>      interval: 10s<br>      timeout: 5s<br>      retries: 5<br>      start_period: 60s<br><br>  flaskapp:<br>    build:<br>      context: .<br>    container_name: flaskapp<br>    environment:<br>      MYSQL_HOST: mysql<br>      MYSQL_USER: root<br>      MYSQL_PASSWORD: admin<br>      MYSQL_DB: mydb<br>    ports:<br>      - &quot;5000:5000&quot;<br>    networks:<br>      - twotier<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;curl -f http://localhost:5000/health || exit 1&quot;]<br>      interval: 10s<br>      timeout: 5s<br>      retries: 5<br>      start_period: 30s<br><br>networks:<br>  twotier:<br><br>volumes:<br>  mysql-data:</pre><p>Explanation: Key Components in docker-compose.yml</p><ul><li><strong>version</strong>: Specifies the compose file format version (e.g., &quot;3.4&quot;).</li><li><strong>services</strong>: Defines the containers to run (e.g., mysql, flaskapp).</li><li><strong>container_name</strong>: Assigns a name to the container.</li><li><strong>image</strong>: Specifies the Docker image for the container.</li><li><strong>build</strong>:<br><strong>context: .</strong>: Builds the image from the Dockerfile if the image is not already present.</li><li><strong>environment</strong>: Sets environment variables for the container.</li><li><strong>ports</strong>: Maps container ports to host ports.</li><li><strong>networks</strong>: Connects the container to a specific network.</li><li><strong>volumes</strong>: Defines persistent storage for the container.</li></ul><p>Lists like ports, environment, and volumes are specified with - which denotes list of items.</p><p><strong>healthcheck</strong>: Defines how Docker should check the health of a container.</p><ul><li><strong>test</strong>: Specifies the command used to check the container’s health.</li><li><strong>MySQL Example</strong>:<br><strong>mysqladmin ping</strong> checks if the MySQL server is running and responsive.<br><strong>-h localhost</strong>: Checks the localhost (container itself).<br><strong>-uroot and </strong><strong>-proot</strong>: Uses the MySQL root user with the password root to authenticate.</li><li><strong>interval</strong>: Specifies the time between consecutive health checks (e.g., 10 seconds).</li><li><strong>timeout</strong>: Defines the maximum time allowed for the health check command to complete (e.g., 5 seconds).</li><li><strong>retries</strong>: The number of consecutive failed health checks before Docker marks the container as unhealthy (e.g., 5 retries).</li><li><strong>start_period</strong>: The grace period after the container starts during which health checks are not performed, allowing the container time to initialize (e.g., 60 seconds).</li></ul><h4>Running the Compose File</h4><ol><li>Save the file as docker-compose.yml.</li><li>Run the following command to build and start both containers in the background:</li></ol><pre>docker-compose up -d</pre><p>3. To stop and remove the containers, networks, and volumes :</p><pre>docker-compose down</pre><h4><strong>E) Docker Registory:</strong></h4><p>A Docker registry is a service where Docker images are stored, shared, and managed. It allows you to push and pull Docker images.</p><ul><li><strong>Docker Hub</strong>: The default public registry provided by Docker, where you can store and share images. Docker Hub allows users to push their images for public or private access.</li><li><strong>Push</strong>: To upload an image to a registry (e.g., Docker Hub), you use the docker push command.</li><li><strong>Pull</strong>: To download an image from a registry to your local machine, you use the docker pull command.</li></ul><p><strong>Example</strong>: To push an image to Docker Hub:</p><ol><li>First, tag the image with your repository:<br>docker tag flaskapp:latest yourusername/flaskapp:latest</li><li>Push the image to the registry: <br>docker push yourusername/flaskapp:latest</li></ol><h4><strong>Docker Registry vs Docker hub</strong></h4><p><strong>Docker Registry</strong>: A system for storing Docker images. It can be public or private.<br><strong>Docker Hub</strong>: A public Docker registry provided by Docker, where Docker images are stored and shared.</p><h4>F) Docker Muti-stage:</h4><p>Docker multi-stage is used to reduce the docker image size, help to creating <strong>more efficient images</strong> and <strong>reducing build times<br></strong>Multiple <strong>FROM </strong>are used, each represents separate build stage.</p><p>Here’s a shortened version of the explanation inside the Dockerfile itself:</p><pre># ------------------- Stage 1: Build Stage ------------------------------<br>#here using full Python image to install build dependencies, big in size<br>FROM python:3.9 AS builder<br><br>WORKDIR /app<br><br># Install build dependencies (gcc, libmysqlclient-dev, pkg-config)<br>RUN apt-get update &amp;&amp; \<br>    apt-get install -y --no-install-recommends gcc default-libmysqlclient-dev pkg-config &amp;&amp; \<br>    rm -rf /var/lib/apt/lists/*<br><br># Copying and installing Python dependencies from requirements.txt<br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br><br><br><br># ------------------- Stage 2: Final Stage ------------------------------<br># Using a slim Python image for a smaller final image<br>FROM python:3.9-slim<br><br>WORKDIR /app<br><br># Install only runtime dependency (libmariadb3)<br>RUN apt-get update &amp;&amp; \<br>    apt-get install -y --no-install-recommends libmariadb3 &amp;&amp; \<br>    rm -rf /var/lib/apt/lists/*<br><br># Copy Python dependencies and app code from the builder stage<br>COPY --from=builder /usr/local/lib/python3.9/site-packages/ /usr/local/lib/python3.9/site-packages/<br><br>#copying a code<br>COPY . .<br><br># Run the application<br>CMD [&quot;python&quot;, &quot;app.py&quot;]</pre><p>You can build this file with docker build command and check the size of image.</p><p>NOTE: Here I have used application of LondheShubham or trainwithshubham: <a href="https://github.com/LondheShubham153/two-tier-flask-app.git">https://github.com/LondheShubham153/two-tier-flask-app.git</a></p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —:)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c937117ab5b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Fundamentals]]></title>
            <link>https://medium.com/@payalpawale010/docker-fundamentals-8076fbecf006?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/8076fbecf006</guid>
            <category><![CDATA[docker-for-developer]]></category>
            <category><![CDATA[docker-for-beginner]]></category>
            <category><![CDATA[docker-fundamental]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Sat, 26 Oct 2024 16:18:57 GMT</pubDate>
            <atom:updated>2024-12-15T16:04:43.418Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Docker?</h3><p>Docker is a containerization tool that allows you to package applications and their dependencies into a standardized unit called a container. <br>This container can be built and run consistently on any machine that has Docker installed, ensuring that the application works seamlessly across different environments.</p><h4>Virtualization vs Containerization:</h4><p>both <strong>Virtualization</strong> and <strong>Containerization</strong> ultimately aim to <strong>isolate</strong> workloads and improve the efficiency of resource usage.<br>Below is a breakdown of <strong>how they operate</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5VskdXXWpe0DO2L1qUELw.png" /><figcaption>Virtualization vs Containerisatio</figcaption></figure><h3>Using Docker on an AWS Instance</h3><p>To utilize Docker on an AWS instance, you must first install the docker.io package. Here’s a step-by-step guide to get you started:</p><ol><li><strong>Update the Instance</strong>:<br>Ensure your package lists are up to date by running:<br>sudo apt-get update</li><li><strong>To install docker on AWS instance:<br></strong>To install Docker on your AWS instance, use the following command:<br>sudo apt-get install docker.io</li><li><strong>Check the Docker Version</strong>:<br>After installation, verify that Docker is installed correctly by checking its version:<br>docker --version<br>Expected output (Docker version 24.0.7,)</li><li><strong>Add the User to the Docker Group</strong>:<br>To allow the ubuntu user to run Docker commands without sudo, execute:<br>sudo usermod -aG docker ubuntu &amp;&amp; newgrp docker<br>usermod modifies the user; -a is for append; G specifies that you are modifying group membership. newgrp docker refreshes the group instead of requiring the user to log out and log back in.</li></ol><h3>Key Components of Docker</h3><h3>Docker Engine</h3><p>Docker Engine is the core component of the Docker platform that enables the creation and management of containers. It consists of the Docker Daemon ,Docker CLI and Container d.</p><h4><strong>1. Docker Daemon</strong></h4><p>The Docker Daemon (or dockerd) is the server-side component that runs in the background, managing Docker containers, images, and networks. It listens for commands from the Docker CLI and performs the requested actions.It uses conatiner d internally.</p><h4>2. Docker CLI</h4><p>The Docker Command Line Interface (CLI) allows users to interact with the Docker Daemon through terminal commands. It provides a user-friendly way to manage containers and images with commands like docker run, docker ps, and docker pull.</p><h4>3. Container d</h4><p>It is a CNCF tool to manage the containers. A Docker container is a lightweight, standalone package that includes everything needed to run a piece of software, such as application code, libraries, and dependencies. Containers provide isolation and can run consistently across different environments.</p><h3>Docker Architecture</h3><p><strong>Docker File → Docker Image → Docker Container</strong></p><p>A Docker <strong>image</strong> is created from a <strong>Dockerfile</strong>, which contains instructions on how to build the image. Once built, an image acts as a blueprint for creating <strong>Docker containers</strong>, which are runnable instances of that image.</p><p>Each container is an isolated environment, running a lightweight version of the application or service defined in the Dockerfile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwQMkp7TdvNS6M2jchluRw.png" /><figcaption>Simple diagram to remember commands</figcaption></figure><h4>Creating a Docker Image</h4><p>There are two main ways to create a Docker image:</p><ol><li><strong>Build from a Dockerfile</strong></li></ol><p>Use the docker build command to create a custom image from a Dockerfile: <br>docker build -t imageName .</p><p>The -t flag tags the image with a name and version (e.g., latest).</p><p><strong>2. Pull from Docker Hub</strong></p><p>Pull a pre-built image from Docker Hub using the docker pull command:<br>docker pull dockerImage:version</p><p>If the version is not mentioned, Docker pulls the latest version by default.</p><h4>Listing Docker Images</h4><p>To see all available Docker images on your system,<br>docker images</p><h4>Running Containers</h4><p>Once an image is built or pulled, you can start a container from it with the following commands:</p><ul><li><strong>Run in foreground</strong>:<br>docker run image_name:latest</li><li><strong>Run in detached (background) mode</strong>:<br>docker run -d image_name:latest</li></ul><h4>Listing Containers</h4><ul><li><strong>List currently running containers</strong>:<br>docker ps</li><li><strong>List all containers, including stopped ones</strong>:<br>docker ps -a</li></ul><h4>Removing Containers</h4><p>To delete or stop a container:</p><ul><li><strong>Stop a running container</strong>:<br>docker kill container_id</li><li><strong>Remove a container</strong>:<br>docker rm container_id</li></ul><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8076fbecf006" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git and Github for DevOps]]></title>
            <link>https://medium.com/@payalpawale010/git-and-github-for-devops-ff3c6c6ed463?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff3c6c6ed463</guid>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Sun, 20 Oct 2024 14:48:46 GMT</pubDate>
            <atom:updated>2024-10-20T14:48:46.144Z</atom:updated>
            <content:encoded><![CDATA[<h3>GIT — Global Information Tracker</h3><h4>What is Git?</h4><p>Git is a distributed version control system (VCS) used for tracking changes in source code during software development.</p><h4>Why is Git Required?</h4><p>Git enables multiple users to collaborate on the same project simultaneously, ensuring that everyone can contribute without overwriting each other’s work. <br>It maintains a complete history of changes.<br>Effectively manages different versions of the code, and facilitates branching and merging. This capability is especially useful when working across multiple environments. <br>If issues arise, reverting to a previous state is straightforward, allowing developers to address problems quickly.</p><h4>What is GitHub?</h4><p>GitHub is a platform that allows you to store, manage, and collaborate on code repositories. It provides a space for developers to share their projects, track changes, and work together efficiently.<br>Similarly GitLab and Bigbucket is available.</p><h3>Commands Used</h3><p>git init: This command initializes a new Git repository in the current folder.<br>git clone &quot;repoURL&quot;: This command clones a remote GitHub repository to your local machine.</p><p><strong>Untracked → Staging →Tracked </strong><br>When you create a new file, it starts in the untracked state. To move files from untracked to tracked, you need to add them to the staging area before pushing them to a tracked stage.</p><h3><strong>Moving from Untracked to Tracked</strong></h3><ul><li><strong>git add fileName</strong>: This command adds a single file from untracked to the staging area.</li><li><strong>git add .</strong>: This command adds all untracked files in the current directory to the staging area.</li><li><strong>git status</strong>: This command displays the current status of your repository, including which files are untracked, staged, or modified. It helps you understand what changes are pending and what files are ready to be committed.</li><li><strong>git commit -m &quot;commit message&quot;</strong>: This command is used to commit the files currently in the staging area to tracked. The -m flag allows you to include a commit message that describes the changes made.</li><li><strong>git restore fileName</strong>: This command can be used to restore a file if committed already.</li></ul><h3>Configure Git</h3><p>To configure Git with your identity, you need to set your author information. This is important for tracking who made changes in the repository.</p><ul><li><strong>git config --global user.name &quot;yourUserName&quot;</strong>: This command sets your name as the author for your commits.</li><li><strong>git config --global user.email &quot;yourEmailID&quot;</strong>: This command sets your email address associated with your commits.</li></ul><p>Using the --global flag ensures that these settings apply to all repositories on your system. If you want to set different credentials for a specific repository, you can omit the --global flag.</p><h3>Checking Commit History</h3><ul><li><strong>git log</strong>: This command displays the commit history for the current branch, showing detailed information about each commit, including the commit ID, author, date, and commit message.</li><li><strong>git log --oneline</strong>: This command provides a concise view of the commit history, displaying each commit on a single line with its abbreviated commit ID and message, making it easier to scan through the history.</li></ul><h3>Push and Pull to remote repository</h3><p>git push :This command uploads your local commits to the remote repository.<br>git pull:This command fetches changes from the remote repository and merges them into your local branch, ensuring your local copy is up to date.</p><h3>Branching in Git:</h3><p><strong>Master</strong> is the main branch from where we can create multiple branches.<br><strong>HEAD</strong> refers to the latest commit on the current branch. It acts as a pointer to the most recent commit, allowing you to track where you are in the commit history.</p><ul><li><strong>git checkout branchName</strong>: This command switches your working directory to the specified branch.</li><li><strong>git checkout -b newBranch</strong>: This command creates a new branch with the specified name and immediately switches to it. This is a convenient way to start working on a new feature or fix without affecting the main branch.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff3c6c6ed463" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git and Github for DevOps]]></title>
            <link>https://medium.com/@payalpawale010/git-and-github-for-devops-dab121881738?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/dab121881738</guid>
            <category><![CDATA[git-and-github]]></category>
            <category><![CDATA[git-fundamental]]></category>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Sun, 20 Oct 2024 14:48:21 GMT</pubDate>
            <atom:updated>2024-12-07T07:00:59.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*bOO08jYxYRX2DhIYAmuecw.png" /><figcaption>Source: google</figcaption></figure><h3>What is Git (Global Information Tracker)?</h3><ul><li><strong>Definition</strong>: Git is a distributed version control system that tracks changes in source code, enabling collaboration among developers.</li></ul><p><strong>Key Benefits</strong>:</p><ul><li><strong>Collaboration</strong>: Allows multiple developers to work on the same project without overwriting each other’s changes.</li><li><strong>History</strong>: Maintains a complete history of changes, making it easy to review and revert changes if needed.</li><li><strong>Version Management</strong>: Efficiently manages code versions through branching and merging.</li></ul><h3>What is GitHub?</h3><ul><li><strong>Definition</strong>: GitHub is a web-based platform for hosting Git repositories, facilitating collaboration, code sharing, and project management.</li><li><strong>Alternatives</strong>: Other platforms like GitLab and Bitbucket offer similar functionalities.</li></ul><h3>Key Git Commands</h3><p><strong>Initialization &amp; Cloning</strong>:</p><ul><li>git init: Initializes a new Git repository.</li><li>git clone &quot;repoURL&quot;: Clones a remote repository to your local machine.</li></ul><p><strong>Tracking Files</strong>:<br><strong>States</strong>: Files transition from untracked → staged → tracked.</p><ul><li>git add fileName: Adds a single file to the staging area.</li><li>git add .: Adds all changes in the current directory to the staging area.</li><li>git status: Displays the status of the repository, showing untracked, staged, and modified files.</li><li>git commit -m &quot;message&quot;: Commits staged changes with a descriptive message.</li></ul><p><strong>Restoring Changes</strong>:</p><ul><li>git restore fileName: It restores a file if committed already.</li></ul><p><strong>Configuring Git:<br></strong>To configure Git with your identity, This is important for tracking who made changes in the repository.</p><ul><li>git config --global user.name &quot;yourUserName&quot;</li><li>git config --global user.email &quot;yourEmailID&quot;</li></ul><p>Using the --global flag ensures that these settings apply to all repositories on your system. If you want to set different credentials for a specific repository, you can omit the --global flag.</p><h3>Viewing Commit History</h3><ul><li>git log: Displays detailed commit history.</li><li>git log --oneline: Provides a concise overview of commits.</li></ul><h3>Remote Repositories</h3><p><strong>Pushing and Pulling</strong>:</p><ul><li>git push: Uploads local commits to the remote repository.</li><li>git pull: Fetches and merges changes from the remote repository.</li></ul><h3>Branching in Git</h3><p><strong>Main Branch</strong>: The default branch is often named main or master.</p><p><strong>Branch Management</strong>:</p><ul><li>git checkout branchName: Switches to a specified branch.</li><li>git checkout -b newBranch: Creates and switches to a new branch.</li></ul><h3><strong>Git Ignore Files</strong>:</h3><p>A .gitignore file is used to specify intentionally untracked files that Git should ignore. This is particularly useful for keeping your repository clean and focused on relevant source code and resources.</p><h3>SSH Configuration to Easily Push and Pull Changes</h3><p>Here’s the content in a one-line format:</p><ol><li>Generate SSH keys: ssh-keygen</li><li>Check created keys: cd ~/.ssh</li><li>Copy public key: cat id_rsa.pub</li><li>Paste the public key to GitHub under “SSH and GPG keys”</li><li>Clone the repository: git clone &quot;SSH URL for repository&quot;</li><li>Now try push and pull changes.</li></ol><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dab121881738" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Day 2: Server connection, User management and Filtering technique (grep, awk, sed, find)]]></title>
            <link>https://medium.com/@payalpawale010/linux-day-2-server-connection-user-management-and-filtering-technique-grep-awk-sed-find-0fa5ae2e3b19?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/0fa5ae2e3b19</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[linux-commands]]></category>
            <category><![CDATA[linux-for-devops]]></category>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Wed, 16 Oct 2024 06:03:21 GMT</pubDate>
            <atom:updated>2024-12-06T15:57:52.761Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is Server Connection?</strong></p><p>A server connection refers to establishing a secure link between a client computer and a server, typically using protocols like SSH (Secure Shell) or SCP (Secure Copy Protocol). This connection allows users to manage the server remotely and access data stored on it securely.<br>To ensure secure access, public and private keys are used:</p><ul><li><strong>Client</strong>: Holds the private key.</li><li><strong>Server</strong>: Holds the public key.</li></ul><h4><strong>Steps To connect with Server using SSH:</strong></h4><ol><li><strong>Command to generate SSH keys:</strong></li></ol><pre>ssh-key gen</pre><p>(During instance creation, you can create and save a key pair.)</p><p><strong>2. Open SSH Client</strong>:</p><p>Terminal (Linux/macOS) or CMD/PowerShell (Windows) are common SSH clients.</p><p><strong>List Your Key to Check Permissions</strong>:<br>Use the following command to check the permissions of your private key:</p><pre>ls -l Batch_8_KEY.pem</pre><p><strong>3. Change Permissions to Provide Read-Only Access to the Owner</strong>:<br>Run this command to set the correct permissions:</p><pre>chmod 400 Batch_8_KEY.pem</pre><p><strong>4. Connect to Your Instance Using its Public DNS</strong>:<br>Use the following command to connect:</p><pre>ssh -i &quot;Batch_8_KEY.pem&quot; ubuntu@ec2-52-24-42-55.us-west-2.compute.amazonaws.com</pre><p><strong>Notes:</strong></p><ol><li>These steps can be found in the <strong>SSH client</strong> option when connecting to an EC2 instance.</li><li>If you have the <strong>private key</strong> of any server, you can use it to connect to that server.</li></ol><h4><strong>User management:</strong></h4><p>We need root user permissions to create new users</p><p><strong>There are three types of users in Linux:</strong><br>Root user: UID and GID number is 0<br>System user: UID and GID number range is 1 to 999<br>Normal user: UID and GID number range is 1000 to 60,000</p><p><strong>Commands:</strong></p><ul><li>id user1: To check UID and GID of a user.</li><li>sudo useradd -m user1: To create a user with a home directory.</li><li>sudo passwd user1: To set a password for the user.</li><li>cat /etc/passwd: To view all users.</li><li>sudo userdel -r user1: To delete a user and their home directory.</li><li>su user2: To switch to another user.</li></ul><h4>Group Management:</h4><p>we can create groups to manage similar users.</p><ul><li>sudo groupadd Group1: To create a new group Group1.</li><li>sudo usermod -aG Group1 user1: To add user user1 to the group Group1.</li><li>cat /etc/group: To view all groups.</li><li>sudo gpasswd -d user1 Group1: To remove a user from a group.</li><li>sudo groupdel Group1: To delete a group.</li></ul><h4>Package Management:</h4><ul><li>sudo apt update: To update the package lists (downloads and prepares the information).</li><li>sudo apt upgrade: To install the available updates for installed packages.</li><li>sudo apt-get install nginx: To install a specific package (e.g., Nginx).</li><li>sudo apt remove &lt;package_name&gt;: To remove a specific package.</li></ul><h4><strong>What is nginx server?</strong></h4><p>Nginx serves is a high-performance web server and a reverse proxy server. As a web server, it efficiently handles requests for static content (like HTML, CSS, and images). As a reverse proxy, it sits between client devices and backend servers, forwarding client requests to those backend servers and returning the responses back to the clients.</p><p>This setup allows Nginx to manage traffic, improve performance, enhance security, and distribute loads across multiple servers effectively.</p><ul><li>systemctl status nginx: To check whether the Nginx server is active or inactive.</li><li>sudo systemctl stop nginx: To stop the Nginx server during maintenance or configuration changes.</li><li>sudo systemctl start nginx: To start the Nginx server after making changes.</li></ul><h4><strong>Grep, awk, find and sid:</strong></h4><p><strong>grep</strong>: Used to search for text within files.<br><strong>awk </strong>: Used to search and manipulate text with patterns.<br><strong>find</strong>: Used to locate files and directories.<br><strong>sed </strong>: Stream editor, used for tasks like renaming or modifying text in files.</p><h4>Grep</h4><p><strong>Purpose</strong>: Used to search for specific text within files.</p><p><strong>Example</strong>:</p><ul><li>grep hello -r /hello/ubuntu: Searches recursively (-r) for the text &quot;hello&quot; in all files and directories under /hello/ubuntu.</li><li><strong>Case Sensitivity</strong>: By default, grep is case-sensitive. To make it case-insensitive, use the -i option:</li><li>grep -ir hello /: Searches for &quot;hello&quot; throughout the entire system without case sensitivity.</li></ul><h4>2. awk</h4><p><strong>Purpose</strong>: Used for pattern scanning and processing.</p><p><strong>Examples</strong>:</p><ul><li>awk &#39;/WARN/ {print $1}&#39; zookeeper.log: Searches for lines containing &quot;WARN&quot; in zookeeper.log and prints the first column.</li><li>awk &#39;/WARN/ {print NR, $1}&#39; zookeeper.log: Similar to the previous command but also prints the line number (NR) along with the first column.</li></ul><h4>3. find</h4><p><strong>Purpose</strong>: Used to locate files and directories based on specified criteria.</p><h4>4. sed</h4><p><strong>Purpose</strong>: Stream editor used for modifying files.</p><ul><li><strong>Example</strong>:</li><li>sed -i &#39;s/text123/***/g&#39; fname: Replaces all occurrences of &quot;text123&quot; with &quot;***&quot; in the file fname. The -i option indicates that the changes are to be made in place.</li></ul><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —:)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0fa5ae2e3b19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Day 1: Introduction To Linux]]></title>
            <link>https://medium.com/@payalpawale010/introduction-to-linux-d1bd2eb0d192?source=rss-f8d1dea01693------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1bd2eb0d192</guid>
            <category><![CDATA[linux-for-devops]]></category>
            <category><![CDATA[basic-linux-commands]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Payal]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 17:09:11 GMT</pubDate>
            <atom:updated>2024-12-14T14:08:58.074Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Let’s Start with Basics Linux Terms and commands</strong></p><p><strong>What is Linux?</strong><br>Linux is an operating system came from Unix family. It is free and open-source software operating system. 90% applications use Linux as operating system as it is fast and secure.</p><p><strong>Architecture</strong>: Application → Shell → Kernel → Hardware</p><ol><li>The user sends a request using the terminal, command line interface application.</li><li>The terminal sends this request to the shell.</li><li>The shell converts high-level input into low-level or binary code, which is machine-readable language.</li><li>The kernel reads that and performs the operation on the hardware.</li></ol><h4><strong>vim Editor:</strong></h4><p>vim is powerful text editor used in many unix like operating system for for programming and general text editing.</p><p>In this you can create, insert or modify text in the file.</p><ul><li>You can create vim file using vim<br>vim file_name</li><li>You can switch to Insert mode by pressing i (insert before the cursor), I (insert at the beginning of the line), a (insert after the cursor), or A (insert at the end of the line).</li><li>Press Esc to return to Normal mode.</li><li><strong>Command Mode</strong>: To save or quite</li><li>:w – Save the file (write).</li><li>:q – Quit Vim.</li><li>:wq – Save and quit.</li><li>:q! – Quit without saving changes.</li></ul><h4><strong>Basic Linux Commands Used in DevOps:</strong></h4><ol><li>pwd : Present Working Directory: Used to check current directory.</li><li>cd : Change Directory: used to changes the path<br>cd ..: Used to come back by once.<br>cd~: Used to got back on root directory</li><li>mkdir dirName: To create a directory.<br>mkdir dir1 dir2: To create multiple directories.<br>mkdir -p dir1/child1 dir3/child3: To create parent and child directories at once.</li><li>touch fileName: To create a file.<br>touch fn1 fn2 fn3: To create multiple files.</li><li>ls: To list the contents of a directory.<br>ls -l: To list files with details like name, last modified date/time, size, and permissions. <br>Directories start with d, and regular files with -. and a file starting with an l (lowercase L) is a symbolic link.</li><li>echo &quot;Hello World&quot; &gt; file_name: To add content to a file (overwrites the file).<br>echo &quot;Welcome&quot; &gt;&gt; file_name: To append content to the end of a file.<br>echo -e &quot;1\n2\n3&quot; &gt; num.txt: To use escape characters like \n (newline) and write to a file.</li><li>cat f_name: To display file content or concatenate files.<br>cat -n f_name: Adds line numbers to all lines.<br>cat -b f_name: Adds line numbers to non-blank lines.<br>cat -s f_name: Squeezes multiple blank lines into one.<br>cat -e f_name: Adds $ at the end of each line.<br>cat f_name | sort: To view the content in alphabetical order.</li><li>head -3 f_name: To view the first 3 lines from a file.<br>tail -3 f_name: To view the last 3 lines from a file.<br>head -3 f_name | tac: To view the first 3 lines in reverse order (3rd, 2nd, 1st).</li><li>chmod: Used to set permissions for owner, group, and others.<br><strong>Permissions:<br></strong>r (read) = 4<br>w (write) = 2 <br>x (execute) = 1<br><strong>Combined permissions:<br></strong>rwx = 7<br>rw = 6<br>rx = 5<br><br>chmod 777 f_name: To give full access (read, write, execute) to the owner, group, and others.</li><li>history 5: To view the last 5 commands used in the terminal.</li><li>rm file_name: To remove a file.<br>rm -r dir_name: To remove a directory and all its contents without confirmation.<br>rm -ri dir_name: To remove a directory and its contents, asking for confirmation before each deletion.</li></ol><h4><strong>Hierarchy of Linux File System:</strong></h4><p>/: Root directory.</p><p>Inside /, there are several key directories:</p><ul><li>/root: Home directory for the superuser (root).</li><li>/home: Contains user directories (e.g., /home/ubuntu for user work).</li><li>/bin: Contains essential user commands (e.g., man, ls, cp).</li><li>/sbin: Contains system administration binaries (e.g., reboot, ifconfig).</li><li>/dev: Contains device files (e.g., for hardware like USB devices, hard drives).</li><li>/boot: Contains boot files (e.g., kernel files, bootloader).</li><li>/lost+found: Stores recovered files after a filesystem check.</li></ul><h4>Package managers in linux: APT vs YUM</h4><p>Both <strong>APT</strong> and <strong>YUM</strong> are package managers used to manage software installations, updates, and removals on Linux systems. However, they work with different types of package formats and are used on different Linux distributions.</p><p>sudo apt update &lt;s/w name&gt;<br>sudo apt install &lt;s/w name&gt;</p><p>sudo yum update &lt;s/w name&gt;<br>sudo yum install &lt;s/w name&gt;</p><p>The Difference between apt and yum is : APT works with .deb packages, while YUM works with .rpm packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-46WVTvE74dQdSu0LshvFg.png" /><figcaption>apt vs yum</figcaption></figure><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — see you :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1bd2eb0d192" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>