<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Debug School: mounicapalacharla96@gmail.com</title>
    <description>The latest articles on Debug School by mounicapalacharla96@gmail.com (@mounicapalacharla96_782).</description>
    <link>https://www.debug.school/mounicapalacharla96_782</link>
    <image>
      <url>https://www.debug.school/images/CPDdQlGexClW9WOTxwLbEDeLKxuBxqind7bvkmstzXo/rs:fill:90:90/g:sm/mb:500000/ar:1/aHR0cHM6Ly90aGVw/cmFjdGljYWxkZXYu/czMuYW1hem9uYXdz/LmNvbS9pLzk5bXZs/c2Z1NXRmajltN2t1/MjVkLnBuZw</url>
      <title>Debug School: mounicapalacharla96@gmail.com</title>
      <link>https://www.debug.school/mounicapalacharla96_782</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://www.debug.school/feed/mounicapalacharla96_782"/>
    <language>en</language>
    <item>
      <title>Day 2 assignment - Docker understanding</title>
      <dc:creator>mounicapalacharla96@gmail.com</dc:creator>
      <pubDate>Wed, 26 Apr 2023 09:41:48 +0000</pubDate>
      <link>https://www.debug.school/mounicapalacharla96_782/day-2-assignment-docker-understanding-4lnp</link>
      <guid>https://www.debug.school/mounicapalacharla96_782/day-2-assignment-docker-understanding-4lnp</guid>
      <description>&lt;h3&gt;
  
  
  Docker commands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;docker cp sample.txt container_id:/path/in/container&lt;/strong&gt;:
docker cp command is used to copy the files/folders from local file system to running container.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;docker cp container_id:/path/in/container sample.txt&lt;/strong&gt;:
This will copy files/folder from the container to your local FS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;docker diff container_id&lt;/strong&gt;:
Changes done to any folders or files in the container after running it will be captured by this command.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;docker port container_id&lt;/strong&gt;:
This command tells us info about the port mapping of the container with host machine.
For example, I have port forwarded an elasticsearch container port 9200  to 9191 port in my local.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -itd -p 9191:9200  elasticsearch:6.5.4
CONTAINER ID   IMAGE                 COMMAND                  CREATED              STATUS              PORTS                              NAMES
63a7dbbe30bd   elasticsearch:6.5.4   "/usr/local/bin/dock…"   2 seconds ago        Up 1 second         9300/tcp, 0.0.0.0:9191-&amp;gt;9200/tcp   focused_williamson
==========================================================
docker port 63a7dbbe30bd
9200/tcp -&amp;gt; 0.0.0.0:9191
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Port forwarding helps us in accessing the services/application running inside the container from outside. port forwarding makes the process running in container on a specific port to be available on host machine port.&lt;br&gt;
Make sure that the host machine port that we are forwarding to should not be already in use. Or else we will face errors.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;docker rename container_id any_name_of_choice&lt;/strong&gt;:
This will rename the container&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To inspect the logs of a container.&lt;br&gt;
&lt;strong&gt;docker logs container_id&lt;/strong&gt;:&lt;br&gt;
This helps to analyse what is happening with the process running in the container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;docker top container_id&lt;/strong&gt;:&lt;br&gt;
Gives the info on what is the host PID of the running container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;docker events&lt;/strong&gt;:&lt;br&gt;
Gives all the events/logging happening for the docker daemon&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;docker update&lt;/strong&gt;:&lt;br&gt;
docker update is used to update configs of containers. We can set cpu resources,restart policy, memory limitations etc.&lt;br&gt;
Example: Add a restart policy to a container that was already created&lt;br&gt;
docker update --restart=always container_id&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;docker wait&lt;/strong&gt;:&lt;br&gt;
This command is used to wait or block until the container stops and then it outputs their exit codes, which means we cannot use our terminal if we are running this command on terminal&lt;br&gt;
Example: I created a container named test and started wait command on it. This blocks the terminal where the command is running and when in other terminal I killed the container the output is 137 exit code which is expected in case of kill. It will be 0 if graceful shut down.&lt;br&gt;
docker wait test&lt;br&gt;
137&lt;br&gt;
This command is used when we have certain tasks to be completed before starting another container. So we wait on the first container to be completed and then start with the others.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Docker Images:
&lt;/h3&gt;

