<?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 Ashish Kumar on Medium]]></title>
        <description><![CDATA[Stories by Ashish Kumar on Medium]]></description>
        <link>https://medium.com/@ashishkr3246?source=rss-22b7333bfb97------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EwCR4dzfIvogbHZUMT8OBw.png</url>
            <title>Stories by Ashish Kumar on Medium</title>
            <link>https://medium.com/@ashishkr3246?source=rss-22b7333bfb97------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:15:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ashishkr3246/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[Deployed a Reddit Clone on Kubernetes with Ingress Enabled]]></title>
            <link>https://medium.com/@ashishkr3246/deployed-a-reddit-clone-on-kubernetes-with-ingress-enabled-f566e7793053?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/f566e7793053</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Tue, 27 Jun 2023 07:33:18 GMT</pubDate>
            <atom:updated>2023-06-27T07:33:18.618Z</atom:updated>
            <content:encoded><![CDATA[<h3>TABLE OF CONTENTS</h3><ol><li><strong>Setup CI Part</strong></li></ol><p>&gt;&gt; Clone Source Code</p><p>&gt;&gt; Install Docker &amp; Build Image</p><p>&gt;&gt; Containerize the Application Using Docker</p><p>&gt;&gt; Push the Image To DockerHub</p><p><strong>2. Setup CD Part</strong></p><p>&gt;&gt; Write the Kubernetes Manifest file</p><p>&gt;.. Write Deployment.yml &amp; Service.yml file</p><p>&gt;&gt; Deploy the app to Kubernetes &amp; Create a Service for it</p><p><strong>3. Configure Ingress &amp; Expose the app</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f9NyV9nhlLER8SGFjmfq-g.png" /></figure><h3>Prerequisite:</h3><p>&gt;&gt; Take two Servers for CI part(t2.micro) &amp; for CD Part(t2.medium)</p><p>&gt;&gt; Create one account on DockerHub(Ignore if you already have)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BL0qGv9BVZBjtMjg1JqXpA.png" /></figure><h4>CI Part Configuration</h4><pre># Connect your Server<br>ssh -i &quot;ashish-aws1.pem&quot; ubuntu@ec2-54-173-98-28.compute-1.amazonaws.com<br><br># For Docker Installation<br>sudo apt-get update<br>sudo apt-get install docker.io -y<br>sudo usermod -aG docker $USER &amp;&amp; newgrp docker<br><br># Clone the Source Code<br>git clone https://github.com/ashish-kumar-hit/reddit-clone-k8s-ingress.git<br><br>cd reddit-clone-k8s-ingress<br>cat Dockerfile<br><br># Build Docker Image<br>docker built -t &lt;DockerHub Username&gt;/&lt;Imagename&gt; .<br><br># Push the Image To DockerHub<br>docker login<br>docker push &lt;DockerHub Username&gt;/&lt;imagename&gt;</pre><h4>CD Part Configuration</h4><h3>Write a Kubernetes Manifest File</h3><p>Now, You might be wondering what this manifest file in Kubernetes is. Don’t worry, I’ll tell you in brief.</p><p>When you are going to deploy to Kubernetes or create Kubernetes resources like a pod, replica-set, config map, secret, deployment, etc, you need to write a file called manifest that describes that object and its attributes either in yaml or json. Just like you do in the ansible playbook.</p><p>Of course, you can create those objects by using just the command line, but the recommended way is to write a file so that you can version control it and use it in a repeatable way.</p><pre># Install Docker &amp; Minikube on your server<br><br># For Docker Installation<br>sudo apt-get update<br>sudo apt-get install docker.io -y<br>sudo usermod -aG docker $USER &amp;&amp; newgrp docker<br><br># For Minikube &amp; Kubectl<br>curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64<br>sudo install minikube-linux-amd64 /usr/local/bin/minikube <br><br>sudo snap install kubectl --classic<br>minikube start --driver=docker<br><br>mkdir k8s<br>cd k8s/</pre><p><strong>vim Deployment.yml file</strong></p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: reddit-clone-deployment<br>  labels:<br>    app: reddit-clone<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: reddit-clone<br>  template:<br>    metadata:<br>      labels:<br>        app: reddit-clone<br>    spec:<br>      containers:<br>      - name: reddit-clone<br>        image: ashishkr3246/reddit-clone<br>        ports:<br>        - containerPort: 3000</pre><p><strong>vim Service.yml file</strong></p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: reddit-clone-service<br>  labels:<br>    app: reddit-clone<br>spec:<br>  type: NodePort<br>  ports:<br>  - port: 3000<br>    targetPort: 3000<br>    nodePort: 31000<br>  selector:<br>    app: reddit-clone</pre><h3>Deploy the app to Kubernetes &amp; Create a Service For It</h3><pre>&gt;&gt; kubectl apply -f Deployment.yml<br>&gt;&gt; kubectl apply -f Service.yml<br><br># Check your deployment &amp; Service<br>kubectl get deployment<br>kubectl get service<br><br>kubectl get pods</pre><h3><strong>Configure Ingress &amp; Expose the app</strong></h3><h3>Ingress:</h3><p>Pods and services in Kubernetes have their own IP; however, it is normally not the interface you’d provide to the external internet. Though there is a service with node IP configured, the port in the node IP can’t be duplicated among the services. It is cumbersome to decide which port to manage with which service. Furthermore, the node comes and goes, it wouldn’t be clever to provide a static node IP to an external service. Ingress defines a set of rules that allows the inbound connection to access Kubernetes cluster services. It brings the traffic into the cluster at L7 and allocates and forwards a port on each VM to the service port. This is shown in the following figure. We define a set of rules and post them as source type ingress to the API server. When the traffic comes in, the ingress controller will then fulfill and route the ingress by the ingress rules. As shown in the following figure, ingress is used to route external traffic to the Kubernetes endpoints by different URLs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/0*zqoXgMWSIULrsmMG.png" /></figure><p><strong>vim ingress.yml</strong></p><pre>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  name: ingress-reddit-app<br>spec:<br>  rules:<br>  - host: &quot;domain.com&quot;<br>    http:<br>      paths:<br>      - pathType: Prefix<br>        path: &quot;/test&quot;<br>        backend:<br>          service:<br>            name: reddit-clone-service<br>            port:<br>              number: 3000<br>  - host: &quot;*.domain.com&quot;<br>    http:<br>      paths:<br>      - pathType: Prefix<br>        path: &quot;/test&quot;<br>        backend:<br>          service:<br>            name: reddit-clone-service<br>            port:<br>              number: 3000</pre><pre># Enable minikube ingress<br>minikube addons enable ingress<br><br># Check Current settings of addons in minikube<br>minikube addons list<br><br>kubectl apply -f ingress.yml<br>kubectl get ingress</pre><h3>Expose the app</h3><ol><li>First We need to expose our deployment so use kubectl expose deployment reddit-clone-deployment --type=NodePort command.</li><li>You can test your deployment using curl -L <a href="http://192.168.49.2:31000/">http://192.168.49.2:31000</a>. 192.168.49.2 is a minikube ip &amp; Port 31000 is defined in Service.yml</li><li>Then We have to expose our app service kubectl port-forward svc/reddit-clone-service 3000:3000 --address 0.0.0.0 &amp;</li></ol><h3>Test Ingress</h3><p>Now It’s time to test your ingress so use the <em>curl -L domain.com/test</em> command in the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fh9ZQEHmX4DWVABDIaaq2A.png" /></figure><p>You can also see the deployed application on Ec2_ip:3000</p><p><em>Note:- Make sure you open the 3000 port in a security group of your Ec2 Instance.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ekzK-4b9jRD0qRxd" /></figure><p>You have successfully Deployed a Reddit Copy on Kubernetes with Ingress Enabled.</p><p>Thanks all. Good luck out there!</p><p>Follow for more such amazing content :)</p><p>Happy Learning 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f566e7793053" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEEK 9: K8’s Advance]]></title>
            <link>https://medium.com/@ashishkr3246/week-9-k8s-advance-ad1732468733?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad1732468733</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Fri, 16 Jun 2023 07:21:59 GMT</pubDate>
            <atom:updated>2023-06-16T07:28:15.645Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>TASKS:</strong></p><ol><li>Create a configMap and access its non-confidential data inside pods</li><li>Create a secret and access its sensitive data inside pods.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L3c_vGdaS0bCcg2bJG94Qw.png" /></figure><p><strong>ConfigMaps</strong></p><p>A ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume.</p><p>A ConfigMap allows you to decouple environment-specific configuration from your container images so that your applications are easily portable.</p><p>We can use one ConfigMap in multiple pods by giving the same levels to all the pods.</p><pre>&gt;&gt; cd devops<br>&gt;&gt; mkdir config_k8s</pre><p><strong>》vim configMap.yaml</strong></p><pre>apiVersion: v1<br>kind: ConfigMap<br>metadata:<br>  name: devops-demo-dev<br>data:<br>  # these are the datas which you are going to deliver to pods<br>  levels: &quot;14&quot;<br>  level_properties_file_name: &quot;lol.properties&quot;<br><br>  # file-like keys<br>  level.properties: |<br>    level.types=easy,medium,hard<br>    level.maximum-level=12</pre><pre>&gt;&gt; kubectl apply -f confifMap.yaml<br># kubectl create (use it which executing the first time)<br># kubectl apply (It will work in both the case while executing the first time<br> or updating the files)<br>&gt;&gt; kubectl get configmap</pre><p><strong>》vim devops-demo-pod.yaml</strong></p><pre>apiVersion: v1<br><br>kind: Pod<br><br>metadata:<br><br>  name: devops-demo-pod<br><br>spec:<br><br>  containers:<br><br>    - name: demo-docker-container<br><br>      image: alpine<br><br>      command: [ &quot;sleep&quot;, &quot;3600&quot; ]<br><br>      env:<br><br>        # Define the environment variable<br><br>        - name: levels<br><br>          valueFrom:<br><br>            configMapKeyRef:<br><br>              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY<br><br>              name: devops-demo-dev<br><br>              # Specify the key associated with the value<br><br>              key: levels<br><br>        - name: LEVELS_PROPERTIES_FILE_NAME<br><br>          valueFrom:<br><br>            configMapKeyRef:<br><br>              name: devops-demo-dev<br><br>              # Specify the key associated with the value<br><br>              key: level_properties_file_name<br><br>      volumeMounts:<br>        - name: config-volume<br>          mountPath: /config<br>          readOnly: true<br><br>  volumes:<br>    - name: config-volume<br>      configMap:<br>        name: devops-demo-dev<br>        items:<br>          - key: &quot;level.properties&quot;<br>            path: &quot;level.properties&quot;</pre><pre>&gt;&gt; kubectl apply -f devops-demo-pod.yaml<br>&gt;&gt; kubectl exec –it devops-demo-pod - /bin/sh<br>&gt;&gt; printenv<br>&gt;&gt; echo $levels<br>&gt;&gt; exit<br>&gt;&gt; minikube ssh<br>&gt;&gt; docker exec -it &lt;con-id&gt; sh<br>&gt;&gt; echo $labels</pre><p><strong>Secrets</strong></p><p>A Secret is an object that contains a small amount of sensitive data such as a password, a token, or a key. Such information might otherwise be put in a Pod specification or in a container image. Using a Secret means that you don’t need to include confidential data in your application code.</p><pre>&gt;&gt; echo -n &quot;test@123&quot; | base64<br>&gt;&gt; mkdir mysql_k8s<br>&gt;&gt; cd mysql_k8s/</pre><p><strong>》vim secret.yml</strong></p><pre>apiVersion: v1<br>kind: Secret<br>metadata:<br>  name: mysql-secrets<br>type: Opaque<br>data:<br>  ROOT_PASSWORD: dGVzdEAxMjM=</pre><p>&gt;&gt; kubectl apply -f secret.yml</p><p><strong>》vim deployment.yaml</strong></p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: mysql-deployment<br>  labels:<br>    app: mysql<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: mysql<br>  template:<br>    metadata:<br>      labels:<br>        app: mysql<br>    spec:<br>      containers:<br>        - name: mysql<br>          image: mysql:5.7.41<br>          ports:<br>            - containerPort: 3306<br>          volumeMounts:<br>            - name: mysql<br>              mountPath: &quot;/var/lib/mysql&quot;<br>              subPath: &quot;mysql&quot;<br>          env:<br>            - name: MYSQL_ROOT_PASSWORD<br>              valueFrom:<br>                secretKeyRef:<br>                  name: mysql-secrets<br>                  key: ROOT_PASSWORD<br><br>      volumes:<br>        - name: mysql<br>          persistentVolumeClaim:<br>            claimName: mysql-data-disk</pre><p><strong>》vim persistentVolumeClaim.yaml</strong></p><pre>apiVersion: v1<br>kind: PersistentVolumeClaim<br>metadata:<br>  name: mysql-data-disk<br>spec:<br>  accessModes:<br>    - ReadWriteOnce<br>  resources:<br>    requests:<br>      storage: 1Gi</pre><pre>&gt;&gt; kubectl apply -f persistentVolumeClaim.yaml<br>&gt;&gt; kubectl get persistentVolumeClaim<br>&gt;&gt; kubectl apply -f deployment.yaml<br>&gt;&gt; kubectl get pods -o wide</pre><p><strong>Some Important commands for troubleshooting</strong></p><pre>&gt;&gt; netstat -tnlp<br>&gt;&gt; df -TH<br>&gt;&gt; kubectl describe pod/&lt;pod-id&gt;<br>&gt;&gt; kubectl describe deploy &lt;deployment id&gt;<br>&gt;&gt; kubectl get all<br><br># For Application use logs &amp; for pods or containers use describe</pre><p><strong>vim service.yaml</strong></p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: mysql-service<br>spec:<br>  type: NodePort<br>  selector:<br>    app: mysql<br>  ports:<br>    - protocol: TCP<br>      port: 3306<br>      nodePort: 30036<br>      targetPort: 3306</pre><pre>&gt;&gt; kubectl apply -f service.yaml<br><br># Check url<br>&gt;&gt; minikube service mysql-service url<br>&gt;&gt; kubectl get pods<br>&gt;&gt; kubectl get deployment<br>&gt;&gt; kubectl get svc<br>&gt;&gt; sudo apt-get install mysql-client<br># We want to run client externally<br>&gt;&gt; mysql -u root -p -h &lt;port-id&gt; -p 30036</pre><p>Thanks for reading my blog!!!!!!!</p><p>Please reach out in case you have any queries &amp; questions related to this……..</p><p><strong>E-mail: </strong>ashishkr2346@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad1732468733" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEEK 8: KUBERNETES BASICS]]></title>
            <link>https://medium.com/@ashishkr3246/week-8-kubernetes-basics-a476462eca9c?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/a476462eca9c</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[yaml]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Fri, 09 Jun 2023 13:06:21 GMT</pubDate>
            <atom:updated>2023-06-09T13:06:21.096Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>What is Kubernetes?</strong></h4><p>Kubernetes is an open-source orchestration tool developed by Google for managing micro-services or containerized applications across a distributed cluster of nodes.</p><h4><strong>What is Orchestration Do?</strong></h4><pre>&gt;&gt; Configuring and scheduling of containers.<br>&gt;&gt; Provisioning and deployment of containers.<br>&gt;&gt; AutoScaling &amp; AutoHealing of containers.<br>&gt;&gt; Securing the connections between containers.<br>&gt;&gt; Load balancing, traffic routing and service discovery of conatiners.<br>&gt;&gt; Health monitoring of containers.</pre><h4><strong>Kubernetes Components and Architecture</strong></h4><p><strong>K8s Master Node:</strong> The master Server that will create the cluster and it has all the components and service that manage, plan, schedule and monitor all the worker nodes.</p><p><strong>Worker Node:</strong> The server that has host the applications as pods and containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fZ-q9oC9W_U4O6qWGvhPhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*41Tg3p0U7-M9FpS88BKh4Q.png" /></figure><h4><strong>Kubernetes Master Node Components</strong></h4><blockquote><strong>API server(Entry Point to k8’s cluster):</strong> It is the primary management component of Kubernetes and is responsible for orchestrating all operations(Scaling, updates, and so on) in the cluster. so the API server must be accessible by clients from outside the cluster integration with CLI and GUI.</blockquote><blockquote><strong>Controller-manager(Keeps track of what’s happening in the cluster):</strong> The Controller manager is the engine that runs the core control loops, creates pods, watches the status of the cluster, and makes changes to drive status toward the desired state.</blockquote><blockquote><strong>Scheduler(Ensures pods placement):</strong> Identity the right node to place a container based on resource limitations.</blockquote><blockquote><strong>etcd cluster(Kubernetes backup database store):</strong> etcd database that stores the state of the cluster, including node and workload information in the key/value format.</blockquote><h4>Node (worker) components</h4><blockquote><strong>Kubelet:</strong> the main service on a node, connect between Master and Node and ensuring the pods and their containers are healthy and running in the desired state. This component also reports to the master on the health of the host where it is running.</blockquote><blockquote><strong>kube-proxy:</strong> A proxy service that runs on each worker node to deal with individual host subnetting and expose services to the external world. It performs request forwarding to the correct pods/containers across the various isolated network in the cluster.</blockquote><blockquote>Note: The user can’t talk with a service proxy directly.</blockquote><blockquote>Example: If you want to book a ticket then you can’t go inside the irctc office you will book the ticket from the irctc website. It’s a kind of endpoint.</blockquote><p><strong>Kubectl</strong></p><p>kubectl command is a line tool that interacts with kube-apiServer and sends commands to the master node. Each command is converted into a API call.</p><p><strong>Cluster</strong></p><p>Cluster is a group of Server (Master + worker)</p><p><strong>Minikube</strong></p><p><strong>Download Minikube:</strong> <a href="https://minikube.sigs.k8s.io/docs/start/">https://minikube.sigs.k8s.io/docs/start/</a></p><p><strong>What is Minikube ??</strong></p><p>Minikube is basically an encapsulation inside which Kubernetes, master &amp; worker is running. It’s a local version of Kubernetes</p><p># copy &amp; paste installation command of minikube on your Linux machine<br># Now your server becomes a Kubernetes server<br># minikube is having docker architecture image which it is going to run and make k8s container</p><pre>》minikube start<br>》sudo apt update<br>》sudo apt install docker.io<br>》minikube start –driver=docker<br>》sudo usermod -aG docker $USER &amp;&amp; newgrp docker<br>》minikube start –driver=docker<br>》printenv<br>》minikube ssh<br># to know what all services running inside it#<br>》sudo docker ps #To know what container are running.<br>》exit<br>》kubectl get po -A<br>》sudo snap install kubectl –classic<br># snap is a tool to install<br>》ls<br>》ls -a<br>》kubectl get pods -A<br>》kubectl get po -A<br>》sudo snap install kubectl - classic<br>》kubectl get po -A<br>》minikube status<br>》kubectl get node<br><br>》mkdir devops<br>》cd devops/<br>》mkdir k8s<br>》cd k8s</pre><p><strong>》vim pod.yaml</strong></p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: todo-pod<br>  labels:<br>    app: react-app<br>spec:<br>  containers:<br>    - name: react-django-app<br>      image: ashishkr3246/todo-app:latest<br>      ports:<br>        - containerPort: 8001</pre><pre>》kubectl apply -f pod.yaml<br>》kubectl get pods<br>》kubectl get pods -o wide<br>》curl -L http://pod-ip:8001<br># Since these pods are not publicly accessible, we can&#39;t access these pods here.<br>》minikube ssh<br>》curl -L http://pod-ip:8001<br>》docker ps<br>》docker exec -it &lt;container id&gt; bash<br>》exit<br>》exit<br>》kubectl delete pods todo-pod<br>》kubectl get pods<br>Here, Anyone can delete these pods but our purpose is to deploy the pods in such a way so that we will face minimal down time.</pre><p><strong>》vim deployment.yaml</strong></p><p><strong>Purpose: AutoScaling &amp; AutoHealing</strong></p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: react-app-deployment<br>  labels:<br>    app: react-todo<br>spec:<br>  replicas: 3<br>  selector:<br>    matchLabels:<br>      app: react-todo<br>  template:<br>    metadata:<br>      labels:<br>        app: react-todo<br>    spec:<br>      containers:<br>        - name: react-todo<br>          image: ashishkr3246/todo-app:latest<br><br>          ports:<br>            - containerPort: 8001</pre><p><strong>Note:</strong> Deployment &amp; Selector levels must be same</p><pre>》kubectl apply -f deployment.yaml<br># -f means apply a file<br>》kubectl get pods<br>》kubectl get pods -o wide<br># Get more details about pod like ip<br>》curl -L http://&lt;pod-ip:8001&gt;<br>》minikube ssh<br>》curl -L http://&lt;pod-ip:8001&gt;<br>》kubectl delete pods react-pod<br>》kubectl get pods</pre><p><strong>Service.yaml</strong></p><p>To manage IPs</p><p><strong>Note:</strong> Please make sure that selector of service.yaml will match with label of deployment.yaml file.</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: react-todo-service<br>spec:<br>  type: NodePort<br>  selector:<br>    app: react-todo<br>  ports:<br>      # By default and for convenience, the `targetPort` is set to the same value as the `port` field.<br>    - port: 80<br>      targetPort: 8001<br>      # Optional field<br>      # By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)<br>      nodePort: 30007</pre><pre>》kubectl apply -f service.yaml<br>》kubectl get svc<br>》minikube service react-todo-service –url</pre><p>Thanks for reading my blog!!!!!!!</p><p>Please reach out in case you have any queries &amp; questions related to this……..</p><p><strong>E-mail: </strong>ashishkr2346@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a476462eca9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEEK 7: DOCKER SWARM & COMPOSE]]></title>
            <link>https://medium.com/@ashishkr3246/docker-swarm-compose-11ed0ec25cc7?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/11ed0ec25cc7</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 05:34:47 GMT</pubDate>
            <atom:updated>2023-06-15T09:06:25.910Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>TASKS:</strong></h3><ol><li>Deploy your Applications using Docker Swarm</li><li>Make a service &amp; run multiple tasks inside that service using Docker Compose</li></ol><h3><strong><em>DOCKER SWARM</em></strong></h3><p>A Docker Swarm is a container orchestration tool running the Docker application. It has been configured to join together in a cluster. The activities of the cluster are controlled by a swarm manager, and machines that have joined the cluster are referred to as nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*r_yLVUhkie0qUfKAmgCujw.jpeg" /></figure><p><strong>Purpose: AutoScaling &amp; AutoHealing</strong></p><h4><strong><em>Prerequisites</em></strong></h4><p>&gt;&gt; Create 3 instances<br>&gt;&gt; Install docker in every instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ttcpj8ZUHWqSISGcj1cbGA.png" /></figure><p><strong><em>Steps:</em></strong><br><br># Go to the master instance<br>&gt;&gt; sudo docker swarm init # To make this node as manager</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mcb8dtg_RbbB6WT-giD-Ng.png" /></figure><p>&gt;&gt; sudo docker swarm leave — force # To leave swarm manager</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ntAwgkKIMm5drM_3kFfgRA.png" /></figure><p>Note:</p><ol><li>On the worker node, you need to run this command to join the master or swarm manager node.</li><li>In order to join the swarm we need to open port 2377 on our master &amp; worker nodes.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VbgrLqt71JrJZhiJehe8Kw.png" /></figure><p>&gt;&gt; sudo docker swarm join — token &lt;id&gt; # To Join Swarm manager</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cTg6qaCTA2D4CRLoZDsSyg.png" /></figure><p>&gt;&gt; sudo docker node ls # It shows leader &amp; workers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LyqL3IMHI6O7Yas1omuk5Q.png" /></figure><p>&gt;&gt; sudo docker info # It will show the current status of your docker<br>&gt;&gt; free -h # To see free space</p><p><strong><em>Docker Service</em></strong><br>&gt;&gt; sudo docker service create –name django-app-service –replicas 3 –publish 8001:8001 ashishkr3246/react-django-app:latest</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3X2NX7FLvXtkqB_0TJLIIg.png" /></figure><p>&gt;&gt; sudo docker service ls <br>&gt;&gt; sudo docker service rm &lt;service-name&gt; # To delete service<br>&gt;&gt; sudo docker ps<br>Now check on workers also everywhere you will get service up<br>&gt;&gt; sudo docker swarm leave<br># Leader can remove the worker anytime or the worker can also leave anytime.</p><p><strong>Note:</strong> If you delete any container on any node then it will be autohealed by other nodes instantly.</p><h3>DOCKER COMPOSE</h3><p><a href="https://docs.docker.com/compose/">Docker Compose</a> is a tool that was developed to define and run multi-container applications. With Compose, we can create a YAML file to define the services, each with its own container, and specify how these containers interact with each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*sSm93BtchsvviV4pnYtGfw.png" /></figure><p># Go to master<br>&gt;&gt; mkdir deployment<br>&gt;&gt; cd deployment<br>&gt;&gt; vi django-cluster.yaml</p><pre>version: &#39;3.7&#39;<br><br>services:<br>  django-app:<br>    image: ashishkr3246/todo-app:latest<br>    ports:<br>      - &quot;8001:8001&quot;<br>  mysql-db:<br>    image: mysql:latest<br>    ports:<br>      - &quot;3306:3306&quot;<br>        environment:<br>          MYSQL_ROOT_PASSWORD:<br>            test@123</pre><p># First delete service<br>&gt;&gt; sudo docker service rm &lt;id or name&gt;<br>&gt;&gt; sudo docker stack deploy -c django-cluster.yaml react-app<br>&gt;&gt; sudo docker ps</p><p><strong>Note:</strong> If you are unable to see some services on your master node then check the worker node.<br>&gt;&gt; sudo docker service scale react-app_mysql-db=3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sCZEx_b7QW34a57luTBWHA.png" /></figure><p>&gt;&gt; sudo docker service logs react-app_mysql-db # To see logs</p><p>Thanks for reading my blog!!!!!!!</p><p>Please reach out in case you have any queries &amp; questions related to this……..</p><p><strong>E-mail: </strong>ashishkr2346@gmail.com</p><p><strong>Phone:</strong> +91-7903563406</p><p><strong>LinkedIn</strong>: <a href="https://www.linkedin.com/in/ashish-kumar-hit/">https://www.linkedin.com/in/ashish-kumar-hit/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11ed0ec25cc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEEK 7: DOCKER BASIC COMMANDS]]></title>
            <link>https://medium.com/@ashishkr3246/docker-basic-commands-c3bab21fdd5b?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3bab21fdd5b</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Fri, 12 May 2023 12:36:58 GMT</pubDate>
            <atom:updated>2023-06-09T12:53:46.598Z</atom:updated>
            <content:encoded><![CDATA[<h3>WEEK 6: DOCKER BASIC COMMANDS</h3><h4><strong>DOCKER</strong></h4><p>Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*HmSrTrFC77lvKTzo3YdD3w.png" /></figure><h4><strong>ADVANTAGES</strong></h4><ol><li>Virtualization</li><li>Light Weight</li><li>Re-usability</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*0KeWJFIHTEnZyJGkYBlZ9w.jpeg" /></figure><p><strong><em>Docker = Container + Engine</em></strong></p><p><strong><em>Docker Engine: </em></strong>Docker Engine is an open-source containerization technology for building and containerizing your applications. Docker Engine acts as a client-server application</p><p><strong><em>Operating System: Linux</em></strong></p><p><strong><em>Infrastructure: Port, LAN, HDD, RAM</em></strong></p><h3><strong>Container &amp; Image Commands</strong></h3><p><strong><em>Note: Please run all these commands in sequence you will get a basic idea of how docker commands work</em></strong></p><p><strong><em>Install Docker:</em></strong> <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04">https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04</a></p><p>》sudo docker ps # To see live images</p><p>》sudo docker ps -a # To see all images</p><p>》sudo docker pull mysql # to get MySQL image</p><p># Now from the image you are creating a container</p><p>》sudo docker run -it –name my-db -e MYSQL_ROOT_PASSWORD=test@123 -d mysql:latest</p><p># -it means interactive terminal</p><p># –name means give database name</p><p># -e means my environment variable</p><p># -d means demon mode imageName:tag</p><p>》sudo docker ps -a</p><p>》sudo docker exec -it &lt;container-id&gt; bash</p><p># To enter in container</p><p># Run MySQL</p><p>》 mysql -uroot -p</p><p>》exit #To come out from mysql</p><p>》exit #To come out from bash</p><p>》docker rename &lt;container-id&gt; new-db-name</p><p>_____________</p><p>》sudo docker pull jenkins/jenkins</p><p>》sudo docker exec -it &lt;con id&gt; bash</p><p>》exit</p><p>》sudo docker exec -it new-db-name bash</p><p>》mysql -uroot -p</p><p>》test@123</p><p>》show databases;</p><p>》show tables;</p><p>》select * from information_schema</p><p>____________________________________</p><p>》sudo docker images # To see images</p><p>》sudo docker system prune # To delete not running images</p><p>》sudo docker kill &lt;con id&gt; # To kill specific images</p><p>____________________________________</p><h4>Task: Build Docker Image &amp; Push it on DockerHub</h4><p>git clone &lt;react-django url&gt;</p><p>》ls</p><p>》cd react_django_demo_app</p><p>》ls</p><p>》cat requirements.txt</p><p>》pip3 install -r requirements.txt</p><p>》python3 manage.py runserver</p><p>》vi Dockerfile</p><p>From python:3.9</p><p>WORKDIR app</p><p>COPY . /app</p><p>RUN pip install -r requirements.txt</p><p>EXPOSE 8001</p><p>CMD</p><p>[“python”,”manage.py”,”runserver”,”0.0.0.0:8000]</p><p># pip is python package installer</p><p>》sudo docker build -t django-new-app .</p><p>》sudo docker images</p><p># If you are running docker on first time then you need to map port</p><p>docker run -p 8000:8000 -d django-new-app</p><p># To run stopped container</p><p>》sudo docker run -d django-new-app</p><p>》sudo docker ps</p><p>》curl -L <a href="http://www.google.com/">http://www.google.com</a></p><p>》rm &lt;file-name&gt; # To remove a file</p><p>》vim &lt;file-name&gt; # To edit file</p><p><strong># Push your image on the docker hub</strong></p><p>》sudo docker login</p><p>》sudo docker tag django-new-app ashishkr3246/django-new-app:latest</p><p>》sudo docker push ashishkr3246/django-new-app:latest</p><p><strong># Now go to another machine &amp; pull the image</strong></p><p>》sudo docker run -p 8001:8001 -d ashishkr3246/react-django-app:latest</p><p>》lsof -i :8001 # To see status of port</p><p>》ls -la</p><p>》df -h</p><p>》sudo docker ls</p><p>Thanks for reading my blog!!!!!!!</p><p>Please reach out in case you have any queries &amp; questions related to this……..</p><p><strong>E-mail: </strong>ashishkr2346@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3bab21fdd5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEEK 5: ADVANCE GIT]]></title>
            <link>https://medium.com/@ashishkr3246/week-5-advance-git-9adbacd480a0?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/9adbacd480a0</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Tue, 02 May 2023 10:22:23 GMT</pubDate>
            <atom:updated>2023-05-02T10:33:22.683Z</atom:updated>
            <content:encoded><![CDATA[<p><strong># 90DaysofDevOps Challenge</strong></p><h3>Git Rebase and Merge (Manage project linear with branches)</h3><h3>Git Rebase</h3><p>&gt;&gt; It is a command to integrate changes from one branch to another.</p><p>&gt;&gt; It will not create any extra commit-id, it will just transfer &amp; modify all commits from one branch to another branch.</p><p>&gt;&gt; git rebase takes all commits individually.(know how many commit-ID’s there)</p><p><strong><em>Command:</em></strong> git rebase &lt;branch_name&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kGalU1pLyJXyMJzJc9SFtw.jpeg" /></figure><h3>Git Merge</h3><p>&gt;&gt; It is also similar to git rebase, the only difference is, on the target branch it creates a new commit, preserving the history of the source branch.</p><p>&gt;&gt; git merge takes all commits as one object(don’t know how many commit IDs there)</p><p><strong><em>Command:</em></strong> git merge &lt;branch_name&gt;</p><h3>Squash &amp; Cherry-pick (Manage Commits in a smarter way)</h3><p><strong>CHERRY-PICK</strong></p><p>Once a commit is done on a specific branch and we want to merge some particular commit on some other branch then at that time we can use cherry-pick</p><p><strong><em>Command:</em></strong> git cherry-pick &lt;commit_id&gt;</p><p><strong>Squash</strong></p><p>To combine multiple commits into one</p><h3><strong><em>Git Conflicts (Problem during multiple users made changes in Repo)</em></strong></h3><p>If someone changed your code in the GitHub(Remote) repo &amp; you changed something in the same file in the local repo but the content is different then, conflict occurs</p><p>Conflict can be created in two ways</p><ol><li>Either do some changes in a file in the remote as well as locally on the same branch &amp; try to push</li><li>Or Change the same file in two different branches &amp; try to merge both branches</li></ol><h3>Reset &amp; Revert</h3><p>Two commonly used tools that git users will encounter are git reset and git revert. The benefit of both of these commands is that you can use them to remove or edit changes you’ve made in the code in previous commits.</p><p><strong>Reset:</strong> If you want to move your file back to Staging Area to Working Directory then execute git reset &lt;file_name&gt;</p><p><strong>Revert:</strong> If you commited your changes from local to remote &amp; you want to revert your commit back then execute git revert &lt;commit-id&gt;</p><h4><strong>Miscellaneous Git Commands</strong></h4><p>&gt;&gt; git pull &lt;branch_name&gt;</p><p># git pull will pull all remote changes to a specific branch</p><p>&gt;&gt; git fetch</p><p># It will fetch all branches from the remote to local</p><p># After this do &gt;&gt; git checkout &lt;branch_name&gt;</p><p>&gt;&gt; git stash</p><p># If you are working on one branch &amp; you want to switch to another branch without committing your work on that branch then use git stash then, it will save your work as <strong>WIP(Work in progress)</strong></p><p>&gt;&gt; git stash pop</p><p># Unhide your <strong>WIP</strong> file</p><p>&gt;&gt; git stash drop</p><p># To drop your <strong>WIP</strong> file</p><p><strong><em>I will keep updating my blogs in the future also as my knowledge increases. so, don’t forget to follow &amp; click on clap if you find it helpful</em></strong></p><p><strong>Thanks for reading my blog!!!!!!!</strong></p><p>Please reach out in case you have any queries &amp; questions related to this……..</p><p>Linkedin: <a href="https://www.linkedin.com/in/ashish-kumar-hit/">https://www.linkedin.com/in/ashish-kumar-hit/</a></p><p>Email: ashishkr3246@gmail.com</p><p>Ashish Kumar</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9adbacd480a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEEK4: BASIC GIT & GITHUB]]></title>
            <link>https://medium.com/@ashishkr3246/week4-basic-git-github-b5046ab70481?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5046ab70481</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Fri, 21 Apr 2023 11:36:13 GMT</pubDate>
            <atom:updated>2023-05-01T06:57:32.159Z</atom:updated>
            <content:encoded><![CDATA[<h3>#90DaysofDevops challenge</h3><p><strong>Q- What is Git?</strong></p><p>Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers collaboratively developing source code during software development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eNb7j4FbVIlyan9bF0sAIg.jpeg" /></figure><p><strong>Q- What is Github?</strong></p><p>GitHub is a code hosting platform for collaboration and version control.</p><p>GitHub lets you (and others) work together on projects.</p><p>Alternatives are GitLab, BitBucket, Launchpad etc</p><p><strong>Repository</strong></p><p>&gt;&gt; A repository is a place where you have all the codes or kind of folder on a server.</p><p>&gt;&gt; Changes are personal to a particular repository</p><p><strong>Q- What is Version Control?</strong></p><p>Version control is a system that tracks changes to a file or set of files over time so that you can recall specific versions later. It allows you to revert files back to a previous state, revert the entire project back to a previous state, compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*Zk6GM_uDQAUbdYtHPpZjZw.png" /></figure><p>CVCS → Centralized Version Control System</p><p>DVCS → Distributed Version Control System</p><ol><li><strong><em>Centralized Version Control System</em></strong></li></ol><p>&gt;&gt; It is not locally available, meaning we’ve always needed to be connected to a network to perform any action</p><p>&gt;&gt; Since everything is centralized, if the central server gets failed, you will lose the entire data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*ZUs0HoabC3s6__EeKsRNig.jpeg" /></figure><p><strong><em>2. Distributed Version Control System</em></strong></p><p>In DVCS, every contributor has a local copy or clone of the main repository which contains all the files and metadata of the main repository.</p><p><strong>Q- Why do we need Source Code Management as a DevOps Engineer?</strong></p><p>To use the CICD pipeline in DevOps, you must know the recent project updates. Because DevOps Monitors the most recent code and creates definitions that execute a variety of tasks to user needs.</p><p><strong><em>GIT Three-Stage Architecture</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CdB0w3Danvg1lEbJtqqFzw.png" /></figure><p><strong>Commit</strong></p><p>&gt;&gt; When you store changes in a repository. you will get a commit-id</p><p>&gt;&gt; It is 40 Alpha-Numeric Characters.</p><p>Untracked &gt;&gt; Staged &gt;&gt; Tracked</p><p><strong>Basics Git Commands</strong></p><p><strong><em>&gt;&gt;</em></strong> Set Global UserName and Email for Git(Locally)</p><p>→ git config — global user.name “&lt;your username&gt;”</p><p>→ git config — global user.email “&lt;your email&gt;”</p><p>&gt;&gt; Get Global userName and Email for Git</p><p>→ git config — get user.name</p><p>→ git config — get user.email</p><ol><li>git init (Initialize an empty Git Repository)</li><li>git clone &lt;repository_url&gt; (Clone an existing Git Repository)</li><li>git add &lt;file_name&gt; (Add file/stage to git)</li><li>git add . (Add all current directory files to git)</li><li>git commit -m “&lt;your_commit_message&gt;” (Commit all staged files to git)</li><li>Restore the file from being modified to tracked</li></ol><p>→ git restore &lt;file_name&gt; (In case you deleted that file by mistake)</p><p>→ git restore — staged &lt;file_name&gt; (To unstage file)</p><p>→ git rm — cached &lt;file_name&gt; (To unstage file)</p><p>7. git status (Show the status of your git repository)</p><p>8. git branch (Show the branches of your git repository)</p><p>9. git checkout -b &lt;branch_name&gt; (Checkout to a new branch)</p><p>10. git checkout &lt;branch_name&gt; (Checkout to an existing branch)</p><p>or, git switch &lt;branch_name&gt;</p><p>11. git checkout -d &lt;branch_name&gt; (Remove a branch from git)</p><p>12. git remote -v (Show remote origin URL)</p><p>13. git remote add origin &lt;your_remote_git_url&gt; (Add remote origin URL)</p><p>14. git remote remove origin (Remove remote origin URL)</p><p>15. git revert &lt;commit_hash_id&gt; (Revert deleted files)</p><p>16. git push origin &lt;branch_name&gt; (Push your local changes to remote branch)</p><p>17. git pull origin &lt;branch_name&gt; (Pull your remote changes to the local branch)</p><p>18. git log (Check your git commits and logs)</p><p>&gt;&gt; git log — oneline (Show all commits in one line)</p><p><strong>Thanks for reading my blog!!!!!!!</strong></p><p>Please reach out in case you have any queries &amp; questions related to this……..</p><p>Linkedin: <a href="https://www.linkedin.com/in/ashish-kumar-hit/">https://www.linkedin.com/in/ashish-kumar-hit/</a></p><p>Email: ashishkr3246@gmail.com</p><p>Ashish Kumar</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5046ab70481" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEEK3: ADVANCED LINUX]]></title>
            <link>https://medium.com/@ashishkr3246/week3-advanced-linux-463f388acea5?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/463f388acea5</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Thu, 20 Apr 2023 12:23:47 GMT</pubDate>
            <atom:updated>2024-02-19T08:36:04.617Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topics</strong></p><ol><li>Users</li><li>User Groups</li><li>Sudo</li><li>Grep</li><li>awk</li><li>ACL</li><li>SSH, SCP</li><li>systemctl</li><li>Shell Scripting</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VXuVCp5ny4xcF2qVpCBTTw.jpeg" /></figure><h3><strong>Tasks</strong></h3><ol><li>Create multiple users &amp; generate passwords for all</li><li>Create a user group, add users to the group &amp; give customize permissions to users, groups</li><li>Search Specific keywords using grep</li><li>Print Customize outputs from your log file using the awk command</li><li>Copy files from the server to local and vice-versa</li><li>Write a shell script to automate some tasks</li></ol><p><strong><em>Task1: Create multiple users &amp; generate passwords for all</em></strong></p><p>》whoami</p><p>》sudo useradd ashish-dev -m</p><p># -m means manage Password or others</p><p>》sudo cat /etc/passwd</p><p>》sudo passwd ashish-dev</p><p>Test@123</p><p>》cd /home/ashish-dev</p><p>》su ashish-dev #su means switch user</p><p>Test@123</p><p>》pwd</p><p>》cd /</p><p>》pwd</p><p>》cd /home/ashish-dev</p><p>》pwd</p><p>》ls</p><p>》mkdir dev_files</p><p>》cd dev_files</p><p>》pwd</p><p>》touch dev_files.txt</p><p>》ls</p><p>》exit</p><p>》sudo useradd ashish-test -m</p><p>》sudo passwd ashish-test</p><p>Test@123</p><p>》sudo useradd ashish-devops -m</p><p>》sudo passwd ashish-devops</p><p>Test@123</p><p>》sudo cat /etc/passwd</p><p><strong><em>Task2: Create a user group, add users to the group &amp; give customize permissions to users, groups</em></strong></p><p>》sudo groupadd devops</p><p>》sudo cat /etc/group</p><p>》sudo gpasswd -a ashish-dev devops</p><p># a means append user one by one</p><p>》sudo cat /etc/group</p><p>》sudo gpasswd -M ubuntu,ashish-dev devops</p><p># M for adding multiple user at a time</p><p>》sudo gpasswd -a ashish-devops devops</p><p>》sudo cat /etc/group</p><p>》sudo cat /etc/sudoers</p><p>》sudo vim /etc/sudoers</p><p>sudo means super user do</p><p>%devops ALL=(ALL) ALL #save file</p><p>》sudo reboot</p><p>After this restart your machine</p><p><strong>Linux File permission</strong></p><p>In Linux, there are three types of owners: users, groups, and others.<br><strong><em>Linux user:</em></strong> A user is the owner of the file.<br><strong><em>Linux group:</em></strong> Group is a collection of users.<br><strong><em>Other:</em></strong> Any user who is not part of our user or group category is called other</p><p>i) <strong><em>Read permission:</em></strong> Read permission allow users to open and read the file only.<br>ii) <strong><em>Write permission:</em></strong> It allows the user to modify the file.<br>iii) <strong><em>Executable permission:</em></strong> It allows the user to run an executable script.</p><p><strong><em>Note:</em></strong> We can find permissions of files and folders using a long listing <strong>ls -la </strong>on a Linux terminal.<br><strong>chmod</strong> is the command which is used to change the access permission of files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*CaRRRtTPWoSh0692hfOnPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*WJ5-kkFHDkrt_5tijAqfHg.png" /></figure><p><strong><em>Syntax :</em></strong><br>chmod permissions filename<br><br>chmod 451 file-name</p><p><strong>》</strong>go inside ashish-dev</p><p>》ls -la</p><p>》sudo chmod 777 dev_files.txt</p><p>》ls –la</p><p><strong>ACL</strong></p><p><strong>》</strong>sudo apt-get install acl</p><p>》getfacl /home/ashish-dev/dev_files/dev_file.txt</p><p>》setfacl -m u:ubuntu:rwx /home/ashish-dev/dev_files/dev_file.txt</p><p># Acl is used to give quick permissions</p><p>》sudo getacl /home/ashish-dev/dev_files/dev_file.txt</p><p><strong><em>Task3: Search Specific keywords using grep</em></strong></p><p>vim new_file1.txt</p><p>This is new file</p><p>DevOps</p><p>devops</p><p>》grep -r devops /home/ubuntu/</p><p>》grep -r Devops /</p><p>》grep -r Devops /home/ubuntu/</p><p>》grep -r -i devops /home/ubuntu/</p><p><a href="https://www.ibm.com/docs/en/zos/2.1.0?topic=problems-example-log-file">Example log file</a></p><p># Copy some lines and paste them in your file</p><p>》vim log_files.txt (paste here)</p><p>》cat log_files.txt</p><p>》grep INFO log_file.txt</p><p><strong><em>Task4: Print Customize outputs from your log file using the awk command</em></strong></p><p><strong># If you want filtered output.</strong></p><p><strong># It is a command where you write your conditions</strong></p><p>》awk ‘{print}’ log_file.txt</p><p>》awk ‘/INFO/ {print}’ log_file.txt</p><p>》awk ‘/INFO/ {print $1,$2}’ log_file.txt</p><p>》awk ‘NR &gt;=1 &amp;&amp; NR&lt;=50, /INFO/ {print NR,$1,$2}’ log_file.txt</p><p>》awk ‘NR &gt;=1 &amp;&amp; NR&lt;=50 &amp;&amp; /INFO/ {print NR,$1,$2}’ log_file.txt</p><p><strong><em>Task5: Copy files from the server to local and vice-versa</em></strong></p><p><strong>SSH &amp; SCP</strong></p><p>SSH: Secured shell</p><p>Connect your machine</p><p>》cd .ssh</p><p>》ls</p><p>》cat authorized_keys</p><p># Public key is available on Server and you will get Private key</p><p>》ssh-keygen</p><p># Paste your public key in your authorized_keys</p><p>》vim authorized_keys</p><p>》Take private key and try to connect server from your local machine</p><p><strong>SCP</strong></p><p><strong>Server copy</strong></p><p># It is used to copy files from one server to another server</p><p><strong><em>Note:</em></strong> You always run this from your local because .pem file is available on your local machine.</p><p># command to copy a file from local to the server</p><p>》scp -i &lt; yourpemfilename&gt; &lt;local file name&gt; &lt;server location&gt;</p><p># command to copy file from server to local</p><p>》scp -i &lt;yourpemfilename&gt; &lt;server location&gt; :/home/ubuntu/newFie1.txt .</p><p><strong><em>Systemctl</em></strong></p><p>&gt;&gt; sudo apt-get update</p><p>&gt;&gt; sudo apt-get install docker.io</p><p># In your system a lot of services are running. To handle that or give some command we use this systemctl</p><p># Demon mode means services that are running in the background</p><p>&gt;&gt; top #To know what all process your CPU is running</p><p>&gt;&gt; top -b | head -3</p><p>&gt;&gt; systemctl status docker</p><p>&gt;&gt; systemctl status sshd</p><p>&gt;&gt; service docker status</p><p>&gt;&gt; service docker status &amp;&amp; systemctl status docker</p><p># systemctl is a Linux command-line utility used to control and manage systemd and services</p><p># service is a command that manages services running on your machine</p><p><strong><em>Q- Difference between systemctl and system command?</em></strong></p><p>&gt;&gt; If you start any service using <strong><em>systemctl</em></strong> then In case if you switched off your machine also then after some time when you restart your machine you will find your service in active state.</p><p>&gt;&gt; But If you did something using <strong><em>system</em></strong> command then you will find your service got killed</p><p><strong><em>Task6: Write a shell script to automate some tasks</em></strong></p><p>Write a Shell script to Show these details:</p><p>- Welcome the user, with greetings to his/her username<br>- Show the date and time <br>- Show the uptime of the server and the last logins<br>- Show the disk space and RAM utilization<br>- Show the top CPU processes</p><p>&gt;&gt; vim disk_stat.sh</p><p>#!/bin/bash</p><p>date;</p><p>echo “uptime:”</p><p>uptime</p><p>echo “Currently Connected:”</p><p>w</p><p>echo “Last Logins:”</p><p>last -a | head -3</p><p>echo “………………………”</p><p>echo “Disk and memory usage:”</p><p>df -h | xargs | awk ‘{print “Free/total disk: “ $11 “ / “ $9}’</p><p>free -m | xargs | awk ‘{print “Free/total memory: “ $10 “ / “ $8 “ MB”}’</p><p>echo “ — — — — — — — -”</p><p>echo “Utilization and most expensive processes:”</p><p>top -b |head -3</p><p>Thanks for reading my blog!!!!!!!</p><p>Please reach out in case you have any queries &amp; questions related to this……..</p><p>Linkedin: <a href="https://www.linkedin.com/in/ashish-kumar-hit/">https://www.linkedin.com/in/ashish-kumar-hit/</a></p><p>Email: ashishkr3246@gmail.com</p><p>Ashish Kumar</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=463f388acea5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEEK 2: LINUX COMMANDS]]></title>
            <link>https://medium.com/@ashishkr3246/week-2-linux-commands-9887bf7135e2?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/9887bf7135e2</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Sat, 15 Apr 2023 17:05:51 GMT</pubDate>
            <atom:updated>2023-04-20T06:16:57.814Z</atom:updated>
            <content:encoded><![CDATA[<h3>#90DaysofDevops challenge</h3><p><strong>What is Linux?</strong></p><p>Linux is <strong>an open-source(Anyone can contribute) operating system (OS)</strong> that was created by Linus Torvalds in 1991. It is based on the Unix operating system.</p><p><strong><em>Q- Why Linux??</em></strong></p><p>&gt;&gt; Multi-User &amp; Multi-Tasking</p><p>&gt;&gt; Open Source</p><p>&gt;&gt; Security and Stability</p><p>&gt;&gt; Need less resources</p><p><strong><em>Linux Flavours</em></strong></p><p>&gt;&gt; RHEL (Red Hat Enterprise Linux)</p><p>&gt;&gt; CentOS</p><p>&gt;&gt; Ubuntu</p><p>&gt;&gt; Amazon Linux</p><p>&gt;&gt; Fedora</p><p>&gt;&gt; Linux Mint</p><p><strong><em>Architecture of Linux</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6sSaOaTTVL3B4u97gZi2cA.png" /></figure><p><strong>Q- What is Operating System?</strong></p><p>An operating system is a software that directly manages a system’s hardware and resources, like CPU, memory, and storage. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.</p><p><strong>Q- What are the Features of Linux Operating Systems?</strong></p><p>· Free and Open-Source.</p><p>· Extremely Flexible.</p><p>· Lightweight Infrastructure.</p><p>· Graphical User Interface (GUI)</p><p>· End-to-end encryption</p><p>· Portable Environment</p><p>· Shell/ Command-line Interface</p><p>· Customized keyboard</p><p>· Multi-User &amp; Multi-tasking</p><p><strong>Q- What is Kernel?</strong></p><p>It is like a manager who manages your entire operating system like file, folders etc</p><p>To talk with the kernel you need a terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fWdd1my55-GwsLYKpfdFlg.jpeg" /></figure><p><strong>File System Hierarchy</strong></p><ol><li>/ → Top-level directory</li><li>/root → Home directory for root user</li><li>/home → Home directory for other users</li><li>/boot → It contains bootable files for Linux</li><li>/etc → It contains all configuration files</li><li>/usr → By default software is installed in this directory</li><li>/bin → It contains commands used by all users</li><li>/sbin → It contains commands used by only root user</li></ol><p><strong>Basic Linux command:</strong></p><p>1. cd → Change directory</p><p>2. ls → List directory</p><p>3. pwd → Present working directory</p><p>4. whoami → To know the current user</p><p>5. Clear → To clear your terminal</p><p>6. history → To see all commands which you already executed</p><p>7. sudo su → Super user</p><p>8. &amp;&amp; → Used to execute multiple commands at a time</p><p>9. echo → It is like a print command for Linux</p><p>10. uname → It will tell you on which kernel you are working</p><p><strong>Files &amp; Folders</strong></p><p>11. mkdir → To Create a folder</p><p>12. mkdir -p A/B/C/D/E → To create nested directories</p><p>13. rmdir → Remove an empty directory</p><p>14. touch → To create a file</p><p>&gt;. touch &lt;fileName&gt; # To create single file</p><p>&gt;. touch file{1..10} # To create multiple files at a time</p><p>15. cat → Display file contents</p><p>&gt;&gt; cat fileName.txt | head -3 (To see the first three lines of the file)</p><p>&gt;&gt; cat fileName.txt | tail -3 (To see the last three lines of the file)</p><p>16. cp → Copy files and directories</p><p>&gt;&gt; cp &lt;sourceFileLocation&gt; &lt;DestinationFileLocation&gt; (To copy file)</p><p>&gt;&gt; cp -r &lt;sourceFileLocation&gt; &lt;DestinationFileLocation&gt; (To copy folder)</p><p># r means recursively</p><p>17. mv → Move files and directory</p><p>&gt;&gt; mv &lt;source file location&gt; &lt;Destination file location&gt;</p><p>18. rm → Remove files &amp; directories</p><p>&gt;&gt; rm &lt;file-name&gt; (To delete the file)</p><p>&gt;&gt; rm -rf &lt;folder-name&gt; (To delete directory &amp; all files inside it)</p><p># r means recursivly</p><p>19. ls -la → To see all hidden files</p><p>20. vim → Linux editors(To create and edit files)</p><p><strong>Note:</strong> &gt;&gt; Type i to insert any line or type any thing in this editor</p><p>&gt;&gt; Esc then:wq(To save file and come out from editor)</p><p>&gt;&gt; Esc: q! #To exit without saving</p><p>21. nano → Linux editors(To create and edit files)</p><p><strong>Note:</strong> ctrl + x then Y (To save the file and come out from the editor)</p><p>22. cd .. → To come one directory back</p><p>Thanks for reading my blog!!!!!!!</p><p><strong>If this post was helpful, please follow and click the clap.</strong></p><p>Linkedin: <a href="https://www.linkedin.com/in/ashish-kumar-hit/">https://www.linkedin.com/in/ashish-kumar-hit/</a></p><p>Email: ashishkr3246@gmail.com</p><p>Ashish Kumar</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9887bf7135e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps Basics]]></title>
            <link>https://medium.com/@ashishkr3246/why-devops-78caff75b4d7?source=rss-22b7333bfb97------2</link>
            <guid isPermaLink="false">https://medium.com/p/78caff75b4d7</guid>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Ashish Kumar]]></dc:creator>
            <pubDate>Tue, 04 Apr 2023 04:42:52 GMT</pubDate>
            <atom:updated>2023-04-08T15:58:02.546Z</atom:updated>
            <content:encoded><![CDATA[<h3>WEEK 1: DevOps Basics</h3><p><a href="https://www.linkedin.com/feed/hashtag/?keywords=90daysofdevops&amp;highlightedUpdateUrns=urn:li:activity:7015419431497416704"><strong>#90DaysofDevops</strong></a></p><p><strong>What is DevOps?</strong></p><p>DevOps → Development(Dev) + Operations(Ops)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*behQp4f1UzKR_332U2hSXg.png" /></figure><p>Goals ??</p><p>1. Shorten the System’s Development Life Cycle</p><p>Q- How ??</p><p>→ Automation</p><p>→ Scaling</p><p>→ Infrastructure as a code</p><p>2. CICD(Continous Integration &amp; Continous Delivery/Deployment)</p><p>3. Collaboration, Communication, and Integration between teams</p><p>4. Aims to launch the application faster in the market</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YoosgCStJp0P7D60.png" /></figure><p>DevOps Tools</p><h3>DevOps Lifecycle</h3><p><strong>Overview of how the DevOps lifecycle</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/0*LMhTAKrzztDPBiGL.png" /></figure><ol><li><strong>Plan </strong>— Figure out what’s client requirements &amp; design a plan to optimize business impact and produce the intended result.</li><li><strong>Code </strong>— During this point, the code is being developed. To simplify the design process, the developer team employs lifecycle DevOps tools and extensions like Git that assist them in preventing safety problems and bad coding standards.</li><li><strong>Build </strong>— After programmers have completed their tasks, they use tools such as Maven and Gradle to submit the code to the common code source.</li><li><strong>Test </strong>— To assure software integrity, the product is first delivered to the test platform to execute various sorts of screening such as user acceptability testing, safety testing, integration checking, speed testing, and so on, utilizing tools such as JUnit, Selenium, etc.</li><li><strong>Release</strong> — At this point, the build is prepared to be deployed in the operational environment. The DevOps department prepares updates or sends several versions to production when the build satisfies all checks based on the organizational demands.</li><li><strong>Deploy </strong>— At this point, Infrastructure-as-Code assists in creating the operational infrastructure and subsequently publishes the build using various DevOps lifecycle tools.</li><li><strong>Operate</strong> — This version is now convenient for users to utilize. With tools including Chef, the <a href="https://www.knowledgehut.com/blog/others/what-is-management">management</a> department take care of server configuration and deployment at this point.</li><li><strong>Monitor</strong> — The DevOps workflow is observed at this level depending on data gathered from consumer behavior, application efficiency, and other sources. The ability to observe the complete surroundings aids teams in identifying bottlenecks affecting the production and operations teams’ performance</li></ol><h3>Automation</h3><p>No Manual Work/ Less human efforts by using DevOps Automation tools and writing scripts to perform particular tasks</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*j2nx0zebJCVixi9_gMhE4A.jpeg" /></figure><p><strong>Benefits ??</strong></p><p>→ Reduce Manual tasks</p><p>→ Increase Speed &amp; Efficiency</p><p>→ Reduce risks &amp; errors</p><h3>Scaling</h3><p>Ability to handle loads when traffic or Users increases</p><p>Types</p><ol><li>Horizontal Scaling(Increasing the number of servers)</li><li>Vertical Scaling(Increasing Capacity of Same Server)</li></ol><p>HotStar CaseStudy: <a href="https://youtu.be/QjvyiyH4rr0">https://youtu.be/QjvyiyH4rr0</a></p><p><strong>Note: </strong>Please explore the above case study you will get a better idea on Scaling</p><h3>Infrastructure</h3><p>Code That manages &amp; maintains your entire infrastructure either on the cloud and on-premises</p><p><strong>Benefits??</strong></p><p>→ Avoid Manual Work like Configuring &amp; maintaining tools</p><p>→ Reliable &amp; Scalable</p><p>→ Secure Infrastructure &amp; easy to troubleshoot in case you got any error(you will able to save a lot of time)</p><h3>What are the common technologies used in DevOps?</h3><p><strong>1) Version control systems</strong> (e.g. Git) for managing and tracking code changes</p><p><strong>2) Continuous integration tools</strong> (e.g. Jenkins, Circle CI) for automating the build and testing of code</p><p><strong>3) Containerization technologies</strong> (e.g. Docker, Kubernetes) for packaging and deploying applications</p><p><strong>4) Configuration management tools</strong> (e.g. Ansible, Puppet) for automating the configuration and management of infrastructure</p><p><strong>5) Monitoring tools</strong> (e.g. Grafana, Nagios) for tracking the performance and availability of systems</p><p><strong>6) Cloud platforms</strong> (e.g. AWS, Azure, GCP) for providing infrastructure and services for deployment</p><h3>Why is DevOps Important?</h3><p><strong>1)Faster delivery of software updates:</strong> By automating the build, test, and deployment process, DevOps enables organizations to deliver software updates faster and more frequently.</p><p><strong>2)Improved collaboration:</strong> DevOps promotes collaboration between software developers and IT operations, which can help to improve communication and integration between these teams.</p><p><strong>3)Increased reliability and stability:</strong> By automating the deployment process and implementing testing and monitoring at various stages, DevOps can help to improve the reliability and stability of systems. This can reduce the risk of errors and downtime and can help to improve the overall quality of the software.</p><p><strong>4)Better security:</strong> By incorporating security testing and monitoring into the development and deployment process, DevOps can help to improve the security of systems. This can help to protect against vulnerabilities and threats and can help to ensure that systems are compliant with relevant security standards and regulations.</p><p><strong><em>As Per my Knowledge, I tried my best in this to give a basic idea of DevOps. In case I missed anything then do update me in the comment section or ping me on LinkedIn</em></strong></p><p><strong>If this post was helpful, please follow and click the clap.</strong></p><p>Linkedin: <a href="https://www.linkedin.com/in/ashish-kumar-hit/">https://www.linkedin.com/in/ashish-kumar-hit/</a></p><p>Email: ashishkr3246@gmail.com</p><p><strong>Thank you for reading! Hope you find this article helpful.</strong></p><p>Ashish Kumar</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78caff75b4d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>