<?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>DEV Community: Sarthak Rajput</title>
    <description>The latest articles on DEV Community by Sarthak Rajput (@rsarthak).</description>
    <link>https://dev.to/rsarthak</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F729740%2Fd98b2889-1397-40a8-9784-66131d673a71.jpeg</url>
      <title>DEV Community: Sarthak Rajput</title>
      <link>https://dev.to/rsarthak</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rsarthak"/>
    <language>en</language>
    <item>
      <title>Hoisting- Mastering the Art of Code Elevation</title>
      <dc:creator>Sarthak Rajput</dc:creator>
      <pubDate>Sat, 30 Sep 2023 04:43:53 +0000</pubDate>
      <link>https://dev.to/rsarthak/hoisting-mastering-the-art-of-code-elevation-ncn</link>
      <guid>https://dev.to/rsarthak/hoisting-mastering-the-art-of-code-elevation-ncn</guid>
      <description>&lt;p&gt;Table Of Contents&lt;/p&gt;

&lt;p&gt;Introduction&lt;br&gt;
        What is hoisting?&lt;br&gt;
        JavaScript code execution context&lt;br&gt;
        The concept of Variable hoisting&lt;br&gt;
        Function Hoisting&lt;br&gt;
        Temporary Dead Zone(TDZ)&lt;br&gt;
        Conclusion&lt;/p&gt;

&lt;p&gt;Introduction&lt;br&gt;
Developers frequently experience a complex relationship with JavaScript due to occasional unexpected behavior. Proficiency in JavaScript fundamentals, including its idiosyncrasies, can empower developers to effectively debug and craft elegant code. This blog post is dedicated to unraveling one such distinctive feature—hoisting, presented using multiple images. After perusing this blog, you'll be on your way to becoming a top-notch developer.&lt;/p&gt;

&lt;p&gt;What is hoisting?&lt;br&gt;
JavaScript Hoisting is the phenomenon in which the interpreter seems to shift the declaration of functions, variables, classes, or imports to the beginning of their scope before running the code , making them available for use throughout that scope, regardless of where they are declared in the code. It's important to note that only the declarations themselves are hoisted, while any assignments or initializations remain in their original positions.&lt;br&gt;
In a simpler way- In JavaScript, Wherever you have declared the variable, it will move to the Top of the scope irrespective of their Global/local scopes.&lt;/p&gt;

&lt;p&gt;JavaScript code execution context&lt;br&gt;
The term "JavaScript Code Execution Context" denotes the surroundings in which JavaScript code operates. It encompasses multiple facets of code execution, encompassing scope and its chain, declarations of variables and functions, as well as the utilization of the "this" keyword.&lt;br&gt;
Basically, the JavaScript execution context is divided into two parts:&lt;/p&gt;

&lt;p&gt;1.Creation Phase: In the Creation Phase, Variables are allotted their memory space and initialized with the value &lt;code&gt;undefined&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;2.Execution phase: In execution phase, declared variables are assigned the values or code and used to process further operations.&lt;/p&gt;

&lt;p&gt;The concept of Variable hoisting&lt;br&gt;
Variable hoisting in JavaScript is a mechanism that seemingly elevates variable declarations defined with the &lt;code&gt;var&lt;/code&gt; keyword to the top of their enclosing function or global scope during the compilation phase, prior to the actual code execution. This effect creates the illusion that variable declarations are "lifted" to the top of their respective scopes.&lt;br&gt;
Lets explain with a simple example:&lt;/p&gt;

&lt;p&gt;Function Hoisting&lt;br&gt;
Function hoisting in JavaScript is a phenomenon that involves the apparent relocation of function declarations to the beginning of their enclosing scope during the compilation phase. This relocation grants functions accessibility throughout their scope, even before their physical appearance in the code. Consequently, you have the ability to invoke a function prior to declaring it in your code, without triggering any errors. This principle of function hoisting pertains to both named and anonymous functions.&lt;br&gt;
Lets understand with the help of an example:&lt;/p&gt;

&lt;p&gt;Temporal Dead Zone(TDZ)&lt;br&gt;
The term "temporal dead zone" in JavaScript signifies a phase in code execution wherein variables declared using &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are recognized as being within the scope but have not yet received an assigned value. In essence, these variables are in a state of "temporary unavailability" during this period.&lt;br&gt;
Within the temporal dead zone (TDZ), which extends from the moment of variable declaration until it is initialized with a value, any attempt to access the variable will trigger a "Reference Error". This safeguards against the utilization of variables before they are properly initialized, contributing to improved code reliability and safety.&lt;br&gt;
The temporal dead zone is a protective feature in JavaScript that ensures variables declared with let and const are only accessible after they have been properly initialized, preventing the use of uninitialized variables and potential bugs.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
In conclusion, hoisting in JavaScript is a noteworthy and sometimes perplexing feature that impacts how variables and function declarations are processed during code execution. Understanding hoisting is vital for writing clean and predictable JavaScript code. By comprehending how hoisting works, you can harness its power to organize your code effectively and avoid common pitfalls, ultimately becoming a more proficient JavaScript developer.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Getting Started With Kubernetes: Introduction and Architecture</title>
      <dc:creator>Sarthak Rajput</dc:creator>
      <pubDate>Mon, 24 Oct 2022 08:57:39 +0000</pubDate>
      <link>https://dev.to/rsarthak/getting-started-with-kubernetes-introduction-and-architecture-5fnl</link>
      <guid>https://dev.to/rsarthak/getting-started-with-kubernetes-introduction-and-architecture-5fnl</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PlXg-x-o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rqv2lxmljfofqa6vhsee.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PlXg-x-o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rqv2lxmljfofqa6vhsee.png" alt="Image description" width="880" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Kubernetes?