&lt;p&gt;Docker image is a collection of filesystes(Root FS(which also includes the user FS) + Application FS).&lt;br&gt;
When creating a container all layers if image are merged together and are mounted to the container.&lt;br&gt;
/var/lib/docker(this can be found in docker info command) is the path to get the info of the file system layers associated with image.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inorder to save the changes done(Like adding new files/folders, changing existing ones) to a container in the form of an image, we can use commit command
&lt;strong&gt;docker commit -m "commit message" -a "author name" container_id new_name_of_the_image&lt;/strong&gt;
This command commits all the changes done to the container given in the command to a new image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;docker history new_name_of_the_image&lt;/strong&gt;:
To check what are the changes done on top of existing image, we can use history command on the committed image.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To save the image as a tar,&lt;br&gt;
&lt;strong&gt;docker save -o name.tar name_of_image&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To load the image which is saved as  tar,&lt;br&gt;
&lt;strong&gt;docker load -i name.tar&lt;/strong&gt;:&lt;br&gt;
Check the images using docker images command to see if the tar is loaded.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To share an image with larger group of people then tar is not a feasible option, so we push the image to a docker registry from where everyone can access the image.&lt;br&gt;
&lt;strong&gt;&lt;u&gt;Steps:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;docker login&lt;/strong&gt; -&amp;gt; Login to the registry.(should have created an account prior)&lt;/li&gt;
&lt;li&gt;tag the docker image according to the repository created in your registry. The name of docker image is the repository and we will face errors while pushing if the repository we specified doesn't exist.
&lt;strong&gt;docker tag my_image mounica/devopsschool&lt;/strong&gt; -&amp;gt; This tags my_image which is in my local to mounica/devopsschool(repository name in registry)&lt;/li&gt;
&lt;li&gt;*&lt;em&gt;docker push mounica/devopsschool *&lt;/em&gt; -&amp;gt; push to Registry&lt;/li&gt;
&lt;li&gt;We can validate the same using &lt;strong&gt;docker pull mounica/devopsschool&lt;/strong&gt; -&amp;gt; this should pull your image from registry.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Kubernetes Introduction</title>
      <dc:creator>mounicapalacharla96@gmail.com</dc:creator>
      <pubDate>Wed, 26 Apr 2023 09:30:43 +0000</pubDate>
      <link>https://www.debug.school/mounicapalacharla96_782/kubernetes-introduction-1oke</link>
      <guid>https://www.debug.school/mounicapalacharla96_782/kubernetes-introduction-1oke</guid>
      <description>&lt;h3&gt;
  
  
  What is Kubernetes?
&lt;/h3&gt;

&lt;p&gt;Kubernetes in short called k8s is a container orchestrator tool.&lt;br&gt;
k8s helps in application management with advantages like scalability, workload management, better networking management etc..&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Kubernetes
&lt;/h3&gt;

&lt;p&gt;To avoid conflict of services running in a container with that of services running in a different container but same port. Also to easily manage multiple containers at the same time. Updating/patching or replicating applications is easy with kubernetes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Explained Kubernetes Architecture
&lt;/h3&gt;

&lt;p&gt;The three main components involved are the master node (control plane), worker node, workstation (accessing/requesting kubernetes).&lt;br&gt;
kubectl is one of the tool, with which we can query our requirements to kubernetes and this reaches the master node and is scheduled accordingly to the worker node.&lt;br&gt;
Master and worker nodes run together in a k8s cluster.&lt;br&gt;
All the management happens in the master node whereas the actual application runs in the worker node.&lt;br&gt;
A master node can be both master and a worker node, but reverse is not possible.&lt;/p&gt;

&lt;h3&gt;
  
  
  Master Components
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;kube-api-server : This is the point of contact for all the communication that happens in and out the k8s cluster. All the components interact with api-server.&lt;/li&gt;
&lt;li&gt;Storage : etcd is the storage component and it is powered by CNCF. This takes care of storing all the updates like the current state of cluster in form of key-value pair.&lt;/li&gt;
&lt;li&gt;Kube-controller-Manager: This is a service/daemon that runs continuously to see if the actual and desired state of cluster are matching. &lt;/li&gt;
&lt;li&gt;Kube-scheduler: This is reponsible for schedulling all the work to worker nodes.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Worker Components
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;kubelet : This is an agent which runs on every worker node and checks with api-server for any updates to be done to the pods running in the node. Default port on which it runs is 10255&lt;/li&gt;
&lt;li&gt;container engine: Which we use to manage the conatiner inside the pod. example: containerd&lt;/li&gt;
&lt;li&gt;kube-proxy: For networking capability&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Workstation Components:
&lt;/h3&gt;

&lt;p&gt;kubectl(we can use json or yaml)&lt;/p&gt;

&lt;h3&gt;
  
  
  What is POD?
&lt;/h3&gt;

&lt;p&gt;pod is the atomic unit of schedulling. It is a logical unit not a physical one. Pod can have one or more container running in it. The actual work/application will be running in the pods.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day 1 Assignment</title>
      <dc:creator>mounicapalacharla96@gmail.com</dc:creator>
      <pubDate>Tue, 25 Apr 2023 12:20:20 +0000</pubDate>
      <link>https://www.debug.school/mounicapalacharla96_782/day-1-assignment-2pkf</link>
      <guid>https://www.debug.school/mounicapalacharla96_782/day-1-assignment-2pkf</guid>
      <description>&lt;h3&gt;
  
  
  What is Docker?
