<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kishore Reddy &#8211; Best DevOps</title>
	<atom:link href="https://www.bestdevops.com/author/kishore-reddy/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.bestdevops.com</link>
	<description>Lets Learn, Do it &#38; Share! Thats a Best DevOps!!!</description>
	<lastBuildDate>Fri, 06 Aug 2021 07:24:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>
	<item>
		<title>PKS Post Assessment &#8211; Kishore Reddy</title>
		<link>https://www.bestdevops.com/pks-post-assessment-kishore-reddy/</link>
		
		<dc:creator><![CDATA[Kishore Reddy]]></dc:creator>
		<pubDate>Fri, 06 Aug 2021 07:17:10 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=18741</guid>

					<description><![CDATA[Docker Quiz Kubernetes Quiz Below are the list of PCF Commands]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Docker Quiz</h2>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="365" src="https://www.bestdevops.com/wp-content/uploads/2021/08/Docker-Quiz-1-1024x365.png" alt="" class="wp-image-18775" srcset="https://www.bestdevops.com/wp-content/uploads/2021/08/Docker-Quiz-1-1024x365.png 1024w, https://www.bestdevops.com/wp-content/uploads/2021/08/Docker-Quiz-1-300x107.png 300w, https://www.bestdevops.com/wp-content/uploads/2021/08/Docker-Quiz-1-768x274.png 768w, https://www.bestdevops.com/wp-content/uploads/2021/08/Docker-Quiz-1-1536x547.png 1536w, https://www.bestdevops.com/wp-content/uploads/2021/08/Docker-Quiz-1.png 1881w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Kubernetes Quiz</h2>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="357" src="https://www.bestdevops.com/wp-content/uploads/2021/08/K8-Quiz-1024x357.png" alt="" class="wp-image-18749" srcset="https://www.bestdevops.com/wp-content/uploads/2021/08/K8-Quiz-1024x357.png 1024w, https://www.bestdevops.com/wp-content/uploads/2021/08/K8-Quiz-300x105.png 300w, https://www.bestdevops.com/wp-content/uploads/2021/08/K8-Quiz-768x268.png 768w, https://www.bestdevops.com/wp-content/uploads/2021/08/K8-Quiz-1536x535.png 1536w, https://www.bestdevops.com/wp-content/uploads/2021/08/K8-Quiz.png 1882w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Below are the list of PCF Commands</h2>


<pre class="wp-block-code"><span><code class="hljs language-php">Name
cf - A command line tool to interact with Pivotal Platform

Usage
cf &#91;<span class="hljs-keyword">global</span> options] command &#91;arguments…] &#91;command options]


Command	Description

help	Show help.
version	Show the version.
login	Log in to Pivotal Platform.
logout	Log out of Pivotal Platform.
passwd	Change your user password.
target	Set <span class="hljs-keyword">or</span> view the targeted org <span class="hljs-keyword">or</span> space.
api	Set <span class="hljs-keyword">or</span> view the target API URL.
auth	Authenticate non-interactively.


apps	<span class="hljs-keyword">List</span> all apps in the target space.
app	Display health <span class="hljs-keyword">and</span> status <span class="hljs-keyword">for</span> an app.
push	Push a <span class="hljs-keyword">new</span> app <span class="hljs-keyword">or</span> sync changes to an existing app.
scale	Change <span class="hljs-keyword">or</span> view the instance count, disk space limit, <span class="hljs-keyword">and</span> memory limit <span class="hljs-keyword">for</span> an app.
delete	Delete an app.
rename	Rename an app.
start	Start an app.
stop	Stop an app.
restart	Stop all instances of the app, then restart them. This causes app downtime.
events	Show recent app events.
files	Show a <span class="hljs-keyword">list</span> of files in a directory <span class="hljs-keyword">or</span> the contents of a specific file of an app running on 
        the DEA back end.
logs	Tail <span class="hljs-keyword">or</span> show recent logs <span class="hljs-keyword">for</span> an app.
env	Show all environment variables <span class="hljs-keyword">for</span> an app.
set-env	Set an environment variable <span class="hljs-keyword">for</span> an app.
stack	Show information <span class="hljs-keyword">for</span> a stack.
copy-source	Copy the source code of an app to another existing app, then restart that app.
ssh-enabled	Show whether SSH is enabled on an app container instance.
ssh	SSH into an app container instance.

marketplace	<span class="hljs-keyword">List</span> all available offerings in the marketplace.
services	<span class="hljs-keyword">List</span> all service instances in the target space.
service	Show service instance information.
orgs	<span class="hljs-keyword">List</span> all orgs.
org	Show org information.
create-org	Create an org.
delete-org	Delete an org.
rename-org	Rename an org.
spaces	<span class="hljs-keyword">List</span> all spaces in an org.
space	Show space information.
create-space	Create a space.
delete-space	Delete a space.
rename-space	Rename a space.</code></span></pre>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Kubernetes &#8211; ReplicasSets, DeamonSets, Statefulsets  &#038; Services &#8211; Kishore Reddy</title>
		<link>https://www.bestdevops.com/kubernetes-replicassets-deamonsets-statefulsets-services-kishore-reddy/</link>
		
		<dc:creator><![CDATA[Kishore Reddy]]></dc:creator>
		<pubDate>Tue, 27 Jul 2021 15:16:37 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=18491</guid>

					<description><![CDATA[Assignment – 1 1. What is ReplicasSets? A ReplicaSet is a process that runs multiple instances of a Pod and [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Assignment – 1</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><br><strong>1. What is ReplicasSets?</strong></p>



<p class="wp-block-paragraph">A ReplicaSet is a process that runs multiple instances of a Pod and keeps the specified number of Pods constant. Its purpose is to maintain the specified number of Pod instances running in a cluster at any given time to prevent users from losing access to their application when a Pod fails or is inaccessible.&nbsp;&nbsp;</p>



<p class="wp-block-paragraph">ReplicaSet helps bring up a new instance of a Pod when the existing one fails, scale it up when the running instances are not up to the specified number, and scale down or delete Pods if another instance with the same label is created. A ReplicaSet ensures that a specified number of Pod replicas are running continuously and helps with load-balancing in case of an increase in resource usage.<br><br>You can define a&nbsp;<em>deployment</em>&nbsp;to create a ReplicaSet or to remove deployments and adopt all their resources with new deployments. When you revise a deployment, a ReplicaSet is created that describes the state that you want. During a rollout, the deployment controller changes the actual state to the state that you want at a controlled rate. Each deployment revision can also be rolled back. Deployments can also be scaled.</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.ibm.com/cloud/architecture/images/courses/kubernetes-101/deployments-replica-sets-and-pods1.png" alt="" /></figure>



<p class="wp-block-paragraph">A&nbsp;<em>ReplicaSet</em>&nbsp;is a set of Pod templates that describes a set of Pod replicas. It uses a template that describes what each Pod must contain. The ReplicaSet ensures that a specified number of Pod replicas are running at any time.<img decoding="async" src="https://www.ibm.com/cloud/architecture/images/courses/kubernetes-101/deployments-replica-sets-and-pods2.png" alt=""></p>



<p class="wp-block-paragraph"><br><strong>2. How to work with ReplicasSets?</strong></p>



<p class="wp-block-paragraph">A ReplicaSet is defined with fields, including a selector that specifies how to identify Pods it can acquire, a number of replicas indicating how many Pods it should be maintaining, and a pod template specifying the data of new Pods it should create to meet the number of replicas criteria. A ReplicaSet then fulfills its purpose by creating and deleting Pods as needed to reach the desired number. When a ReplicaSet needs to create new Pods, it uses its Pod template.</p>



<p class="wp-block-paragraph">A ReplicaSet is linked to its Pods via the Pods&#8217;&nbsp;<a href="https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#owners-and-dependents">metadata.ownerReferences</a>&nbsp;field, which specifies what resource the current object is owned by. All Pods acquired by a ReplicaSet have their owning ReplicaSet&#8217;s identifying information within their ownerReferences field. It&#8217;s through this link that the ReplicaSet knows of the state of the Pods it is maintaining and plans accordingly.</p>



<p class="wp-block-paragraph">A ReplicaSet identifies new Pods to acquire by using its selector. If there is a Pod that has no OwnerReference or the OwnerReference is not a&nbsp;<a href="https://kubernetes.io/docs/concepts/architecture/controller/" target="_blank" rel="noreferrer noopener">Controller</a>&nbsp;and it matches a ReplicaSet&#8217;s selector, it will be immediately acquired by said ReplicaSet</p>



<p class="wp-block-paragraph"><br><strong>3. Example of ReplicasSets?</strong></p>


<pre class="wp-block-code"><span><code class="hljs">apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: replicaset
spec:
  replicas: 2
  selector:
    matchLabels:
      app: appName
  template:
    metadata:
      labels:
        app: appName
    spec:
      containers:
      - name: containerAp
        image: apache</code></span></pre>


<h2 class="wp-block-heading">Assignment – 2</h2>



<p class="wp-block-paragraph"></p>



<ol class="wp-block-list"><li><strong>What is DeamonSets?</strong></li></ol>



<p class="wp-block-paragraph">A&nbsp;<em>DaemonSet</em>&nbsp;ensures that all (or some) Nodes run a copy of a Pod. As nodes are added to the cluster, Pods are added to them. As nodes are removed from the cluster, those Pods are garbage collected. Deleting a DaemonSet will clean up the Pods it created.</p>



<p class="wp-block-paragraph">Some typical uses of a DaemonSet are:</p>



<ul class="wp-block-list"><li>running a cluster storage daemon on every node</li><li>running a logs collection daemon on every node</li><li>running a node monitoring daemon on every node</li></ul>



<p class="wp-block-paragraph">In a simple case, one DaemonSet, covering all nodes, would be used for each type of daemon. A more complex setup might use multiple DaemonSets for a single type of daemon, but with different flags and/or different memory and cpu requests for different hardware types.</p>



<p class="wp-block-paragraph"><br><strong>2. How to work with DeamonSets?</strong></p>



<p class="wp-block-paragraph">A DaemonSet is an active Kubernetes object managed by a controller. You can declare your desired state, indicating that a specific Pod needs to be present on every node. The reconciliation control loop is going to compare the desired state with the current observed state. If an observed node does not have a matching Pod, the&nbsp;<a href="https://phoenixnap.com/kb/understanding-kubernetes-architecture-diagrams#htoc-controller" target="_blank" rel="noreferrer noopener">DaemonSet controller</a>&nbsp;is going to create one automatically.</p>



<p class="wp-block-paragraph">This automated process includes existing nodes and all newly created nodes. The Pods created by DaemonSet controllers are ignored by the&nbsp;<a href="https://phoenixnap.com/kb/understanding-kubernetes-architecture-diagrams#htoc-schedueler" target="_blank" rel="noreferrer noopener">Kubernetes scheduler</a>&nbsp;and exist as long as the node itself.</p>



<p class="wp-block-paragraph">A DaemonSet creates a Pod on every node by default. If necessary, you can limit the number of acceptable nodes by using a node selector. The DaemonSet controller is going to create Pods only on nodes that match the predefined&nbsp;<strong><em>nodeSelector&nbsp;</em></strong>field in the YAML file.</p>



<p class="wp-block-paragraph"><br><strong>3. Example of DeamonSets?</strong></p>


<pre class="wp-block-code"><span><code class="hljs language-php">apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluent-bit  <span class="hljs-comment"># A DaemonSet named fluent-bit is created.</span>
spec:
  selector:
      matchLabels:
        name: fluent-bit <span class="hljs-comment"># Label selector refers which Pods belong to the DaemonSet</span>
  template:
    metadata:
      labels:
        name: fluent-bit <span class="hljs-comment"># Pod template's label selector</span>
    spec:
      nodeSelector:
        type: prod <span class="hljs-comment"># Node label selector refers on which nodes Pod should be scheduled</span>
                   <span class="hljs-comment"># Pods are only scheduled to nodes bearing the label "type: prod"</span>
      containers:
      - name: fluent-bit
        image: gcr.io/cloud-solutions-images/fluent-bit:<span class="hljs-number">1.6</span>
        resources:
          limits:
            memory: <span class="hljs-number">200</span>Mi
          requests:
            cpu: <span class="hljs-number">100</span>m
            memory: <span class="hljs-number">200</span>Mi</code></span></pre>


<h2 class="wp-block-heading">Assignment – 3</h2>



<p class="wp-block-paragraph"></p>



<ol class="wp-block-list"><li><strong>What is Statefulsets?</strong></li></ol>



<p class="wp-block-paragraph">A StatefulSet is a controller that helps you deploy and scale groups of Kubernetes pods.</p>



<p class="wp-block-paragraph">When using Kubernetes, most of the time you don’t care how your pods are scheduled, but sometimes you care that pods are deployed in order, that they have a persistent storage volume, or that they have a unique, stable network identifier across restarts and reschedules. In those cases, StatefulSets can help you accomplish your objective.</p>



<p class="wp-block-paragraph">Each pod created by the StatefulSet has an ordinal value (0 through # replicas &#8211; 1) and a stable network ID (which is statefulsetname-ordinal) assigned to it. You can also create a&nbsp;<strong>VolumeClaimTemplate</strong>&nbsp;in the manifest file that will create a&nbsp;<a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="noreferrer noopener" target="_blank">persistent volume</a>&nbsp;for each pod. When pods are deployed by a StatefulSet, they will go in order from 0 to the final pod and require that each pod is Running and Ready before creating the next pod.</p>



<p class="wp-block-paragraph"><br><strong>2. How to work with Statefulsets?</strong></p>



<p class="wp-block-paragraph">A DaemonSet ensures that all eligible nodes run a copy of a Pod. Normally, the node that a Pod runs on is selected by the Kubernetes scheduler. However, DaemonSet pods are created and scheduled by the DaemonSet controller instead. That introduces the following issues:</p>



<ul class="wp-block-list"><li>Inconsistent Pod behavior: Normal Pods waiting to be scheduled are created and in&nbsp;<code>Pending</code>&nbsp;state, but DaemonSet pods are not created in&nbsp;<code>Pending</code>&nbsp;state. This is confusing to the user.</li><li><a href="https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/">Pod preemption</a>&nbsp;is handled by default scheduler. When preemption is enabled, the DaemonSet controller will make scheduling decisions without considering pod priority and preemption.</li></ul>



<p class="wp-block-paragraph"><code>ScheduleDaemonSetPods</code>&nbsp;allows you to schedule DaemonSets using the default scheduler instead of the DaemonSet controller, by adding the&nbsp;<code>NodeAffinity</code>&nbsp;term to the DaemonSet pods, instead of the&nbsp;<code>.spec.nodeName</code>&nbsp;term. The default scheduler is then used to bind the pod to the target host. If node affinity of the DaemonSet pod already exists, it is replaced (the original node affinity was taken into account before selecting the target host). The DaemonSet controller only performs these operations when creating or modifying DaemonSet pods, and no changes are made to the&nbsp;<code>spec.template</code>&nbsp;of the DaemonSet.</p>



<p class="wp-block-paragraph"><br><strong>3. Example of Statefulsets?</strong></p>


<pre class="wp-block-code"><span><code class="hljs language-php"> apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  ports:
  - port: <span class="hljs-number">80</span>
    name: web
  clusterIP: None
  selector:
    app: nginx
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: web
spec:
  selector:
    matchLabels:
      app: nginx <span class="hljs-comment"># has to match .spec.template.metadata.labels</span>
  serviceName: <span class="hljs-string">"nginx"</span>
  replicas: <span class="hljs-number">3</span> <span class="hljs-comment"># by default is 1</span>
  template:
    metadata:
      labels:
        app: nginx <span class="hljs-comment"># has to match .spec.selector.matchLabels</span>
    spec:
      terminationGracePeriodSeconds: <span class="hljs-number">10</span>
      containers:
      - name: nginx
        image: k8s.gcr.io/nginx-slim:<span class="hljs-number">0.8</span>
        ports:
        - containerPort: <span class="hljs-number">80</span>
          name: web
        volumeMounts:
        - name: www
          mountPath: /usr/share/nginx/html
  volumeClaimTemplates:
  - metadata:
      name: www
    spec:
      accessModes: &#91; <span class="hljs-string">"ReadWriteOnce"</span> ]
      storageClassName: <span class="hljs-string">"my-storage-class"</span>
      resources:
        requests:
          storage: <span class="hljs-number">1</span>Gi
</code></span></pre>


<p class="wp-block-paragraph">In the above example:</p>



<ul class="wp-block-list"><li>A Headless Service, named&nbsp;<code>nginx</code>, is used to control the network domain.</li><li>The StatefulSet, named&nbsp;<code>web</code>, has a Spec that indicates that 3 replicas of the nginx container will be launched in unique Pods.</li><li>The&nbsp;<code>volumeClaimTemplates</code>&nbsp;will provide stable storage using&nbsp;<a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/">PersistentVolumes</a>&nbsp;provisioned by a PersistentVolume Provisioner.</li></ul>



<h2 class="wp-block-heading">Assignment – 4</h2>



<p class="wp-block-paragraph"></p>



<ol class="wp-block-list"><li><strong>What is Service?</strong></li></ol>



<p class="wp-block-paragraph">A&nbsp;<strong>Kubernetes service</strong>&nbsp;is a logical abstraction for a deployed group of pods in a cluster (which all perform the same function).</p>



<p class="wp-block-paragraph">Since pods are ephemeral, a service enables a group of pods, which provide specific functions (web services, image processing, etc.) to be assigned a name and unique IP address (clusterIP). As long as the service is running that IP address, it will not change. Services also define policies for their access.</p>



<ul class="wp-block-list"><li>Service is one of API Resources in K8s</li><li>Service is network load balancers for PODs</li><li>Service Load Balance PODS on POD network</li><li>Service is empowered by kube proxy &amp; network policy</li><li>Service get Fixed IP address and DNS.</li><li>Service is managed by k8s</li><li>Service can be exposed outside of the clustor (port-forward)</li><li>Service can be STICKY</li><li>Service always Loadbalnce HEALTHY PODs</li><li>Service is getting update PODS endpoint(IP) with a help a of CoreDNS based on the label of SVC and PODS is matching.</li><li>Loadbalancing Alog – Random</li></ul>



<h1 class="wp-block-heading">Why kubernetes Service?</h1>



<p class="wp-block-paragraph">User want to access one of the POD out of 1000 pods which was done as part of Deployment</p>



<p class="wp-block-paragraph"><br><strong>2. How Service Works?</strong></p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list"><li>Label of Service MUST match with Label of PODS, then Service get updated with a POD which should be loadbalance.</li></ul>



<p class="wp-block-paragraph">    “Selector Label” of Service MUST match with Label of PODS, then Service get updated with a POD which should be loadbalance.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">A Service routes traffic across a set of Pods. Services are the abstraction that allow pods to die and replicate in Kubernetes without impacting your application. Discovery and routing among dependent Pods (such as the frontend and backend components in an application) is handled by Kubernetes Services.</p>



<p class="wp-block-paragraph">Services match a set of Pods using&nbsp;<a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels">labels and selectors</a>, a grouping primitive that allows logical operation on objects in Kubernetes. Labels are key/value pairs attached to objects and can be used in any number of ways:</p>



<ul class="wp-block-list"><li>Designate objects for development, test, and production</li><li>Embed version tags</li><li>Classify an object using tags</li></ul>



<figure class="wp-block-image"><img decoding="async" src="https://d33wubrfki0l68.cloudfront.net/7a13fe12acc9ea0728460c482c67e0eb31ff5303/2c8a7/docs/tutorials/kubernetes-basics/public/images/module_04_labels.svg" alt="" /></figure>



<p class="wp-block-paragraph">Labels can be attached to objects at creation time or later on. They can be modified at any time. Let&#8217;s expose our application now using a Service and apply some labels.</p>



<p class="wp-block-paragraph"><br><strong>3. What are the types of Service?</strong></p>



<ul class="wp-block-list"><li><strong>ClusterIP</strong>. Exposes a service which is only accessible from within the cluster.</li><li><strong>NodePort</strong>. Exposes a service via a static port on each node’s IP.</li><li><strong>LoadBalancer</strong>. Exposes the service via the cloud provider’s load balancer.</li><li><strong>ExternalName</strong>. Maps a service to a predefined externalName field by returning a value for the CNAME record.</li></ul>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="576" src="https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-service-architecture-1024x576.jpg" alt="" class="wp-image-18499" srcset="https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-service-architecture-1024x576.jpg 1024w, https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-service-architecture-300x169.jpg 300w, https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-service-architecture-768x432.jpg 768w, https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-service-architecture-375x210.jpg 375w, https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-service-architecture.jpg 1280w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>


<pre class="wp-block-code"><span><code class="hljs language-xml">&#91;root@rajesh rajesh]# kubectl describe svc my-cs
Name:              my-cs
Namespace:         default
Labels:            app=helloworld1
Annotations:       <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>
Selector:          app=helloworld        &#91; FOCUS ]
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.109.240.163
IPs:               10.109.240.163
Port:              5678-80  5678/TCP
TargetPort:        80/TCP
Endpoints:         10.44.0.1:80,10.44.0.2:80
Session Affinity:  None
Events:            <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>


Type of Service?
- ClustorIP
- NodePort
- Loadbalancer
- ExternalIP


ClustorIP(Default)
    Create a SVC which would load balance a POD
    This SVC get IP address from POD Network - AKA ClustorIP

NodePort
    Create a SVC which would load balance a POD
    This SVC get IP address from POD Network - AKA ClustorIP
    +
    This Service Get Exposed at EACH NODE PORT as well.

LoadBalancer
    Create a SVC which would load balance a POD
    This SVC get IP address from POD Network - AKA ClustorIP
    +
    This Service Get Exposed at EACH NODE PORT as well.
    +
    Create a CLOUD EXT LB &amp;&amp;&amp;&amp; ADD Each Node of the CLUSTOR to the EXT LB 

Working with Service?

pod1.yaml
apiVersion: v1
kind: Pod
metadata:
  name: devopsschool-v1
  labels:
    app: helloworld
    server: webo-server
spec:
  containers:
  - name: devopsschool1
    image: scmgalaxy/nginx-devopsschoolv1
    ports:
    - name: nginx-port
      containerPort: 80

pod1.yaml
apiVersion: v1
kind: Pod
metadata:
  name: devopsschool-v2
  labels:
    app: helloworld
    server: webo-server
spec:
  containers:
  - name: devopsschool1
    image: scmgalaxy/nginx-devopsschoolv2
    ports:
    - name: nginx-port
      containerPort: 80



  383  more pod1.yaml pod2.yaml
  384  clear
  385  kubectl get pods
  386  kubectl delete deploy my-dep
  387  clear
  388  kubectl get pods
  389  clear
  390  kubectl get pods
  391  kubectl apply -f pod1.yaml
  392  kubectl apply -f pod2.yaml
  393  clear
  394  kubectl get pods -o wide
  395  curl http://10.44.0.1
  396  clear
  397  kubectl -h
  398  kubectl create -h
  399  clear
  400  kubectl create service -h
  401  clear
  402  kubectl create service -h
  403  kubectl create service clusterip -h

Examples:
  # Create a new ClusterIP service named my-cs
  kubectl create service clusterip my-cs --tcp=5678:80

  5678:8080 = PORT Num of Service: Port Num of Container


&#91;root@rajesh rajesh]# kubectl create service clusterip my-cs --tcp=5678:80
service/my-cs created

&#91;root@rajesh rajesh]# kubectl get svc
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
kubernetes   ClusterIP   10.96.0.1        <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>        443/TCP    4d23h
my-cs        ClusterIP   10.109.240.163   <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>        5678/TCP   8s

&#91;root@rajesh rajesh]# kubectl describe svc my-cs
Name:              my-cs
Namespace:         default
Labels:            app=my-cs
Annotations:       <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>
Selector:          app=my-cs
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.109.240.163
IPs:               10.109.240.163
Port:              5678-80  5678/TCP
TargetPort:        80/TCP
Endpoints:         <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>            &#91; FOCUS - TARGET POD ID ADDRESS ]
Session Affinity:  None
Events:            <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>
&#91;root@rajesh rajesh]#


&#91;root@rajesh rajesh]# kubectl get svc --show-labels
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE     LABELS
kubernetes   ClusterIP   10.96.0.1        <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>        443/TCP    4d23h   component=apiserver,provider=kubernetes
my-cs        ClusterIP   10.109.240.163   <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>        5678/TCP   4m4s    app=my-cs

&#91;root@rajesh rajesh]# kubectl get pods --show-labels
NAME              READY   STATUS    RESTARTS   AGE   LABELS
devopsschool-v1   1/1     Running   0          12m   app=helloworld,server=webo-server
devopsschool-v2   1/1     Running   0          12m   app=helloworld,server=webo-server
&#91;root@rajesh rajesh]#

----

kubectl create service nodeport my-np --tcp=5678:80


 421  kubectl describe svc my-cs --show-labels
  422  kubectl describe svc my-cs --show-lables
  423  kubectl describe svc my-cs --show-labels
  424* kubectl describe s
  425  clear
  426  kubectl get svc my-cs --show-lables
  427  kubectl get svc --show-lables
  428  kubectl get svc --show-labels
  429  clear
  430  kubectl get svc --show-labels
  431  kubectl get pods --show-labels
  432  kubectl edit svc my-cs
  433  clear
  434  kubectl get pods --show-labels
  435  kubectl get svc --show-labels
  436  kubectl describe svc my-cs
  437  kubectl edit svc my-cs
  438  kubectl describe svc my-cs
  439  kubectl edit svc my-cs
  440  kubectl describe svc my-cs
  441  clear
  442  kubectl describe svc my-cs
  443  clear
  444  kubectl get svc
  445  kubectl get svc --show-labels
  446  clear
  447  kubectl get svc --show-labels;kubectl get pods --show-labels
  448  clear
  449  kubectl create service nodeport my-np --tcp=5678:80
  450  kubectl get svc --show-labels;kubectl get pods --show-labels
  451  curl http://10.109.240.163
  452  curl http://10.109.240.163:5678
  453  kubectl describe svc my-np
  454  clear
  455  kubectl edit svc my-np
  456  kubectl describe svc my-np
  457  clear
  458  ls
  459  kubectl get svc --show-labels;kubectl get pods --show-labels
  460  ifconfig
  461  kubectl get svc --show-labels;kubectl get pods --show-labels
  462  clear</code></span></pre>


<p class="wp-block-paragraph"><br><strong>4. Example Yaml of Service</strong></p>



<p class="wp-block-paragraph"></p>


<pre class="wp-block-code"><span><code class="hljs">apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: MyApp
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376</code></span></pre>


<p class="wp-block-paragraph">This specification creates a new Service object named “my-service”, which targets TCP port 9376 on any Pod with the&nbsp;<code>app=MyApp</code>&nbsp;label.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Assignment – 5</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>1.What is Loadbalancer?</strong></p>



<p class="wp-block-paragraph"><br>Load balancing distributes server loads across multiple resources — most often across multiple servers. The technique aims to reduce response time, increase throughput, and in general speed things up for each end user.<br><br>Load balancing&nbsp;refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a&nbsp;<em>server farm</em>&nbsp;or&nbsp;<em>server pool</em>.</p>



<p class="wp-block-paragraph"><br><strong>2. What are the types of Loadbalancer?</strong></p>



<p class="wp-block-paragraph" id="c8de">Different load balancing algorithms provide different benefits; the choice of load balancing method depends on your needs:</p>



<p class="wp-block-paragraph"><strong>Round Robin</strong> – Requests are distributed across the group of servers sequentially.<br><strong>Least Connections</strong> – A new request is sent to the server with the fewest current connections to clients. The relative computing capacity of each server is factored into determining which one has the least connections.<br><strong>Least Time</strong> – Sends requests to the server selected by a formula that combines the fastest response time and fewest active connections. Exclusive to NGINX Plus.<br><strong>Hash</strong> – Distributes requests based on a key you define, such as the client IP address or the request URL. NGINX Plus can optionally apply a consistent hash to minimize redistribution of loads if the set of upstream servers changes.<br><strong>IP Hash</strong> – The IP address of the client is used to determine which server receives the request.<br><strong>Random with Two Choices</strong> – Picks two servers at random and sends the request to the one that is selected by then applying the Least Connections algorithm (or for NGINX Plus the Least Time algorithm, if so configured).</p>



<p class="wp-block-paragraph" id="6f97">Load balancers are generally grouped into two categories:&nbsp;<strong>Layer 4</strong>&nbsp;and&nbsp;<strong>Layer 7</strong>. Layer 4 load balancers act upon data found in network and transport layer protocols (IP, TCP, FTP, UDP). Layer 7 load balancers distribute requests based upon data found in application layer protocols such as HTTP.</p>



<p class="wp-block-paragraph" id="d587">Layer 7 load balancers can further distribute requests based on application specific data such as HTTP headers, cookies, or data within the application message itself, such as the value of a specific parameter.</p>



<p class="wp-block-paragraph"><br><strong>3. How Loadbalancer works?</strong></p>



<p class="wp-block-paragraph" id="03a7"></p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/700/0*XGoMDVlN7qLSMH3y.png" alt="" /></figure>



<p class="wp-block-paragraph" id="a479">Modern high‑traffic websites must serve hundreds of thousands, if not millions, of concurrent requests from users or clients and return the correct text, images, video, or application data, all in a fast and reliable manner. To cost‑effectively scale to meet these high volumes, modern computing best practice generally requires adding more servers.</p>



<p class="wp-block-paragraph" id="f281">A&nbsp;<a href="https://www.nginx.com/solutions/adc">load balancer</a>&nbsp;acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance. If a single server goes down, the load balancer redirects traffic to the remaining online servers. When a new server is added to the server group, the load balancer automatically starts to send requests to it.</p>



<p class="wp-block-paragraph" id="12d4">Loads are broken up based on a set of predefined metrics, such as by geographical location, or by the number of concurrent site visitors.</p>



<p class="wp-block-paragraph" id="cf81">Members of a certain group — such as ‘people living in Europe’, for example, may be directed to a server within Europe, while members of another group take, for instance, ‘North Americans’ may be directed to another server, closer to them.</p>



<p class="wp-block-paragraph" id="1038">In this manner, a load balancer performs the following functions:</p>



<ul class="wp-block-list"><li>Distributes client requests or network load efficiently across multiple servers</li><li>Ensures high availability and reliability by sending requests only to servers that are online</li><li>Provides the flexibility to add or subtract servers as demand dictates</li></ul>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Assignment – 6</h2>



<ol class="wp-block-list"><li><strong>What is Discovery Services?</strong></li></ol>



<p class="wp-block-paragraph">Service discovery takes advantage of the labels and selectors to associate a service with a set of pods.<br><br>The simplest way to discover things inside Kubernetes is via DNS which does not require any custom client side code, dependency injection or magic libraries. It also benefits from working with all programming languages and frameworks!</p>



<p class="wp-block-paragraph"><br><strong>2. How Discovery Services works?</strong></p>



<p class="wp-block-paragraph">A single pod or a ReplicaSet may be exposed to internal or external clients via services, which associate a set of pods with a specific criterion. Any pod whose labels match the selector defined in the service manifest will automatically be discovered by the service. This architecture provides a flexible, loosely-coupled mechanism for service discovery.</p>



<p class="wp-block-paragraph"><br><strong>3. What is CoreDNS?</strong></p>



<p class="wp-block-paragraph">CoreDNS is&nbsp;<strong>a flexible, extensible DNS server that can serve as the Kubernetes cluster DNS</strong>. Like Kubernetes, the CoreDNS project is hosted by the CNCF.</p>



<p class="wp-block-paragraph"><br><strong>4. Use of CoreDNS?</strong></p>



<p class="wp-block-paragraph">You can use CoreDNS instead of kube-dns in your cluster by replacing kube-dns in an existing deployment, or by using tools like kubeadm that will deploy and upgrade the cluster for you.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<h1 class="wp-block-heading">Network Policy</h1>



<ul class="wp-block-list"><li>https://kubernetes.io/docs/concepts/cluster-administration/addons/</li></ul>



<h2 class="wp-block-heading">Assignment &#8211; 7</h2>



<p class="wp-block-paragraph">What is “kubernetes” svc in default ns and what is the use of it?<br><br>Kubenetes is the name of default service for default Namespace</p>



<p class="wp-block-paragraph"></p>


<pre class="wp-block-code"><span><code class="hljs language-xml">&#91;root@kishore ~]# kubectl get pods --all-namespaces
NAMESPACE     NAME                                         READY   STATUS    RESTARTS   AGE
default       nginx                                        1/1     Running   0          2d
default       nodehelloworld.example.com                   1/1     Running   0          2d1h
kube-system   coredns-558bd4d5db-7tkt7                     1/1     Running   2          5d1h
kube-system   coredns-558bd4d5db-lbb7w                     1/1     Running   2          5d1h
kube-system   etcd-kishore.master.com                      1/1     Running   2          5d1h
kube-system   kube-apiserver-kishore.master.com            1/1     Running   2          5d1h
kube-system   kube-controller-manager-kishore.master.com   1/1     Running   2          5d1h
kube-system   kube-proxy-4x5cd                             1/1     Running   2          5d1h
kube-system   kube-proxy-77wzg                             1/1     Running   0          3d1h
kube-system   kube-scheduler-kishore.master.com            1/1     Running   2          5d1h
kube-system   weave-net-ncz28                              2/2     Running   6          5d1h
kube-system   weave-net-vbxsh                              2/2     Running   0          3d1h

&#91;root@kishore ~]# kubectl get svc --all-namespaces
NAMESPACE     NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
default       kubernetes   ClusterIP   10.96.0.1    <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>        443/TCP                  5d1h
kube-system   kube-dns     ClusterIP   10.96.0.10   <span class="hljs-tag">&lt;<span class="hljs-name">none</span>&gt;</span>        53/UDP,53/TCP,9153/TCP   5d1h
&#91;root@kishore ~]#</code></span></pre>


<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>POD LifeCycle – Kishore Reddy</title>
		<link>https://www.bestdevops.com/pod-lifecycle-kishore-reddy/</link>
		
		<dc:creator><![CDATA[Kishore Reddy]]></dc:creator>
		<pubDate>Thu, 22 Jul 2021 13:28:41 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=18159</guid>

					<description><![CDATA[What is POD ? It has one or more containers It&#8217;s your application or service It&#8217;s the most basic unit [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">What is POD ?</h2>



<ul class="wp-block-list"><li>It has one or more containers</li><li>It&#8217;s your application or service</li><li>It&#8217;s the most basic unit of work</li><li>Unit of scheduling</li><li>Ephemeral &#8211; no POD is ever &#8220;redeployed&#8221;</li><li>Atomicity &#8211; They are there or NOT</li><li>PODS can communicate through network.</li><li>POD get an IP address by kube-proxy</li><li>Load balance connects to POD&#8217;s as POD have IP address NOT containers</li><li>POD is running until we have containers are running inside it</li><li>All containers in POD have the same environment like NET, MNT, IPC &#8230;</li></ul>



<h2 class="wp-block-heading">Understanding the POD Lifecycle</h2>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="960" height="288" src="https://www.bestdevops.com/wp-content/uploads/2021/07/POD-Lifecycle.png" alt="" class="wp-image-18160" srcset="https://www.bestdevops.com/wp-content/uploads/2021/07/POD-Lifecycle.png 960w, https://www.bestdevops.com/wp-content/uploads/2021/07/POD-Lifecycle-300x90.png 300w, https://www.bestdevops.com/wp-content/uploads/2021/07/POD-Lifecycle-768x230.png 768w" sizes="auto, (max-width: 960px) 100vw, 960px" /></figure>


<pre class="wp-block-code"><span><code class="hljs language-javascript">Pod Phase                                       Description

Pending                   After you create the Pod object, <span class="hljs-keyword">this</span> is its initial phase. Until the pod
                          is scheduled to a node and the images <span class="hljs-keyword">of</span> its containers are pulled and started,
                          it remains <span class="hljs-keyword">in</span> <span class="hljs-keyword">this</span> phase.

Running                   At least one <span class="hljs-keyword">of</span> the pod’s containers is running.

Succeeded                 Pods that aren’t intended to run indefinitely are marked <span class="hljs-keyword">as</span> Succeeded when all
                          their containers complete successfully.

Failed                    When a pod is not configured to run indefinitely and at least one <span class="hljs-keyword">of</span> its
                          containers terminates unsuccessfully, the pod is marked <span class="hljs-keyword">as</span> Failed.

Unknown                   The state <span class="hljs-keyword">of</span> the pod is unknown because the Kubelet has stopped reporting
                          communicating <span class="hljs-keyword">with</span> the API server. Possibly the worker node has failed or has
                          disconnected <span class="hljs-keyword">from</span> the network.</code></span></pre>


<h2 class="wp-block-heading"></h2>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Kubernetes – Architecture – Kishore Reddy</title>
		<link>https://www.bestdevops.com/kubernetes-volume1-kishore-reddy/</link>
		
		<dc:creator><![CDATA[Kishore Reddy]]></dc:creator>
		<pubDate>Thu, 22 Jul 2021 07:03:07 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=18066</guid>

					<description><![CDATA[Benefits of Kubernetes Speed of the deployment Ability to absorb the change quicky Ability to recover quickly Hide complexity in [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Benefits of Kubernetes</h2>



<ul class="wp-block-list"><li>Speed of the deployment</li><li>Ability to absorb the change quicky</li><li>Ability to recover quickly</li><li>Hide complexity in Cluster</li><li>Storage Orchestration</li><li>Secret and config management</li><li>Automatic bin packing</li><li>Self healing</li><li>Automated roll outs and rollbacks</li><li>Service discovery and load balancing</li></ul>



<h2 class="wp-block-heading">How does Kubernetes works ?</h2>


<pre class="wp-block-code"><span><code class="hljs">Kubernetes supports several base container engines, and Docker is just one of them. The two technologies work great together, since Docker containers are an efficient way to distribute packaged applications, and Kubernetes is designed to coordinate and schedule those applications.</code></span></pre>


<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="660" height="553" src="https://www.bestdevops.com/wp-content/uploads/2021/07/Kubernetes-architecture-2.png" alt="" class="wp-image-18075" srcset="https://www.bestdevops.com/wp-content/uploads/2021/07/Kubernetes-architecture-2.png 660w, https://www.bestdevops.com/wp-content/uploads/2021/07/Kubernetes-architecture-2-300x251.png 300w" sizes="auto, (max-width: 660px) 100vw, 660px" /></figure>



<h2 class="wp-block-heading">What are the components we have in K8&#8217;s Master ?</h2>



<ul class="wp-block-list"><li>kube-apiserver &#8211; It acts as front end control panel, Consumes JSON files and Exposes the REST API&#8217;s</li><li>Clster Store(etcd) &#8211; It persistent the storage of cluster state and configuration</li><li>Controller manager &#8211; It&#8217;s nothing but controller of controllers like it controls the Node controller, Endpoint controller and Namespace controllers etc..</li><li>Scheduler &#8211; It assigns work to nodes.</li></ul>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="773" height="628" src="https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-master-elements.png" alt="" class="wp-image-18092" srcset="https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-master-elements.png 773w, https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-master-elements-300x244.png 300w, https://www.bestdevops.com/wp-content/uploads/2021/07/kubernetes-master-elements-768x624.png 768w" sizes="auto, (max-width: 773px) 100vw, 773px" /></figure>



<h2 class="wp-block-heading">What are the components we have in Worker node ?</h2>



<ul class="wp-block-list"><li>kubelet &#8211; It register the node with K8&#8217;s cluster, Watches api server for any work, reports back to K8&#8217;s master</li><li>Container Runtime &#8211; It pulls the images from docker hub and runs it.</li><li>kube-proxy &#8211; It handles the network traffic and all containers in pod share a single IP</li></ul>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="804" height="534" src="https://www.bestdevops.com/wp-content/uploads/2021/07/components-worker-node-kubernetes-1.png" alt="" class="wp-image-18091" srcset="https://www.bestdevops.com/wp-content/uploads/2021/07/components-worker-node-kubernetes-1.png 804w, https://www.bestdevops.com/wp-content/uploads/2021/07/components-worker-node-kubernetes-1-300x199.png 300w, https://www.bestdevops.com/wp-content/uploads/2021/07/components-worker-node-kubernetes-1-768x510.png 768w" sizes="auto, (max-width: 804px) 100vw, 804px" /></figure>



<h2 class="wp-block-heading">What are the components we have in Workstation ?</h2>


<pre class="wp-block-code"><span><code class="hljs">Kubernetes has a decentralized architecture that does not handle tasks sequentially. It functions based on a declarative model and implements the concept of a ‘desired state.’</code></span></pre>


<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="616" height="471" src="https://www.bestdevops.com/wp-content/uploads/2021/07/Workstation.png" alt="" class="wp-image-18100" srcset="https://www.bestdevops.com/wp-content/uploads/2021/07/Workstation.png 616w, https://www.bestdevops.com/wp-content/uploads/2021/07/Workstation-300x229.png 300w" sizes="auto, (max-width: 616px) 100vw, 616px" /></figure>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Docker – Kishore Reddy</title>
		<link>https://www.bestdevops.com/docker-lab-assignment-kishore-reddy/</link>
		
		<dc:creator><![CDATA[Kishore Reddy]]></dc:creator>
		<pubDate>Wed, 21 Jul 2021 04:51:05 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=17781</guid>

					<description><![CDATA[Step 1 – Register a site to POST Assigment and Share with Trainer and For Self Notes Step 2 – [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Step 1 – Register a site to POST Assigment and Share with Trainer and For Self Notes</h2>


<pre class="wp-block-code"><span><code class="hljs language-php">- How to register? - https:<span class="hljs-comment">//www.bestdevops.com/wp-login.php?action=register</span>
<span class="hljs-comment"># Check Inbox SPAM box for Activation Email.</span>
- How to login? - https:<span class="hljs-comment">//www.bestdevops.com/wp-login.php</span>
- How to write post? - https:<span class="hljs-comment">//www.bestdevops.com/wp-admin/post-new.php</span>
- How to check your Post? - https:<span class="hljs-comment">//www.bestdevops.com</span></code></span></pre>


<h2 class="wp-block-heading">Step 2 – Pre Test using LMS</h2>



<ul class="wp-block-list"><li>Login to https://www.devopsschool.com/lms/ using any gmail account</li><li>Try this quiz – https://www.devopsschool.com/lms/mod/quiz/view.php?id=250</li><li>Send a results to shiva@palmeto.co.in</li></ul>



<h2 class="wp-block-heading">Step 3 – Install Docker Engine in Centos#1 Vm.</h2>



<figure class="wp-block-embed"><div class="wp-block-embed__wrapper">
https://devopsschool.com/tutorial/docker/install-config/docker-install-commuityedition-centos-rhel.html
</div></figure>



<h2 class="wp-block-heading">Step 4 – Assignment#1</h2>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:100%">
<ul class="wp-block-list"><li>Create a Ubuntu container<br>docker run -it ubuntu<br>It will fetch the ubuntu docker image from docker hub and you will be connected to container in detached mode.</li><li>Install Update, git &amp; apache2<br>Once your inside of your Ubintu docker container, Run<br>apt-get update &#8211;&gt; It will install the latest version of packages matches the specified group of packages.<br>apt-get install git &#8211;&gt; It will install the Git package and all it&#8217;s dependency packages</li></ul>



<p class="wp-block-paragraph">root@8196a7b58778:/# git &#8211;version<br>git version 2.25.1<br>root@8196a7b58778:/#</p>



<p class="wp-block-paragraph">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; apt-get install apache2 &#8211;&gt; It will install the apache2 package and all it&#8217;s dependency</p>



<p class="wp-block-paragraph">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;packages</p>



<p class="wp-block-paragraph">root@8196a7b58778:/# apache2 -v<br>Server version: Apache/2.4.41 (Ubuntu)<br>Server built: 2021-07-05T07:16:56<br>root@8196a7b58778:/#</p>



<ul class="wp-block-list"><li>Run a git command in container from outside</li></ul>



<p class="wp-block-paragraph">docker exec &lt;containerId&gt; git &#8211;version<br><br></p>



<p class="wp-block-paragraph">[root@localhost ~]# docker ps -a<br>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES<br>73a91b4435f6 httpd &#8220;httpd-foreground&#8221; 19 minutes ago Up 19 minutes 0.0.0.0:8081-&gt;80/tcp festive_mahavira<br>8196a7b58778 ubuntu &#8220;bash&#8221; 48 minutes ago Exited (130) 22 seconds ago hungry_goldwasser<br>d1b6f4921a3e hello-world &#8220;/hello&#8221; About an hour ago Exited (0) About an hour ago epic_kirch<br>[root@localhost ~]# docker exec 8196a7b58778 git &#8211;version<br>Error response from daemon: Container 8196a7b58778f172fabd431d26a9094b022b3d9019099537b682b4586168651b is not running<br>[root@localhost ~]# docker start 8196a7b58778<br>8196a7b58778<br>[root@localhost ~]# docker exec 8196a7b58778 git &#8211;version<br>git version 2.25.1<br>[root@localhost ~]#</p>
</div>
</div>



<h2 class="wp-block-heading">Step 5 – Assignment#2</h2>



<ul class="wp-block-list"><li>Create a httpd container exposed at 8080 port<br><br>docker run -d -p 8080:80 httpd</li><li>Access (curl) container from node</li></ul>



<p class="wp-block-paragraph">[root@localhost ~]# curl http://192.168.2.28:8080<br></p>



<h1 class="wp-block-heading">It works!</h1>



<p class="wp-block-paragraph">[root@localhost ~]#</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Step 6 – Assignment#3</h2>


<pre class="wp-block-code"><span><code class="hljs language-php">Find out answer <span class="hljs-keyword">for</span> following questions
- Where is the LOCAL Registry <span class="hljs-keyword">and</span> How <span class="hljs-keyword">do</span> i find out???
When you run the docker info command it will provide all the info about your docker. In that info, You can find the root dir of docker where it<span class="hljs-string">'s being installed in your base/host machine some thing like below, 
&#91;root@localhost ~]# cd /var/lib/docker
&#91;root@localhost docker]# ls
containers  image  network  overlay2  plugins  swarm  tmp  trust  volumes
&#91;root@localhost docker]# cd image
&#91;root@localhost image]# ls
overlay2
&#91;root@localhost image]# cd overlay2/
&#91;root@localhost overlay2]# ls
distribution  imagedb  layerdb  repositories.json
&#91;root@localhost overlay2]# cd imagedb/
&#91;root@localhost imagedb]# ls
content  metadata
&#91;root@localhost imagedb]# cd content/
&#91;root@localhost content]# ls
sha256
&#91;root@localhost content]# cd sha256/
&#91;root@localhost sha256]# ls
bd29370f84eac6a9fa5373f8ed702f66820e784e5f680b62670af9f851017c96  c29284518f497b8c5f49933e74e43ca5221e69c8251e780427f7d12f716625ff  d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726
&#91;root@localhost sha256]# ls -lrt
total 20
-rw-------. 1 root root 1470 Jul 21 00:41 d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726
-rw-------. 1 root root 1462 Jul 21 00:43 c29284518f497b8c5f49933e74e43ca5221e69c8251e780427f7d12f716625ff
-rw-------. 1 root root 8701 Jul 21 01:33 bd29370f84eac6a9fa5373f8ed702f66820e784e5f680b62670af9f851017c96
&#91;root@localhost sha256]# pwd
/var/lib/docker/image/overlay2/imagedb/content/sha256
&#91;root@localhost sha256]#

- &#91;OFFLINE]Git is NOT versioning a file. So what?
Git is a distributed version control system system that records different states file/files/set of files.
It lets users to access, compare, update and distribute any of the recorded version(s) at any time.

- What is diff between docker pause and docker unpuase?

docker pause - It suspends all the processes in specified containers. It pauses(i.e sends SIGSTOP) all     
               the processes in a container and also it would stall keep memory portion while container
               is pause.  This memory is used while container is resumed.
docker unpause - When docker unpassed, SIGCONT is passed to container to restore the container process.
NOTE: You couldn'</span>t able to perform any action <span class="hljs-keyword">while</span> container is paused.

- What is significant of docker stop <span class="hljs-keyword">and</span> docker kill?
docker stop - It stops the container gracefully(In <span class="hljs-number">10</span>sec) like how shutting down your laptop instead of
              forcefully shutting down. It will send SIGTERM(terminate) to the process <span class="hljs-keyword">and</span> docker will
              have <span class="hljs-number">10</span> sec to cleanup like files <span class="hljs-keyword">or</span> other stuff.
docker kill - It will kill a container(sends SIGKILL). The main process inside the container will be sent
              SIGKILL to kill a container forcefully. 

- Create an image with base - centos <span class="hljs-keyword">and</span> git must be installed in it.

We can <span class="hljs-keyword">do</span> it using dockerfile in automation process <span class="hljs-keyword">and</span> reusable also.Below is the sample docker file
which will have centos an base image along with Git is installed in it,

FROM centos:latest

MAINTAINER Kishore Katreddy

RUN yum -y update
RUN yum -y install git
CMD &#91;<span class="hljs-string">"google.com"</span>]

Once I have dcoekr file handy. I ran below command to build an image which has base image of centos <span class="hljs-keyword">and</span> git is being installed,

 -&gt; docker build -t centos:<span class="hljs-number">1.0</span><span class="hljs-number">.0</span> .(Location of where you have dockerfile)
 -&gt; docker images - You can see the image which we built
     &#91;root@localhost kishoreLab]<span class="hljs-comment"># docker images</span>
     REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
     centos                  <span class="hljs-number">1.0</span><span class="hljs-number">.0</span>               <span class="hljs-number">56</span>f868464603        <span class="hljs-number">2</span> minutes ago       <span class="hljs-number">641</span> MB

</code></span></pre>


<h2 class="wp-block-heading">Step 7 – SHARE ASSIGNMENT WITH TRAINER</h2>



<ul class="wp-block-list"><li>Create a POST and Send a URL of post in Zoom Chat.</li><li>Of Assignment#1 – Assignment#2 – Assignment#3 in one post</li><li>Post title can be of your choise</li></ul>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