&lt;/h2&gt;

&lt;p&gt;Kubernetes also known as K8S is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. Kubernetes provides you with a framework to run distributed systems resiliently. It takes care of scaling and failover for your application, provides deployment patterns, and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Kubernetes?
&lt;/h2&gt;

&lt;p&gt;One of the primary reasons why K8s became so popular is the ever-growing demand for businesses to support their micro service-driven architectural needs.&lt;/p&gt;

&lt;p&gt;Microservice architecture helps companies in :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Independently develop and deploy their complex applications by breaking them into small scalable modules.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Help them work in multiple small teams supporting individual application modules, to be developed and deployed with the required speed and agility.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1Y72FnUh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crt3uawjeb6zb9nqiwgo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1Y72FnUh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crt3uawjeb6zb9nqiwgo.png" alt="Image description" width="800" height="2000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;

&lt;p&gt;Kubernetes has a cluster which contains &lt;strong&gt;master&lt;/strong&gt; and &lt;strong&gt;worker&lt;/strong&gt; nodes. Master node is responsible for taking the task from user and deploy it on worker nodes. &lt;/p&gt;

&lt;h3&gt;
  
  
  Master Node
&lt;/h3&gt;

&lt;p&gt;The master node is used to manage the states of a cluster. It is actually an entry point for different types of administrative tasks.&lt;/p&gt;

&lt;p&gt;Following are the four different components that exist in the Master node:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;API Server&lt;/u&gt;&lt;/strong&gt;: This component is responsible for all communication that is from user to master node, master to worker node and vice-versa. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Scheduler&lt;/u&gt;&lt;/strong&gt;: The scheduler in a master node schedules the tasks to the worker nodes. And, for every worker node, it is used to store the resource usage information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Controller Manager&lt;/u&gt;&lt;/strong&gt;: The Controller manager is also known as a controller. It is a daemon that executes in the non-terminating control loops. The controllers in a master node perform a task and manage the state of the cluster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;ETCD&lt;/u&gt;&lt;/strong&gt;: It is an open source, distributed key-value database. It is a part of a master node that is written in a GO programming language.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lhm3RFkH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/che5dcge7hb81fwuttfj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lhm3RFkH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/che5dcge7hb81fwuttfj.png" alt="Image description" width="880" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Worker Node
&lt;/h3&gt;

&lt;p&gt;The Worker node in a Kubernetes is also known as minions. A worker node is a physical machine that executes the applications using pods.&lt;/p&gt;

&lt;p&gt;Following are the three main components that exist in the Worker Node:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Kubelet&lt;/u&gt;&lt;/strong&gt;: kubelet is a primary node-agent of the worker node, which interacts with both node and the container in the given worker node. It communicates to API-Server then master node can talk to worker node. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Kube-proxy&lt;/u&gt;&lt;/strong&gt;: It is a core networking component on each node responsible for maintaining network configuration and rules. It exposes services/pods to the outside world. The main aim of this component is request forwarding. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;3.&lt;strong&gt;&lt;u&gt; Container Runtime&lt;/u&gt;&lt;/strong&gt;: It is a software that is responsible for running containers. Example → Docker, CRIO, Kubernetes CRI, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vZnpkD2N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ud1a8y333qhap6y8lj4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vZnpkD2N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ud1a8y333qhap6y8lj4z.png" alt="Image description" width="880" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, We have only learnt what is Kubernetes, why to use it and it's architecture.&lt;br&gt;
If you enjoyed this article then please share it with your buddies and if you have suggestions or thoughts to share with me then please write in the comment box.&lt;br&gt;
The above blog is submitted under &lt;strong&gt;'Devtron Hacktoberfest 2022'&lt;/strong&gt; conducted by &lt;a href="https://devtron.ai/"&gt;Devtron&lt;/a&gt;. Check out their Github repo and give it a star ⭐️ if you like it. Follow Devtron on &lt;a href="https://www.linkedin.com/company/devtron-labs/"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://twitter.com/DevtronL"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>kubernetes</category>
    </item>
  </channel>
</rss>