&lt;/h3&gt;

&lt;p&gt;Docker is a container management tool. The unit of execution in this tool is called container.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why We need docker?
&lt;/h3&gt;

&lt;p&gt;Inorder to ease the tight coupling with host OS and the kernel and also effective utilisation of resources like CPU and memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Container?
&lt;/h3&gt;

&lt;p&gt;Container is a light weight runtime environment which uses less CPU,RAM and less storage. Each container has its own network,Mount, PID tree.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Container Works?
&lt;/h3&gt;

&lt;p&gt;Docker has a container runtime (like containerd) running, which interacts with kernel.&lt;br&gt;
Docker container runs as per instructions in the docker image. Each container has its own user, resources(kernel namespace, cgroups). containerd requests kernel for resources for the specific user and tags them to that. Similar way other container will have its own resources. So we can have multiple users running parallly without any interaction with each other.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to install Docker?
&lt;/h3&gt;

&lt;p&gt;Docker installation steps varies from the OS to OS. Based on the host OS, we can select the appropriate package installers like apt,yum,rpm based or we also have scripts available for the same in open source.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the components docker?
&lt;/h3&gt;

&lt;p&gt;Docker is a client server architecture.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Docker client/Docker Engine: This takes care of sending/routing the docker instructions we give, to the docker server running in our system.&lt;/li&gt;
&lt;li&gt;Docker server/ Docker D: docker daemon once receives the instruction sends it to the container and contiainer sends it to the kernel and this is how the process goes on.&lt;/li&gt;
&lt;li&gt;Docker Images: Docker Image is the heart of the container. The executable format of a Dockerfile is docker image. Dockerfile consists of all the instructions on how the process inside the container should behave.&lt;/li&gt;
&lt;li&gt;Docker Registry: This is like a store/repo for docker images. We can pull/push from the registry. Always when running a container it first checks if the image is present in local, if not it pulls from the registry. The registry details can be found from the command
"docker info"&lt;/li&gt;
&lt;li&gt;Docker container&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  What is a container lifecycle commands?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;docker create - create a container&lt;/li&gt;
&lt;li&gt;docker start container_id - start the container&lt;/li&gt;
&lt;li&gt;docker pause container_id - pause a running container&lt;/li&gt;
&lt;li&gt;docker unpause container_id- unpause paused container&lt;/li&gt;
&lt;li&gt;docker stop container_id- stop running container&lt;/li&gt;
&lt;li&gt;docker remove or docker rm container_id - remove stopped container&lt;/li&gt;
&lt;li&gt;Container can only be removed if it is not running.&lt;/li&gt;
&lt;li&gt;Special case is killing container without stopping it. container gets killed if there is any issue with the process running in it.
command: docker kill container_id&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  What is docker pause/unpuase?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;docker pause container_id&lt;/strong&gt; - Pauses the container. This means there will not be any cpu allocated for this container. But we can see memory attached to it eventhough paused&lt;br&gt;
&lt;strong&gt;docker unpause container_id&lt;/strong&gt; - unpause the paused container so that cpu gets allocated and we can access the container.&lt;br&gt;
cpu is allocated only when we access the container.&lt;br&gt;
docker stats - command gives the details of resource utilisation&lt;/p&gt;

&lt;h3&gt;
  
  
  What is docker stop/kill?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;docker stop &lt;/strong&gt; - runs a graceful container stop where the exit code will be 0. This means that the process running inside container has been completed succesfully.&lt;br&gt;
&lt;strong&gt;docker kill container_id&lt;/strong&gt; - This is a forceful container stop and the exit code will be anything other than 0. Like 137,2 etc.. This can be due to abrupt shutdown of the process running or manual kill by the user.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to get inside a container?
&lt;/h3&gt;

&lt;p&gt;exec commands are used to get inside container&lt;br&gt;
docker exec -it container_id /bin/bash&lt;br&gt;
Here the shell can vary upon the user's requirement. In this command we are executing and interactive terminal to the container as a bash shell.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to access container from outside?
&lt;/h3&gt;

&lt;p&gt;This can be done through the network. &lt;br&gt;
**Docker inspect container_id **gives the ip details of the container and we can curl or ping to the ip to know the status of the process (http or nginx). Other way is to port forward it to local and access it from host machines network itself.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the rule for container is running?
&lt;/h3&gt;

&lt;p&gt;For a container to be in running state, the Process ID 1 (PID 1) should be always running. This can be any process unlike VM and PC where the PID 1 is a system process.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
