<?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>Forem: Saravanan Gnanaguru</title>
    <description>The latest articles on Forem by Saravanan Gnanaguru (@chefgs).</description>
    <link>https://forem.com/chefgs</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F303053%2Fd97f6bd8-5ba4-4e3d-a8ad-6efc603a645a.jpg</url>
      <title>Forem: Saravanan Gnanaguru</title>
      <link>https://forem.com/chefgs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/chefgs"/>
    <language>en</language>
    <item>
      <title>How to Avoid Vulnerabilities in AI-Generated JavaScript and Node.js Projects</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Wed, 08 Apr 2026 07:48:15 +0000</pubDate>
      <link>https://forem.com/chefgs/how-to-avoid-vulnerabilities-in-ai-generated-javascript-and-nodejs-projects-4ggi</link>
      <guid>https://forem.com/chefgs/how-to-avoid-vulnerabilities-in-ai-generated-javascript-and-nodejs-projects-4ggi</guid>
      <description>&lt;h2&gt;
  
  
  Why Your AI Coding Workflow Needs Strict Node.js Rules to Avoid Vulnerabilities
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;The real issue: AI defaults to the average of the internet&lt;/li&gt;
&lt;li&gt;Why this matters more in Node.js than many teams realize&lt;/li&gt;
&lt;li&gt;Why strict rules are necessary&lt;/li&gt;
&lt;li&gt;
What strict rules should cover in a Node.js project

&lt;ul&gt;
&lt;li&gt;Runtime version&lt;/li&gt;
&lt;li&gt;Module system&lt;/li&gt;
&lt;li&gt;TypeScript expectations&lt;/li&gt;
&lt;li&gt;Built-in APIs first&lt;/li&gt;
&lt;li&gt;Testing rules&lt;/li&gt;
&lt;li&gt;Dependency policy&lt;/li&gt;
&lt;li&gt;Security expectations&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;The meeting app example: where this matters in the real world&lt;/li&gt;

&lt;li&gt;What to do in practice&lt;/li&gt;

&lt;li&gt;A sample “rules-first” prompt for modern Node.js development&lt;/li&gt;

&lt;li&gt;Example custom instructions for ChatGPT or Claude&lt;/li&gt;

&lt;li&gt;Example &lt;code&gt;.cursorrules&lt;/code&gt; file&lt;/li&gt;

&lt;li&gt;The bigger lesson&lt;/li&gt;

&lt;li&gt;Closing thought&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;AI code generation tools can speed up development significantly.&lt;/p&gt;

&lt;p&gt;But there is a practical problem many teams quietly run into:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI often generates JavaScript and Node.js code based on older patterns, outdated packages, and legacy ecosystem assumptions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That becomes risky very quickly.&lt;/p&gt;

&lt;p&gt;You ask for a backend service, and the generated code may:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;use older CommonJS patterns even when your project is ESM-first&lt;/li&gt;
&lt;li&gt;suggest outdated libraries that are no longer actively maintained&lt;/li&gt;
&lt;li&gt;pull in packages with weak security posture or unnecessary transitive dependencies&lt;/li&gt;
&lt;li&gt;generate examples that work “in general” but do not fit your runtime, version policy, or production standards&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For teams building modern applications, especially with AI-assisted development, this is no longer a small inconvenience. It is a &lt;strong&gt;security, maintainability, and architecture discipline problem&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is exactly why teams need &lt;strong&gt;strict rules for their Node.js and JavaScript stack&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The real issue: AI defaults to the average of the internet
&lt;/h2&gt;

&lt;p&gt;Large language models are trained on enormous amounts of public code, documentation, tutorials, blog posts, forums, and repositories.&lt;/p&gt;

&lt;p&gt;That means they do not naturally prefer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the newest stable Node.js patterns&lt;/li&gt;
&lt;li&gt;the safest library choices&lt;/li&gt;
&lt;li&gt;your organization’s runtime constraints&lt;/li&gt;
&lt;li&gt;your internal engineering standards&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They often prefer what is most statistically common across historical code.&lt;/p&gt;

&lt;p&gt;And the JavaScript ecosystem has a lot of history.&lt;/p&gt;

&lt;p&gt;That history includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deprecated libraries&lt;/li&gt;
&lt;li&gt;abandoned packages&lt;/li&gt;
&lt;li&gt;insecure examples copied across blogs and repos&lt;/li&gt;
&lt;li&gt;older syntax patterns&lt;/li&gt;
&lt;li&gt;outdated testing stacks&lt;/li&gt;
&lt;li&gt;over-dependence on third-party packages for things now supported natively in Node.js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So unless you explicitly guide the model, AI will often produce code that is technically plausible but operationally dated.&lt;/p&gt;

&lt;p&gt;That is where risk begins.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why this matters more in Node.js than many teams realize
&lt;/h2&gt;

&lt;p&gt;Node.js moves fast, and the npm ecosystem moves even faster.&lt;/p&gt;

&lt;p&gt;That creates a unique problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a package that looked fine two years ago may now be unmaintained&lt;/li&gt;
&lt;li&gt;an older library may still “work” but carry security debt&lt;/li&gt;
&lt;li&gt;one dependency can bring dozens or hundreds of transitive packages&lt;/li&gt;
&lt;li&gt;many vulnerabilities enter not through your direct code, but through your dependency tree&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When AI suggests a package casually, it is not just suggesting one library.&lt;/p&gt;

&lt;p&gt;It may be suggesting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a package with outdated maintainers&lt;/li&gt;
&lt;li&gt;weak release hygiene&lt;/li&gt;
&lt;li&gt;known advisories&lt;/li&gt;
&lt;li&gt;legacy subdependencies&lt;/li&gt;
&lt;li&gt;unnecessary attack surface&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In other words, &lt;strong&gt;bad defaults in JavaScript are expensive&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is why modern Node.js development needs a rules-first mindset, especially when AI is part of the workflow.&lt;/p&gt;




&lt;h2&gt;
  
  
  The vulnerability problem is not only “bad packages”
&lt;/h2&gt;

&lt;p&gt;When people think about security, they usually focus only on &lt;code&gt;npm audit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That matters, but the problem is broader.&lt;/p&gt;

&lt;p&gt;Weak AI-generated Node.js code can create risk in at least five ways.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Outdated or deprecated dependencies
&lt;/h3&gt;

&lt;p&gt;AI may recommend older packages simply because they were widely used historically.&lt;/p&gt;

&lt;p&gt;Examples of ecosystem patterns teams should be careful about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;old HTTP clients when native &lt;code&gt;fetch&lt;/code&gt; is available&lt;/li&gt;
&lt;li&gt;date libraries that are heavy or in maintenance mode&lt;/li&gt;
&lt;li&gt;legacy request or callback-style packages&lt;/li&gt;
&lt;li&gt;test libraries or middleware stacks that are no longer the cleanest option&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Excessive dependency usage
&lt;/h3&gt;

&lt;p&gt;A surprising amount of generated code imports third-party packages for things modern Node.js can already do well:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP requests&lt;/li&gt;
&lt;li&gt;file handling&lt;/li&gt;
&lt;li&gt;UUID generation&lt;/li&gt;
&lt;li&gt;testing&lt;/li&gt;
&lt;li&gt;path operations&lt;/li&gt;
&lt;li&gt;streams&lt;/li&gt;
&lt;li&gt;crypto utilities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every unnecessary package increases supply-chain exposure.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Legacy syntax and module patterns
&lt;/h3&gt;

&lt;p&gt;Older patterns are not just stylistic debt. They often signal broader ecosystem mismatch.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;require()&lt;/code&gt; in projects that should be ESM-first&lt;/li&gt;
&lt;li&gt;inconsistent module boundaries&lt;/li&gt;
&lt;li&gt;weak TypeScript typing&lt;/li&gt;
&lt;li&gt;callback-heavy flows instead of promise-based APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These increase the chance of brittle code, patchy upgrades, and inconsistent runtime behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Version ambiguity
&lt;/h3&gt;

&lt;p&gt;If your prompts do not define the runtime, the AI fills in the blanks.&lt;/p&gt;

&lt;p&gt;That means code may assume:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an older Node version&lt;/li&gt;
&lt;li&gt;incompatible package behavior&lt;/li&gt;
&lt;li&gt;missing runtime features&lt;/li&gt;
&lt;li&gt;polyfills you do not actually need&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This creates hidden instability from the start.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Weak testing and validation assumptions
&lt;/h3&gt;

&lt;p&gt;AI-generated code often looks complete before it is actually trustworthy.&lt;/p&gt;

&lt;p&gt;Without strict validation rules, teams may accept:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;untested business logic&lt;/li&gt;
&lt;li&gt;poor error handling&lt;/li&gt;
&lt;li&gt;weak input validation&lt;/li&gt;
&lt;li&gt;naive file operations&lt;/li&gt;
&lt;li&gt;poor auth/session assumptions&lt;/li&gt;
&lt;li&gt;unsafe meeting or scheduling logic in real applications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the problem is not just “AI suggested an old package.”&lt;/p&gt;

&lt;p&gt;The real issue is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Without rules, AI introduces inconsistency into architecture, runtime compatibility, dependency hygiene, and security posture.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Why strict rules are necessary
&lt;/h2&gt;

&lt;p&gt;Strict rules are not about making AI less useful.&lt;/p&gt;

&lt;p&gt;They are about making AI output &lt;strong&gt;safe enough to be useful in a real codebase&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A rules-driven setup gives the model boundaries such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;which Node.js version to target&lt;/li&gt;
&lt;li&gt;whether the project is ESM-only&lt;/li&gt;
&lt;li&gt;whether external libraries should be minimized&lt;/li&gt;
&lt;li&gt;what testing framework is allowed&lt;/li&gt;
&lt;li&gt;what dependency policy should be followed&lt;/li&gt;
&lt;li&gt;which coding standards are mandatory&lt;/li&gt;
&lt;li&gt;which types of packages are forbidden&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This changes AI from “internet autocomplete” into a more controlled engineering assistant.&lt;/p&gt;

&lt;p&gt;That is the shift teams need.&lt;/p&gt;




&lt;h2&gt;
  
  
  What strict rules should cover in a Node.js project
&lt;/h2&gt;

&lt;p&gt;For AI-assisted Node.js development, your rules should define at least these areas.&lt;/p&gt;

&lt;h3&gt;
  
  
  Runtime version
&lt;/h3&gt;

&lt;p&gt;Tell the AI exactly what version family you support.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js 24.x&lt;/li&gt;
&lt;li&gt;only modern runtime APIs&lt;/li&gt;
&lt;li&gt;no assumptions for Node 16 or earlier&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This reduces outdated examples and avoids compatibility drift.&lt;/p&gt;

&lt;h3&gt;
  
  
  Module system
&lt;/h3&gt;

&lt;p&gt;Be explicit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;use ES Modules&lt;/li&gt;
&lt;li&gt;use &lt;code&gt;import/export&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;no CommonJS unless required for a legacy boundary&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helps keep the generated code aligned with a modern project structure.&lt;/p&gt;

&lt;h3&gt;
  
  
  TypeScript expectations
&lt;/h3&gt;

&lt;p&gt;Require:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript v5+&lt;/li&gt;
&lt;li&gt;strict typing&lt;/li&gt;
&lt;li&gt;no &lt;code&gt;any&lt;/code&gt; unless justified&lt;/li&gt;
&lt;li&gt;explicit return types for core services where helpful&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This improves maintainability and catches errors earlier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Built-in APIs first
&lt;/h3&gt;

&lt;p&gt;Set a policy that native Node.js APIs should be preferred whenever practical.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;native &lt;code&gt;fetch&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;node:fs/promises&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;node:test&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;node:path&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;node:crypto&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This directly reduces dependency sprawl.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing rules
&lt;/h3&gt;

&lt;p&gt;Tell the model what test stack is allowed.&lt;/p&gt;

&lt;p&gt;For lean modern services, this could be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;node:test&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;node:assert&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;no Jest or Vitest unless the project explicitly uses them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That gives you smaller dependency trees and more predictable tooling.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dependency policy
&lt;/h3&gt;

&lt;p&gt;Define what the AI should avoid:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deprecated packages&lt;/li&gt;
&lt;li&gt;maintenance-mode libraries&lt;/li&gt;
&lt;li&gt;libraries with no recent activity unless intentionally chosen&lt;/li&gt;
&lt;li&gt;packages that duplicate built-in runtime features&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is one of the most important controls.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security expectations
&lt;/h3&gt;

&lt;p&gt;Require generated code to include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;input validation&lt;/li&gt;
&lt;li&gt;safe file handling&lt;/li&gt;
&lt;li&gt;explicit error handling&lt;/li&gt;
&lt;li&gt;least-privilege assumptions&lt;/li&gt;
&lt;li&gt;no hardcoded secrets&lt;/li&gt;
&lt;li&gt;environment-based configuration&lt;/li&gt;
&lt;li&gt;audit-friendly structure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is especially important for apps used by institutions, academies, internal teams, or customer-facing workflows.&lt;/p&gt;




&lt;h2&gt;
  
  
  The meeting app example: where this matters in the real world
&lt;/h2&gt;

&lt;p&gt;Take a modern meeting and class scheduling application for academies.&lt;/p&gt;

&lt;p&gt;At first glance, this sounds like a straightforward SaaS-style app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;schedule classes&lt;/li&gt;
&lt;li&gt;assign teachers&lt;/li&gt;
&lt;li&gt;track attendance&lt;/li&gt;
&lt;li&gt;manage recurring sessions&lt;/li&gt;
&lt;li&gt;maintain basic reporting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But once you move from idea to implementation, the risk surface grows fast.&lt;/p&gt;

&lt;p&gt;Such an app may involve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;student records&lt;/li&gt;
&lt;li&gt;teacher data&lt;/li&gt;
&lt;li&gt;class timings&lt;/li&gt;
&lt;li&gt;attendance history&lt;/li&gt;
&lt;li&gt;meeting links&lt;/li&gt;
&lt;li&gt;notifications&lt;/li&gt;
&lt;li&gt;scheduling workflows&lt;/li&gt;
&lt;li&gt;recurrence logic&lt;/li&gt;
&lt;li&gt;role-based access&lt;/li&gt;
&lt;li&gt;audit trails&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If AI generates this application using weak defaults, you may end up with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;outdated scheduling libraries&lt;/li&gt;
&lt;li&gt;poorly validated date logic&lt;/li&gt;
&lt;li&gt;overuse of third-party packages&lt;/li&gt;
&lt;li&gt;fragile recurrence calculations&lt;/li&gt;
&lt;li&gt;excessive dependencies for simple backend operations&lt;/li&gt;
&lt;li&gt;weak testing around attendance and scheduling logic&lt;/li&gt;
&lt;li&gt;inconsistent module structure across the project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is how “small” technical shortcuts become long-term security and reliability debt.&lt;/p&gt;

&lt;p&gt;For educational systems, that is not acceptable.&lt;/p&gt;

&lt;p&gt;This is why strict Node.js rules are not only a style preference. They are part of &lt;strong&gt;building dependable software with AI assistance&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What to do in practice
&lt;/h2&gt;

&lt;p&gt;Here are the most effective ways to keep AI-generated Node.js code aligned with modern and safer standards.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Put version constraints in the project itself
&lt;/h2&gt;

&lt;p&gt;Your repository should clearly declare the runtime.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"engines"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;gt;=24.0.0"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;.nvmrc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;24.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These files are not only for developers. AI tools often read them too.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Use permanent instructions for your AI tools
&lt;/h2&gt;

&lt;p&gt;Do not repeat runtime and standards manually in every prompt if you can avoid it.&lt;/p&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ChatGPT custom instructions&lt;/li&gt;
&lt;li&gt;Claude project instructions&lt;/li&gt;
&lt;li&gt;Cursor rules&lt;/li&gt;
&lt;li&gt;Copilot instructions in the repo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good instruction set should clearly state:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;target runtime&lt;/li&gt;
&lt;li&gt;module format&lt;/li&gt;
&lt;li&gt;dependency policy&lt;/li&gt;
&lt;li&gt;testing rules&lt;/li&gt;
&lt;li&gt;language version&lt;/li&gt;
&lt;li&gt;security expectations&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Start prompts with the environment, not the feature
&lt;/h2&gt;

&lt;p&gt;A weak prompt:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Build an API for scheduling academy classes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A stronger prompt:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Target Node.js 24 with TypeScript v5+, strict mode, ESM, top-level await, and the built-in Node test runner. Build an academy class scheduling API with recurring sessions, attendance tracking, and teacher assignment.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This changes the quality of generated output immediately.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Explicitly ban legacy patterns
&lt;/h2&gt;

&lt;p&gt;It helps to say what should not be used.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;do not use &lt;code&gt;require()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;do not use deprecated or maintenance-mode packages&lt;/li&gt;
&lt;li&gt;do not use Jest unless already part of the project&lt;/li&gt;
&lt;li&gt;prefer native APIs over third-party libraries&lt;/li&gt;
&lt;li&gt;avoid unnecessary dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI follows negative constraints surprisingly well when they are concrete.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Audit generated dependencies immediately
&lt;/h2&gt;

&lt;p&gt;Even with good prompting, never assume the generated dependency choices are safe.&lt;/p&gt;

&lt;p&gt;Review:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;package freshness&lt;/li&gt;
&lt;li&gt;maintenance status&lt;/li&gt;
&lt;li&gt;transitive dependency count&lt;/li&gt;
&lt;li&gt;known advisories&lt;/li&gt;
&lt;li&gt;whether the package is even needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;npm audit&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;dependency review tools&lt;/li&gt;
&lt;li&gt;renovate or dependency update automation&lt;/li&gt;
&lt;li&gt;internal package approval checks if you have them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI output should be treated as a draft, not as trusted supply-chain input.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Keep architecture and dependency decisions separate
&lt;/h2&gt;

&lt;p&gt;A common mistake is asking AI to generate both architecture and package choices in one go.&lt;/p&gt;

&lt;p&gt;A better approach:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;define the runtime and rules&lt;/li&gt;
&lt;li&gt;ask the AI to propose options&lt;/li&gt;
&lt;li&gt;review package choices&lt;/li&gt;
&lt;li&gt;select one deliberately&lt;/li&gt;
&lt;li&gt;then generate implementation code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This reduces accidental adoption of weak libraries.&lt;/p&gt;




&lt;h2&gt;
  
  
  A sample “rules-first” prompt for modern Node.js development
&lt;/h2&gt;

&lt;p&gt;Here is a more disciplined prompt pattern for code generation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Target environment:
- Node.js v24+
- TypeScript v5+ with strict mode
- ESNext / ESM only
- Use top-level await where suitable
- Use native Node.js APIs first
- Use the Node.js built-in test runner (node:test)
- Avoid deprecated, maintenance-mode, or unnecessary packages
- Do not use CommonJS require()

Build a backend module for an academy class scheduling application.

Requirements:
- Manage classes, teachers, students, and recurring schedules
- Track attendance per session
- Validate inputs carefully
- Use native fetch and node:fs/promises where needed
- Keep dependencies minimal
- Include unit tests using node:test
- Structure code for maintainability and auditability
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This kind of prompt gives the model enough guardrails to produce far better output.&lt;/p&gt;




&lt;h2&gt;
  
  
  Example custom instructions for ChatGPT or Claude
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Node.js Development Standards

- Target modern Node.js runtime only.
- Use TypeScript v5+ with strict typing.
- Always use ES Modules (import/export), never CommonJS unless explicitly requested.
- Prefer built-in Node.js APIs over third-party libraries.
- Avoid deprecated, abandoned, or maintenance-mode packages.
- Minimize dependencies and avoid adding packages for functionality available natively in Node.js.
- Use explicit error handling and input validation.
- Never hardcode secrets or credentials.
- Use node:test and node:assert for tests unless the project already uses a different approved testing framework.
- Generate code that is production-aware, maintainable, and compatible with modern Node.js standards.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Example &lt;code&gt;.cursorrules&lt;/code&gt; file
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Node.js / TypeScript Project Rules&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; Runtime: Modern Node.js only
&lt;span class="p"&gt;-&lt;/span&gt; Language: TypeScript v5+ with strict mode
&lt;span class="p"&gt;-&lt;/span&gt; Modules: ESM only (&lt;span class="sb"&gt;`import`&lt;/span&gt; / &lt;span class="sb"&gt;`export`&lt;/span&gt;)
&lt;span class="p"&gt;-&lt;/span&gt; Style: Prefer modern ESNext features
&lt;span class="p"&gt;-&lt;/span&gt; Use top-level await only in appropriate entry points
&lt;span class="p"&gt;-&lt;/span&gt; Prefer built-in Node.js APIs over external packages
&lt;span class="p"&gt;-&lt;/span&gt; Avoid deprecated or weakly maintained libraries
&lt;span class="p"&gt;-&lt;/span&gt; Keep dependency count low
&lt;span class="p"&gt;-&lt;/span&gt; Tests must use &lt;span class="sb"&gt;`node:test`&lt;/span&gt; and &lt;span class="sb"&gt;`node:assert`&lt;/span&gt; unless told otherwise
&lt;span class="p"&gt;-&lt;/span&gt; No CommonJS unless explicitly required for legacy integration
&lt;span class="p"&gt;-&lt;/span&gt; All generated code must include reasonable validation and error handling
&lt;span class="p"&gt;-&lt;/span&gt; Prioritize security, maintainability, and low attack surface
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The bigger lesson
&lt;/h2&gt;

&lt;p&gt;AI-assisted development does not reduce the need for engineering discipline.&lt;/p&gt;

&lt;p&gt;It increases it.&lt;/p&gt;

&lt;p&gt;Because once AI becomes part of the coding workflow, bad defaults can spread much faster:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;across files&lt;/li&gt;
&lt;li&gt;across services&lt;/li&gt;
&lt;li&gt;across teams&lt;/li&gt;
&lt;li&gt;across repositories&lt;/li&gt;
&lt;li&gt;across dependency decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is why teams should treat AI tooling the same way they treat CI/CD pipelines, security gates, and infrastructure guardrails.&lt;/p&gt;

&lt;p&gt;Not as magic.&lt;/p&gt;

&lt;p&gt;As a system that needs constraints.&lt;/p&gt;

&lt;p&gt;For Node.js and JavaScript in particular, those constraints matter because the ecosystem is powerful, fast-moving, and historically noisy.&lt;/p&gt;

&lt;p&gt;Without strict rules, AI can easily drag a modern codebase toward legacy patterns and unnecessary security exposure.&lt;/p&gt;

&lt;p&gt;With strict rules, it becomes much more useful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cleaner output&lt;/li&gt;
&lt;li&gt;fewer outdated libraries&lt;/li&gt;
&lt;li&gt;better alignment to runtime&lt;/li&gt;
&lt;li&gt;smaller dependency trees&lt;/li&gt;
&lt;li&gt;lower supply-chain risk&lt;/li&gt;
&lt;li&gt;more maintainable architecture&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is the real goal.&lt;/p&gt;

&lt;p&gt;Not just generating code faster.&lt;/p&gt;

&lt;p&gt;But generating code that is safer to keep.&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing thought
&lt;/h2&gt;

&lt;p&gt;If you are using AI to generate Node.js or JavaScript code, do not only ask:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Does this code work?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Also ask:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Does this code match our runtime, dependency policy, security expectations, and long-term maintainability standards?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because in modern software delivery, especially with AI in the loop, speed without guardrails becomes technical debt very quickly.&lt;/p&gt;

&lt;p&gt;And in the JavaScript ecosystem, that debt often arrives through dependencies first.&lt;/p&gt;




&lt;p&gt;If you are building AI-assisted apps and want to make them more secure and maintainable, feel free to connect with me on LinkedIn or explore my work here: &lt;a href="https://gsaravanan.dev" rel="noopener noreferrer"&gt;https://gsaravanan.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>code</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Run Your Own GenAI LLMs Offline with LM Studio</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Wed, 13 Aug 2025 03:57:13 +0000</pubDate>
      <link>https://forem.com/chefgs/run-your-own-genai-llms-offline-with-lm-studio-509</link>
      <guid>https://forem.com/chefgs/run-your-own-genai-llms-offline-with-lm-studio-509</guid>
      <description>&lt;h2&gt;
  
  
  LM Studio — The Best Tool for Privacy-First GenAI Enthusiasts
&lt;/h2&gt;

&lt;p&gt;In the world of Generative AI, access to powerful large language models (LLMs) has never been more important — but it’s also become increasingly dependent on internet connectivity and third-party platforms. For developers, researchers, and privacy-first organizations, this dependency can be a major limitation — not to mention a potential security or compliance risk.&lt;/p&gt;

&lt;p&gt;That’s where &lt;a href="https://lmstudio.ai/docs/app" rel="noopener noreferrer"&gt;&lt;strong&gt;LM Studio&lt;/strong&gt;&lt;/a&gt; comes in. If you're a GenAI enthusiast, then &lt;strong&gt;LM Studio&lt;/strong&gt; is your go-to tool for running open-source LLMs and SLMs locally, with full control over your data, models, and workflows.&lt;/p&gt;

&lt;p&gt;This post explores why running LLMs locally is becoming the new standard, what makes LM Studio stand out, and how it compares to other tools like Ollama and vLLM. &lt;/p&gt;

&lt;p&gt;We’ll also highlight why offline use is a game-changer for privacy-first organizations — and how you can take full advantage of it with LM Studio.&lt;/p&gt;

&lt;p&gt;Whether you're a prompt engineer, a researcher, or part of an organization that values data autonomy, this guide will help you understand the power of running your own LLMs without internet, and how LM Studio makes it easier than ever.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This is Important ?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If you're running a privacy-first organization, offline LLM use is not just an option — it's a necessity.&lt;/li&gt;
&lt;li&gt;If you're a GenAI nerd, LM Studio gives you the freedom to experiment, customize, and run models without relying on external services.&lt;/li&gt;
&lt;li&gt;If you're a developer or researcher, knowing how to run LLMs locally can save you time, money, and data privacy concerns.
This is the future of GenAI — local, fast, and secure. And with tools like LM Studio, it's more accessible than ever.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;🚀 &lt;strong&gt;If You're Passionate About Running Open Source GenAI LLM Models in Your Workstation — This Post Is For You&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're a &lt;strong&gt;GenAI nerd&lt;/strong&gt;, then this is going to be your new go-to tool for &lt;strong&gt;offline LLM usage&lt;/strong&gt; — and it’s not just about running models. It's about &lt;strong&gt;freedom&lt;/strong&gt;, &lt;strong&gt;control&lt;/strong&gt;, and the ability to run your favorite open-source models &lt;strong&gt;without ever relying on an internet connection&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This post will dive deep into how to use &lt;strong&gt;LM Studio&lt;/strong&gt; — the best GUI-based tool for running open-source large language models (LLMs) and small-language models (SLMs) &lt;strong&gt;locally on your own hardware&lt;/strong&gt;. We’ll also touch on other tools and models you can run offline, so you have a full control of what's possible with your local run models.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Why Run LLMs Locally?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are a few key reasons why running large language models locally is becoming the &lt;strong&gt;new standard&lt;/strong&gt; for many GenAI enthusiasts and developers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;Privacy &amp;amp; Control&lt;/strong&gt;: Your data stays local — no third-party tracking.&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Offline Use&lt;/strong&gt;: Work without an internet connection. Ideal for coding, research, and brainstorming.&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Customization&lt;/strong&gt;: Fine-tune models, tweak prompts, and experiment with model behavior.&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Cost Efficiency&lt;/strong&gt;: No need for expensive cloud credits or API calls.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if you're a &lt;strong&gt;GenAI nerd or development team&lt;/strong&gt;, then the ability to run models like Qwen, LLaMA, Phi-3, Mistral, and even newer ones like &lt;strong&gt;LLaMA-3&lt;/strong&gt; — all offline — is a dream come true.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;LM Studio: The Best GUI for Offline LLM Use&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;LM Studio&lt;/strong&gt;, developed by @yugil burowski, is the &lt;strong&gt;most user-friendly tool&lt;/strong&gt; for running open-source LLMs and SLMs locally. It's designed with &lt;strong&gt;GenAI enthusiasts&lt;/strong&gt; in mind — it’s fast, lightweight, and packed with features that make local model running &lt;strong&gt;simple and powerful&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Features of LM Studio
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🖥️ &lt;strong&gt;GUI-based interface&lt;/strong&gt;: No need to type commands or write scripts.&lt;/li&gt;
&lt;li&gt;💻 &lt;strong&gt;Runs on your local machine&lt;/strong&gt;: Perfect for offline use, even with internet turned off.&lt;/li&gt;
&lt;li&gt;🧠 &lt;strong&gt;Supports multiple model formats&lt;/strong&gt;: GGUF, GPTQ, and more.&lt;/li&gt;
&lt;li&gt;📌 &lt;strong&gt;Customizable prompts and templates&lt;/strong&gt;: Tailor the model’s behavior to your needs.&lt;/li&gt;
&lt;li&gt;📦 &lt;strong&gt;Easy model loading and management&lt;/strong&gt;: Just download the model, click "Load," and start using it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  LM Studio Best For,
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GenAI enthusiasts&lt;/strong&gt; who want to experiment with model behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt engineers&lt;/strong&gt; looking for full customization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Researchers and developers&lt;/strong&gt; who need offline access to models.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Privacy First Organizations: Why Offline GenAI Use Matters&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;For organizations that prioritize &lt;strong&gt;data privacy&lt;/strong&gt;, &lt;strong&gt;offline use&lt;/strong&gt; is a game-changer. With LM Studio, you can run your LLMs &lt;strong&gt;without ever sending data over the internet&lt;/strong&gt;, making it ideal for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Financial institutions&lt;/li&gt;
&lt;li&gt;Healthcare providers&lt;/li&gt;
&lt;li&gt;Government agencies&lt;/li&gt;
&lt;li&gt;Any organization that needs &lt;strong&gt;strict data control&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can run your models on-premise, ensuring compliance with regulations like GDPR or HIPAA.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;LM Studio vs Ollama, vLLM &amp;amp; Other Tools&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Below is a list of the top tools available today that let you run open-source LLMs and SLMs on your own hardware — including LM Studio, Ollama, vLLM, and more.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;LM Studio&lt;/th&gt;
&lt;th&gt;Ollama&lt;/th&gt;
&lt;th&gt;vLLM&lt;/th&gt;
&lt;th&gt;LLaMA-CPP&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Type&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;GUI-based&lt;/td&gt;
&lt;td&gt;CLI-only&lt;/td&gt;
&lt;td&gt;Python library&lt;/td&gt;
&lt;td&gt;CLI/Python&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Local Use?&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Offline Support?&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model Formats&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;GGUF, GPTQ&lt;/td&gt;
&lt;td&gt;GGUF, Q4&lt;/td&gt;
&lt;td&gt;GGUF, GPTQ&lt;/td&gt;
&lt;td&gt;GGUF, MMap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best For&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;GenAI enthusiasts, prompt engineers&lt;/td&gt;
&lt;td&gt;Developers, API users&lt;/td&gt;
&lt;td&gt;Researchers, production environments&lt;/td&gt;
&lt;td&gt;Developers, low-latency use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ease of Use&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;⭐⭐⭐⭐⭐&lt;/td&gt;
&lt;td&gt;⭐⭐⭐&lt;/td&gt;
&lt;td&gt;⭐⭐⭐&lt;/td&gt;
&lt;td&gt;⭐⭐⭐&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Can be accessed via API?&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ (LM Studio API)&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; LM Studio can also be accessed via the &lt;a href="https://lmstudio.ai/docs/python" rel="noopener noreferrer"&gt;LM Studio API&lt;/a&gt;, making it a flexible choice for both local and integrated workflows.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Final Thoughts&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you're a &lt;strong&gt;GenAI nerd&lt;/strong&gt;, then &lt;strong&gt;LM Studio&lt;/strong&gt; is your best bet — it’s the most user-friendly and ideal for experimentation. It gives you full control over your models, allows offline use, and lets you customize the way they behave — all without needing to write a single line of code.&lt;/p&gt;

&lt;p&gt;But if you're more into &lt;strong&gt;development or research&lt;/strong&gt;, then tools like &lt;strong&gt;Ollama&lt;/strong&gt; or &lt;strong&gt;vLLM&lt;/strong&gt; might be more suitable for your needs.&lt;/p&gt;




&lt;h2&gt;
  
  
  What’s Next?
&lt;/h2&gt;

&lt;p&gt;I’d love to hear from you — have you tried &lt;strong&gt;LM Studio&lt;/strong&gt; yet?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Is it your go-to tool for offline LLM use?&lt;/li&gt;
&lt;li&gt;🤔 Are you running any other models locally besides LLaMA or Phi-3?&lt;/li&gt;
&lt;li&gt;🧠 What features would you like to see in a local LLM runner?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me know in the comments — I'm always happy to help and explore more together.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Want a step-by-step guide on how to set up LM Studio or run your first model offline? Let me know!&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
🔗 &lt;a href="https://lmstudio.ai/docs/python" rel="noopener noreferrer"&gt;LM Studio Documentation&lt;/a&gt; — Check out the API and model loading details!&lt;/p&gt;




&lt;h3&gt;
  
  
  Follow me on,
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/chefgs"&gt;Dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/chefgs" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/saravanan-gnanaguru/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/saransid" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gsaravanan.dev" rel="noopener noreferrer"&gt;gsaravanan.dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>genai</category>
      <category>llm</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Git Guide to Delete Old Commits and Clear Sensitive Info from Git History</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Sat, 26 Jul 2025 20:32:08 +0000</pubDate>
      <link>https://forem.com/chefgs/git-guide-to-delete-old-commits-and-clear-sensitive-files-from-git-history-4l71</link>
      <guid>https://forem.com/chefgs/git-guide-to-delete-old-commits-and-clear-sensitive-files-from-git-history-4l71</guid>
      <description>&lt;p&gt;How To: Delete Old Git Commits and Clear Sensitive Files from History&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Everyone works with GenAI apps (like ChatGPT, Gemini and Claude) and often forgets to delete the secret while pushing the code to Git/GitHub/BitBucket etc.&lt;/p&gt;

&lt;p&gt;Accidentally committing sensitive information (like passwords, API keys, or certificates) to a Git repository is a common mistake. &lt;/p&gt;

&lt;p&gt;Removing these sensitive files from your repository's history is critical to protect your project and users. &lt;/p&gt;

&lt;p&gt;This guide provides step-by-step instructions for three common approaches to erase old commits and clear unwanted files, with a recommendation for the most robust solution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frx357626emioc9870b7x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frx357626emioc9870b7x.png" alt="a computer cleans the git commit" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt; has added the feature by NOT allowing the files to get pushed - but the user also has an option to force push with secret - which poses the security threat.&lt;/p&gt;

&lt;p&gt;So take care while working with API keys in your code. Best practice is to use ENV variables and storing key as HASH string is always recommended.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Is This Important?
&lt;/h2&gt;

&lt;p&gt;Even if you delete a sensitive file and commit the changes, the sensitive data remains in the repository's history and can be recovered. To fully remove this information, you must rewrite your Git history.&lt;/p&gt;




&lt;h2&gt;
  
  
  Approach 1: Start Fresh — Remove All History
&lt;/h2&gt;

&lt;p&gt;This method removes all commit history, leaving only your current files as a new initial commit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Backup your repository!&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Delete the Git history:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; .git
git init
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) Rename your branch:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add your remote and force-push:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add origin &amp;lt;remote-url&amp;gt;
git push &lt;span class="nt"&gt;-f&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple and effective.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loses all commit history.&lt;/li&gt;
&lt;li&gt;Disruptive for collaborators.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Approach 2: Remove Specific Files — With git-filter-repo
&lt;/h2&gt;

&lt;p&gt;If you need to delete specific files (like &lt;code&gt;.env&lt;/code&gt;, &lt;code&gt;secrets.txt&lt;/code&gt;) from every commit, use &lt;a href="https://github.com/newren/git-filter-repo" rel="noopener noreferrer"&gt;&lt;code&gt;git-filter-repo&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install git-filter-repo (if not already):&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;git-filter-repo
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Remove sensitive files from history:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git filter-repo &lt;span class="nt"&gt;--path&lt;/span&gt; &amp;lt;path-to-sensitive-file&amp;gt; &lt;span class="nt"&gt;--invert-paths&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Example for multiple files:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git filter-repo &lt;span class="nt"&gt;--path&lt;/span&gt; secret.env &lt;span class="nt"&gt;--path&lt;/span&gt; private.pem &lt;span class="nt"&gt;--invert-paths&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Force-push changes:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-f&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Precise: removes only targeted files.&lt;/li&gt;
&lt;li&gt;Preserves useful history for all other files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Still rewrites history (force-push required).&lt;/li&gt;
&lt;li&gt;All collaborators must re-clone or reset local branches.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Approach 3: Squash All Commits Into One
&lt;/h2&gt;

&lt;p&gt;This approach creates a single new commit with only your current files, erasing all previous history (including sensitive data) but preserving your current project state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a new orphan branch (no history):&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="nt"&gt;--orphan&lt;/span&gt; latest_branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Stage and commit all files:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit with all current files"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Delete the old branch and rename the new one:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-D&lt;/span&gt; main
git branch &lt;span class="nt"&gt;-m&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Force-push to your remote:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-f&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Completely erases old history, including all sensitive files or data.&lt;/li&gt;
&lt;li&gt;Leaves you with a clean slate and current state.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All previous commit history is lost.&lt;/li&gt;
&lt;li&gt;Requires force-push; all collaborators must re-clone.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Recommendation: Use Approach 3 (Squash All Commits Into One)
&lt;/h2&gt;

&lt;p&gt;While all three approaches can remove sensitive data, squashing all commits is often the best choice for these reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It guarantees that all traces of sensitive information are erased.&lt;/li&gt;
&lt;li&gt;Leaves your repository clean and easy to maintain.&lt;/li&gt;
&lt;li&gt;Is simple to execute, with minimal risk of missing hidden copies of sensitive files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
After rewriting history, you must force-push (&lt;code&gt;git push -f&lt;/code&gt;). All collaborators must re-clone or reset their local repositories to avoid conflicts.&lt;/p&gt;

&lt;p&gt;I personally tried approach 3 to clear the git history.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Steps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Invalidate Old Credentials:&lt;/strong&gt; If you committed passwords or keys, assume they are compromised. Change them immediately.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add Sensitive Files to &lt;code&gt;.gitignore&lt;/code&gt;:&lt;/strong&gt; Prevent accidental future commits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notify Collaborators:&lt;/strong&gt; Let everyone know to re-clone the repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check Remotes:&lt;/strong&gt; Ensure you are pushing to the correct repository and branch.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Useful Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/newren/git-filter-repo" rel="noopener noreferrer"&gt;git-filter-repo documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository" rel="noopener noreferrer"&gt;Official GitHub Guide: Removing sensitive data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/get-started/using-git/pushing-commits-to-a-remote-repository" rel="noopener noreferrer"&gt;GitHub support on force-push and history rewriting&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Remember: Always review your changes and ensure sensitive files are excluded from future commits!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>security</category>
      <category>github</category>
      <category>programming</category>
    </item>
    <item>
      <title>My new blog on Docker and Kubernetes deployment in UpCloud</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Tue, 22 Apr 2025 03:03:49 +0000</pubDate>
      <link>https://forem.com/chefgs/-c91</link>
      <guid>https://forem.com/chefgs/-c91</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/upcloud/how-kubernetes-automates-and-manages-your-docker-containers-278n" class="crayons-story__hidden-navigation-link"&gt;How Kubernetes Automates and Manages Your Docker Containers&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;
          &lt;a class="crayons-logo crayons-logo--l" href="/upcloud"&gt;
            &lt;img alt="UpCloud logo" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F10365%2Fe28a31bc-84a2-4972-9626-8f3bf9d14e03.png" class="crayons-logo__image"&gt;
          &lt;/a&gt;

          &lt;a href="/chefgs" class="crayons-avatar  crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F303053%2Fd97f6bd8-5ba4-4e3d-a8ad-6efc603a645a.jpg" alt="chefgs profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/chefgs" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Saravanan Gnanaguru
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Saravanan Gnanaguru
                
              
              &lt;div id="story-author-preview-content-2386187" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/chefgs" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F303053%2Fd97f6bd8-5ba4-4e3d-a8ad-6efc603a645a.jpg" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Saravanan Gnanaguru&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

            &lt;span&gt;
              &lt;span class="crayons-story__tertiary fw-normal"&gt; for &lt;/span&gt;&lt;a href="/upcloud" class="crayons-story__secondary fw-medium"&gt;UpCloud&lt;/a&gt;
            &lt;/span&gt;
          &lt;/div&gt;
          &lt;a href="https://dev.to/upcloud/how-kubernetes-automates-and-manages-your-docker-containers-278n" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Apr 21 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/upcloud/how-kubernetes-automates-and-manages-your-docker-containers-278n" id="article-link-2386187"&gt;
          How Kubernetes Automates and Manages Your Docker Containers
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/upcloud/how-kubernetes-automates-and-manages-your-docker-containers-278n#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            5 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>docker</category>
      <category>kubernetes</category>
      <category>cloud</category>
      <category>devops</category>
    </item>
    <item>
      <title>How Kubernetes Automates and Manages Your Docker Containers</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Mon, 21 Apr 2025 13:06:10 +0000</pubDate>
      <link>https://forem.com/upcloud/how-kubernetes-automates-and-manages-your-docker-containers-278n</link>
      <guid>https://forem.com/upcloud/how-kubernetes-automates-and-manages-your-docker-containers-278n</guid>
      <description>&lt;p&gt;Blog Description: Learn how we can use Kubernetes to automate the deployment, scaling, and management of Docker containers. Discover how it simplifies container orchestration and enhances application reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In today’s microservices-driven world, Docker revolutionized how we build and package applications. But managing containers at scale? That’s where Kubernetes steps in. Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications — especially those created with Docker.&lt;/p&gt;

&lt;p&gt;As part creating the Demo I've used &lt;code&gt;UpCloud&lt;/code&gt; - A Leading European Cloud Provider.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why UpCloud Good for Containers and Kubernetes?
&lt;/h2&gt;

&lt;p&gt;UpCloud is a high-performance cloud provider known for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;⚡ Ultra-fast MaxIOPS storage&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🌍 Global data centers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🧩 Easy Kubernetes-ready infrastructure (via manual setup or Terraform)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;💰 Cost-effective pricing for scalable clusters&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whether you're starting locally with Minikube or going full-scale with K8s on cloud VMs, UpCloud gives you the flexibility and performance edge.&lt;/p&gt;

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

&lt;p&gt;Docker is a tool that packages your code, libraries, and dependencies into a container—an isolated, lightweight executable. Containers solve the “it works on my machine” problem, ensuring consistent environments across dev, test, and production.&lt;br&gt;
But what happens when you have hundreds or thousands of these containers?&lt;/p&gt;
&lt;h2&gt;
  
  
  What Is Kubernetes?
&lt;/h2&gt;

&lt;p&gt;Kubernetes (aka K8s) is an open-source container orchestration engine developed by Google. It manages clusters of Docker containers, offering automation, monitoring, and self-healing capabilities out of the box.&lt;/p&gt;
&lt;h2&gt;
  
  
  How Kubernetes helps to Orchestrate Docker Containers
&lt;/h2&gt;

&lt;p&gt;Let’s break down the Orchestration functionality of Kubernetes brings:&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Automated Deployment and Rollbacks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Define your desired container state in YAML files.&lt;/li&gt;
&lt;li&gt;Kubernetes ensures the cluster matches this state.&lt;/li&gt;
&lt;li&gt;Supports rolling updates and easy rollbacks if something goes wrong.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  2. Self-Healing Mechanisms
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Failed containers? Kubernetes replaces them automatically.&lt;/li&gt;
&lt;li&gt;Restarts containers if they crash.&lt;/li&gt;
&lt;li&gt;Removes non-responsive containers from the network.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  3. Load Balancing and Service Discovery
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Automatically distributes network traffic across containers.&lt;/li&gt;
&lt;li&gt;Built-in DNS service allows containers to find each other by name.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  4. Horizontal Scaling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Scale container instances up/down based on CPU/memory usage.&lt;/li&gt;
&lt;li&gt;Manual or automatic scaling using the Horizontal Pod Autoscaler.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  5. Resource Optimization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Efficient bin-packing ensures optimal use of compute resources.&lt;/li&gt;
&lt;li&gt;Limits and requests help avoid resource hogging.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Core Components of Kubernetes
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx263x1ox4cyt6fk12tj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx263x1ox4cyt6fk12tj.png" alt="k8s component architecture" width="800" height="756"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Category&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Component&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Definition&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Control Plane&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;kube-apiserver&lt;/td&gt;
&lt;td&gt;Handles all REST requests and serves as the front-end of the Kubernetes control plane.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;etcd&lt;/td&gt;
&lt;td&gt;Stores all Kubernetes cluster data in a distributed, consistent key-value store.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;kube-scheduler&lt;/td&gt;
&lt;td&gt;Assigns pods to nodes based on defined scheduling rules and resource availability.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;kube-controller-manager&lt;/td&gt;
&lt;td&gt;Runs controllers to monitor and maintain the desired cluster state.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;cloud-controller-manager&lt;/td&gt;
&lt;td&gt;Manages cloud-specific control loops like load balancers, volumes, and node management.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Node Components&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;kubelet&lt;/td&gt;
&lt;td&gt;Ensures that containers in pods are running as defined in their PodSpecs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;kube-proxy&lt;/td&gt;
&lt;td&gt;Maintains network rules for pod-to-pod and pod-to-service communication.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Container Runtime&lt;/td&gt;
&lt;td&gt;Executes and manages containers on the node (e.g., containerd, CRI-O).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Workload Object&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Pod&lt;/td&gt;
&lt;td&gt;The smallest deployable unit that can run a container or set of containers in Kubernetes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Networking Object&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Service&lt;/td&gt;
&lt;td&gt;Exposes a stable network endpoint for accessing a group of pods.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cluster Resource&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Cluster&lt;/td&gt;
&lt;td&gt;A set of nodes and control plane components that together run containerized workloads.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Real-World Example of Kubernetes Implementation
&lt;/h2&gt;

&lt;p&gt;Imagine you have a web app built with Node.js in a Docker container:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You define a Deployment that runs 3 replicas.&lt;/li&gt;
&lt;li&gt;Kubernetes ensures 3 instances are always running.&lt;/li&gt;
&lt;li&gt;If one crashes, it spins up a new one instantly.&lt;/li&gt;
&lt;li&gt;A Service ensures traffic is routed to available instances.&lt;/li&gt;
&lt;li&gt;Want to scale to 10 instances? Just change the replica count.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Demo of Deploying a Docker image in Kubernetes
&lt;/h2&gt;

&lt;p&gt;We will see the step by step approach to deploy an application Docker image in kubernetes using &lt;code&gt;minikube&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Create a Server in UpCloud
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;System Requirement for Minikube is 2 Core CPU, so we have created an UpCloud server with 2 Core CPU and 4 GB RAM in Singapore Region.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnkjb2w26515bm627hhn9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnkjb2w26515bm627hhn9.png" alt="UpCloud server details" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;👉 &lt;a href="https://signup.upcloud.com/?promo=cloudenginelabs" rel="noopener noreferrer"&gt;Start with UpCloud&lt;/a&gt; and deploy your next app with confidence.&lt;/p&gt;

&lt;p&gt;You can also get started with UpCloud by following the documentation &lt;a href="https://upcloud.com/docs/getting-started/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Logged into UpCloud server and proceeded the further steps&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Steps to Deploy Application in Kubernetes
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Step 1: Install Minikube and Dependencies
&lt;/h4&gt;
&lt;h5&gt;
  
  
  1.1 Install Docker (Required for Minikube)
&lt;/h5&gt;

&lt;p&gt;Please Follow Docker Installation Steps in official documentation to install Docker.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Docker&lt;/code&gt; &lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;Official Documentation&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  1.2 Install Kubectl (Kubernetes CLI)
&lt;/h5&gt;

&lt;p&gt;Please Follow Installation Steps to install &lt;code&gt;Kubectl&lt;/code&gt; here - &lt;a href="https://kubernetes.io/docs/tasks/tools/" rel="noopener noreferrer"&gt;Official Installation Docs&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version --client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  1.3 Install Minikube
&lt;/h5&gt;

&lt;p&gt;Please Follow Installation Steps to install &lt;code&gt;Minikube&lt;/code&gt; here - &lt;a href="https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Farm64%2Fstable%2Fbinary+download" rel="noopener noreferrer"&gt;Installation Docs&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;List of commands to install &lt;code&gt;Minikube&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin/
minikube version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Step 2: Start Minikube Cluster
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube start --driver=docker 
# or
minikube start --driver=docker --force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Step 3: Deploy a Simple Application
&lt;/h4&gt;

&lt;h5&gt;
  
  
  3.1 Create a Deployment
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create deployment my-app --image=nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  3.2 Expose the Deployment
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl expose deployment my-app --type=NodePort --port=80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  3.3 Get Service Details
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get svc my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  3.4 Access the Application
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube service my-app --url
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Step 4: Scale the Application
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl scale deployment my-app --replicas=3
kubectl get pods -o wide
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Step 5: Clean Up Resources
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl delete svc my-app
kubectl delete deployment my-app
minikube stop
minikube delete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  (Alternative Method) Using &lt;code&gt;deployment.yaml&lt;/code&gt; File
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;code&gt;deployment.yaml&lt;/code&gt; file, which deploys a &lt;code&gt;nginx&lt;/code&gt; server and creates a service for access it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s a simple Kubernetes &lt;code&gt;deployment.yaml&lt;/code&gt; file that deploys an &lt;strong&gt;nginx&lt;/strong&gt; container and exposes it using a &lt;strong&gt;NodePort&lt;/strong&gt; service. &lt;/p&gt;

&lt;p&gt;We are deploying the yaml in &lt;code&gt;minikube&lt;/code&gt; cluster, to access the service via your browser using &lt;code&gt;minikube&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  📄 &lt;code&gt;nginx-deployment.yaml&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx-deployment&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;replicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
          &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx:latest&lt;/span&gt;
          &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;containerPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;80&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Service&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx-service&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;NodePort&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
  &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;80&lt;/span&gt;
      &lt;span class="na"&gt;targetPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;80&lt;/span&gt;
      &lt;span class="na"&gt;nodePort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30080&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🧪 Steps to Deploy and Access NGINX
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Apply the YAML file&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; nginx-deployment.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Check pod and service status&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pods
kubectl get svc nginx-service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Access NGINX in browser&lt;/strong&gt; (if using Minikube):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube service nginx-service &lt;span class="nt"&gt;--url&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This will return a URL like: &lt;code&gt;http://192.168.49.2:30080&lt;/code&gt; — open this in your browser.&lt;/p&gt;
&lt;/blockquote&gt;




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

&lt;p&gt;As part of this blog, you have learnt the following aspects,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is Docker and Kubernetes&lt;/li&gt;
&lt;li&gt;Basics understanding of various components of Kubernetes and it's advantages&lt;/li&gt;
&lt;li&gt;how to deploy Docker image using Kubernetes using &lt;code&gt;kubectl&lt;/code&gt; in-line command and Kubernetes yaml deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the next blog - we will see how to scale the application and we will get into internals of application scaling in Kubernetes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Call to Action
&lt;/h2&gt;

&lt;p&gt;Ready to scale your Docker containers with ease? Dive deeper into Kubernetes, or start building your own K8s-powered apps today!&lt;/p&gt;

&lt;p&gt;Shout out to &lt;strong&gt;&lt;a href="https://upcloud.com" rel="noopener noreferrer"&gt;UpCloud&lt;/a&gt;&lt;/strong&gt; for their developer-friendly cloud platform.  &lt;/p&gt;

&lt;p&gt;If you're trying out Kubernetes or deploying applications for testing or learning — check out &lt;strong&gt;UpCloud Developer Plans&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Use the personalized promo code &lt;strong&gt;&lt;code&gt;cloudenginelabs&lt;/code&gt;&lt;/strong&gt; to get &lt;strong&gt;$50 in free credits&lt;/strong&gt; with an &lt;strong&gt;extended 30-day trial period&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://signup.upcloud.com/?promo=cloudenginelabs" rel="noopener noreferrer"&gt;Start with UpCloud&lt;/a&gt; and deploy your next app with confidence.&lt;/p&gt;

&lt;p&gt;You can also get started with UpCloud by following the documentation &lt;a href="https://upcloud.com/docs/getting-started/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GitHub Actions Self-Hosted Runner Setup Guide for Ubuntu</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Wed, 23 Oct 2024 15:21:41 +0000</pubDate>
      <link>https://forem.com/aws-builders/github-actions-self-hosted-runner-setup-guide-for-ubuntu-1fla</link>
      <guid>https://forem.com/aws-builders/github-actions-self-hosted-runner-setup-guide-for-ubuntu-1fla</guid>
      <description>&lt;h2&gt;
  
  
  Introduction to GitHub Actions Workflow Basics and Runners
&lt;/h2&gt;

&lt;h3&gt;
  
  
  GitHub Actions Workflow Basics
&lt;/h3&gt;

&lt;p&gt;GitHub Actions is a powerful automation platform that allows you to create custom workflows for your software development lifecycle. Workflows are defined using YAML files and can be triggered by various events such as pushes, pull requests, or scheduled times.&lt;/p&gt;

&lt;p&gt;A basic GitHub Actions workflow consists of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Events&lt;/strong&gt;: Triggers that start the workflow (e.g., &lt;code&gt;push&lt;/code&gt;, &lt;code&gt;pull_request&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Jobs&lt;/strong&gt;: A series of steps that execute on the same runner.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Steps&lt;/strong&gt;: Individual tasks within a job, which can run commands or use pre-built actions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example workflow file (&lt;code&gt;.github/workflows/ci.yml&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CI&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Checkout code&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run build&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;make build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Runners
&lt;/h3&gt;

&lt;p&gt;Runners are the machines that execute the jobs in your workflows. GitHub provides hosted runners with different operating systems, but you can also use self-hosted runners.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub-Hosted Runners&lt;/strong&gt;: Managed by GitHub, these runners come pre-configured with a wide range of tools and software.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-Hosted Runners&lt;/strong&gt;: Custom machines that you manage yourself. These can be on-premise servers, physical machines, virtual machines, or cloud instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Need for Self-Hosted Runners
&lt;/h3&gt;

&lt;p&gt;While GitHub-hosted runners are convenient, there are scenarios where self-hosted runners are beneficial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Custom Environments&lt;/strong&gt;: You need specific software, configurations, or hardware that GitHub-hosted runners do not provide.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt;: You require more powerful hardware or specific hardware configurations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt;: You want to reduce costs by using your own infrastructure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt;: You need to run workflows in a more controlled and secure environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Self-hosted runners give you more control over the environment in which your workflows run, allowing you to tailor the setup to your specific needs.&lt;/p&gt;

&lt;p&gt;In this &lt;strong&gt;How-to Guide&lt;/strong&gt; we will explore, how to set up a GitHub Actions self-hosted runner on an Ubuntu instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A GitHub repository where you want to add the self-hosted runner.&lt;/li&gt;
&lt;li&gt;A GitHub Personal Access Token (PAT) with &lt;code&gt;repo&lt;/code&gt; scope.&lt;/li&gt;
&lt;li&gt;An Ubuntu system (can be an EC2 instance on AWS or any other Ubuntu machine) - e.g., Ubuntu Server 22.04 LTS or 24.04 LTS&lt;/li&gt;
&lt;li&gt;Administrative privileges on the Ubuntu system.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Steps to Create a Personal Access Token (PAT) from Developer Settings
&lt;/h2&gt;

&lt;p&gt;To create a Personal Access Token (PAT) for GitHub, follow these steps:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Navigate to Developer Settings
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Log in to your GitHub account.&lt;/li&gt;
&lt;li&gt;In the upper-right corner of any page, click your profile photo, then click &lt;strong&gt;Settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the left sidebar, click &lt;strong&gt;Developer settings&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 2: Generate a New Token
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the left sidebar, click &lt;code&gt;Personal access tokens &amp;gt; Token Classic&lt;/code&gt; .&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Generate new token&lt;/strong&gt; .&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 3: Configure the Token
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Note&lt;/strong&gt;: If you are prompted to confirm your password, enter your GitHub password.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Note&lt;/strong&gt;: Give your token a descriptive name in the &lt;strong&gt;Note&lt;/strong&gt; field.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expiration&lt;/strong&gt;: Set an expiration date for the token. You can choose from 7 days, 30 days, 60 days, 90 days, or no expiration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Select Scopes&lt;/strong&gt;: Select the scopes or permissions you'd like to grant this token. For setting up a self-hosted runner, you typically need the &lt;code&gt;repo&lt;/code&gt; scope.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 4: Generate and Save the Token
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Generate token&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Important&lt;/strong&gt;: Copy the token to a secure location. This is the only time you will be able to see it. If you lose it, you will need to generate a new token.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Example of Required Scopes
&lt;/h3&gt;

&lt;p&gt;For setting up a self-hosted runner, you generally need the following scope:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;repo&lt;/strong&gt;: Full control of private repositories&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You now have a Personal Access Token (PAT) that you can use to authenticate with GitHub when setting up your self-hosted runner. Make sure to keep this token secure and do not share it publicly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-by-Step Guide Create Self Hosted Runner
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Launch an Ubuntu EC2 Instance (if using AWS)
&lt;/h3&gt;

&lt;p&gt;You can spin-up the instance either manually from AWS console or use Terraform IaC Automation&lt;/p&gt;

&lt;h4&gt;
  
  
  AWS Console Method
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Log in to your AWS Management Console.&lt;/li&gt;
&lt;li&gt;Navigate to the EC2 Dashboard.&lt;/li&gt;
&lt;li&gt;Click on "Launch Instance".&lt;/li&gt;
&lt;li&gt;Choose an Amazon Machine Image (AMI) with Ubuntu (e.g., Ubuntu Server 22.04 LTS or 24.04 LTS&lt;/li&gt;
&lt;li&gt;Select an instance type (e.g., t2.micro for testing).&lt;/li&gt;
&lt;li&gt;Configure instance details, add storage, and configure security groups as needed.&lt;/li&gt;
&lt;li&gt;Launch the instance and connect to it via SSH.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Or&lt;/p&gt;

&lt;h4&gt;
  
  
  Terraform IaC Method
&lt;/h4&gt;

&lt;p&gt;You can use Terraform IaC code to spin-up an EC2 instance. Refer the &lt;a href="https://github.com/terraform-aws-modules/terraform-aws-ec2-instance" rel="noopener noreferrer"&gt;Terraform EC2 Module Guide&lt;/a&gt; for the reference.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Set Up the Runner on Ubuntu
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;SSH into your Ubuntu instance.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a shell script file named &lt;code&gt;SETUP-RUNNER-LINUX.SH&lt;/code&gt; and add the following code:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# Check if both arguments are provided&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$#"&lt;/span&gt; &lt;span class="nt"&gt;-ne&lt;/span&gt; 2 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Missing arguments. Usage: &lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="s2"&gt; &amp;lt;repo_to_add_runner&amp;gt; &amp;lt;github_token&amp;gt;"&lt;/span&gt;
    &lt;span class="nb"&gt;exit &lt;/span&gt;1
&lt;span class="k"&gt;fi

&lt;/span&gt;&lt;span class="nv"&gt;repo_to_add_runner&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;
&lt;span class="nv"&gt;github_token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$2&lt;/span&gt;

&lt;span class="c"&gt;# Create a folder&lt;/span&gt;
&lt;span class="nb"&gt;mkdir &lt;/span&gt;actions-runner &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;actions-runner
&lt;span class="c"&gt;# Download the latest runner package&lt;/span&gt;
curl &lt;span class="nt"&gt;-o&lt;/span&gt; actions-runner-linux-x64-2.313.0.tar.gz &lt;span class="nt"&gt;-L&lt;/span&gt; https://github.com/actions/runner/releases/download/v2.313.0/actions-runner-linux-x64-2.313.0.tar.gz

&lt;span class="c"&gt;# Optional: Validate the hash&lt;/span&gt;
&lt;span class="c"&gt;# echo "5697e222e71c4  actions-runner-linux-x64-2.313.0.tar.gz" | shasum -a 256 -c&lt;/span&gt;

&lt;span class="c"&gt;# Create directory to extract the tar&lt;/span&gt;
&lt;span class="nb"&gt;mkdir &lt;/span&gt;runner-files &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;runner-files
&lt;span class="c"&gt;# Extract the installer&lt;/span&gt;
&lt;span class="nb"&gt;tar &lt;/span&gt;xzf ../actions-runner-linux-x64-2.313.0.tar.gz

&lt;span class="c"&gt;# Create GitHub runner registration token to be used in config.sh input&lt;/span&gt;
curl &lt;span class="nt"&gt;-L&lt;/span&gt; &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Accept: application/vnd.github+json"&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$github_token&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"X-GitHub-Api-Version: 2022-11-28"&lt;/span&gt; https://api.github.com/repos/chefgs/&lt;span class="nv"&gt;$repo_to_add_runner&lt;/span&gt;/actions/runners/registration-token | jq .token &lt;span class="nt"&gt;--raw-output&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; token.txt
&lt;span class="nv"&gt;repo_token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;token.txt&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Create the runner and start the configuration experience&lt;/span&gt;
./config.sh &lt;span class="nt"&gt;--unattended&lt;/span&gt; &lt;span class="nt"&gt;--url&lt;/span&gt; https://github.com/chefgs/&lt;span class="nv"&gt;$repo_to_add_runner&lt;/span&gt; &lt;span class="nt"&gt;--token&lt;/span&gt; &lt;span class="nv"&gt;$repo_token&lt;/span&gt;

&lt;span class="c"&gt;# Config.sh installs the service files. &lt;/span&gt;
&lt;span class="c"&gt;# So as a last step, setup runner service &amp;amp; run it!&lt;/span&gt;
./svc.sh &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ./svc.sh start

&lt;span class="c"&gt;# Otherwise, If you want to run the runner interactively, you can run ./run.sh&lt;/span&gt;

&lt;span class="c"&gt;# Clean up&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nt"&gt;-z&lt;/span&gt; token.txt &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;rm &lt;/span&gt;token.txt
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make the script executable:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x SETUP-RUNNER-LINUX.SH
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the script with your repository name and GitHub token as arguments:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./SETUP-RUNNER-LINUX.SH &amp;lt;repo_to_add_runner&amp;gt; &amp;lt;github_token&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 3: Update Your Workflow File
&lt;/h3&gt;

&lt;p&gt;Add the following line to your workflow file to use the self-hosted runner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;self-hosted&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example workflow file (&lt;code&gt;.github/workflows/ci.yml&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CI&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;self-hosted&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Checkout code&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run build&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;make build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Explanation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  How a Specific Repository Uses the Self-Hosted Runner
&lt;/h3&gt;

&lt;p&gt;When you set up a self-hosted runner, you are adding a custom machine to your GitHub repository that can execute GitHub Actions workflows. Here's how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Runner Setup&lt;/strong&gt;: You download and configure the runner software on your machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Registration Token&lt;/strong&gt;: You generate a registration token from GitHub, which is used to link the runner to your specific repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configuration&lt;/strong&gt;: You configure the runner with the repository URL and the registration token.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service Installation&lt;/strong&gt;: The runner is installed as a service on your machine, allowing it to start automatically and run in the background.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workflow Execution&lt;/strong&gt;: When a workflow is triggered in your repository, GitHub Actions will use the self-hosted runner to execute the jobs defined in the workflow.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Linking the Runner to a Repository
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Registration Token&lt;/strong&gt;: The registration token generated from GitHub is specific to the repository you want to link the runner to. This token ensures that the runner is securely associated with the correct repository. We will be using GitHub PAT token passed as an argument to fetch the repo registration token.- &lt;strong&gt;Repository URL&lt;/strong&gt;: During the configuration step, you provide the URL of the repository. This URL, combined with the registration token, links the runner to the repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Actions Workflow&lt;/strong&gt;: In your workflow file, you specify &lt;code&gt;runs-on: self-hosted&lt;/code&gt; to indicate that the job should run on the self-hosted runner.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By specifying &lt;code&gt;runs-on: self-hosted&lt;/code&gt;, GitHub Actions will use the self-hosted runner you set up to execute the job.&lt;/p&gt;

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

&lt;p&gt;You have now set up a GitHub Actions self-hosted runner on an Ubuntu system. Update your workflow files to use this runner by specifying &lt;code&gt;runs-on: self-hosted&lt;/code&gt;. This allows you to run your CI/CD jobs on your own hardware, providing more control over the environment and potentially reducing costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners" rel="noopener noreferrer"&gt;GitHub Self-hosted Runner Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




</description>
    </item>
    <item>
      <title>The Art of Creating Container Images and Best Practices</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Mon, 29 Jul 2024 19:12:06 +0000</pubDate>
      <link>https://forem.com/aws-builders/the-art-of-creating-container-images-and-best-practices-3p9d</link>
      <guid>https://forem.com/aws-builders/the-art-of-creating-container-images-and-best-practices-3p9d</guid>
      <description>&lt;p&gt;&lt;strong&gt;The Art of Creating Container Images&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;We are in the era of the evolving landscape of software product development, So the need for efficient, consistent, and scalable deployment methods has been more critical. &lt;/p&gt;

&lt;p&gt;One of the most significant advancements in this area is the use of containers. Containers have revolutionized the way we build, package, and deploy applications, offering a level of flexibility and reliability that traditional methods often lack. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is one of key automation pillar in DevOps Process Automation (CI/CD), that helps the developed frozen code has been released. It is making sure nothing gets changed in code once it is packaged into container images. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this blog, we'll explore the concept of containers, delve into the traditional approach of application packaging, and highlight the best practices for creating container images. Additionally, we'll provide examples of packaging React and Java-based applications using containers.&lt;/p&gt;




&lt;h2&gt;
  
  
  What are Containers?
&lt;/h2&gt;

&lt;p&gt;Containers are lightweight, portable units of software that package an application and its dependencies together, ensuring that it runs consistently across different computing environments. Unlike virtual machines, containers share the host system's kernel, which makes them more efficient in terms of resource usage. Containers can be run on any system that supports the container runtime, making them an ideal choice for modern, cloud-native application development and deployment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8vbrhev23ip8au1t9fa3.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8vbrhev23ip8au1t9fa3.jpeg" alt="Docker Born" width="422" height="585"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Packaging the Application: A Traditional Approach
&lt;/h2&gt;

&lt;p&gt;Before the advent of containers, applications were typically packaged and deployed using traditional methods. This often involved creating installation packages that bundled the application binaries along with necessary libraries and configuration files. These packages were then installed on target systems, where the application would run. While this approach worked for many years, it had several inherent limitations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Disadvantages of the Old Approach
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inconsistent Environments&lt;/strong&gt;: Traditional packaging methods often led to inconsistencies between development, testing, and production environments. This could cause applications to behave differently depending on where they were running. There is a chance that developers over-writes the finalised packages that are about to be deployed in release environments, causing the delay in product or feature releases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dependency Conflicts&lt;/strong&gt;: Managing dependencies was a significant challenge. Different applications might require different versions of the same library, leading to conflicts and "dependency hell."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Resource Overhead&lt;/strong&gt;: Traditional methods typically required separate instances of operating systems for each application, leading to high resource consumption and inefficiencies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Complex Deployment&lt;/strong&gt;: The deployment process was often complex and error-prone, requiring manual intervention and detailed configuration.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21awxbh2n5lp8nc1np4a.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21awxbh2n5lp8nc1np4a.jpg" alt="Before and after DevOps" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How Containers Help in Overcoming the Shortfall of Traditional Approach
&lt;/h2&gt;

&lt;p&gt;Containers address many of the shortcomings of traditional application packaging methods:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consistency&lt;/strong&gt;: By packaging the application and its dependencies together, containers ensure that the application runs the same way, regardless of where it is deployed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Isolation&lt;/strong&gt;: Containers provide process and filesystem isolation, reducing the risk of dependency conflicts and enhancing security.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficiency&lt;/strong&gt;: Containers share the host system's kernel and resources, making them more efficient than virtual machines. This allows for higher density and better resource utilization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Simplified Deployment&lt;/strong&gt;: Containers can be easily deployed, scaled, and managed using container orchestration platforms like Kubernetes. This simplifies the deployment process and reduces the risk of errors.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Container Image Creation Best Practices
&lt;/h2&gt;

&lt;p&gt;Creating efficient and secure container images is crucial for leveraging the full benefits of containerization. Here are some best practices to follow:&lt;/p&gt;

&lt;h3&gt;
  
  
  Low Image Size
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Minimal Base Images&lt;/strong&gt;: Start with a minimal base image, such as &lt;code&gt;alpine&lt;/code&gt; or &lt;code&gt;distroless&lt;/code&gt;, to reduce the overall image size.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multi-stage Builds&lt;/strong&gt;: Use multi-stage builds to separate the build environment from the runtime environment. This helps in keeping the final image lightweight by excluding unnecessary build tools and dependencies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Remove Unnecessary Files&lt;/strong&gt;: Clean up temporary files, cache, and other unnecessary files during the image build process.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Less/No Vulnerable Images
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Regular Updates&lt;/strong&gt;: Regularly update the base images and dependencies to include the latest security patches and updates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security Scanning&lt;/strong&gt;: Use tools like Trivy or Clair to scan images for known vulnerabilities before deploying them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Minimal Permissions&lt;/strong&gt;: Ensure that the application runs with the least privileges necessary to reduce potential attack surfaces.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Be Cautious in Opening Ports
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Limit Exposed Ports&lt;/strong&gt;: Only expose the ports that are necessary for the application to function. Avoid exposing unnecessary ports to reduce the attack surface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Non-standard Ports&lt;/strong&gt;: When possible, use non-standard ports to make it harder for attackers to find and exploit open services.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Follow Security Best Practices
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Non-root Users&lt;/strong&gt;: Run applications as non-root users within the container to minimize the impact of a potential security breach.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Environment Variables&lt;/strong&gt;: Avoid hardcoding sensitive information in the image. Use environment variables to pass sensitive data at runtime.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Network Policies&lt;/strong&gt;: Implement network policies to control the traffic between containers, enhancing security within the containerized environment.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Example of Packaging React and Java-based Application
&lt;/h2&gt;

&lt;p&gt;Let's look at examples of packaging a React application and a Java-based application using Docker.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Docker
&lt;/h3&gt;

&lt;p&gt;Before you can create and push images, you need to have Docker installed on your machine. You can follow the official Docker installation guide for your operating system &lt;a href="https://docs.docker.com/get-docker/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Packaging a React Application
&lt;/h3&gt;

&lt;p&gt;Let us consider a React based web application we have. Here is what the container creation Dockerfile will look like,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Dockerfile&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is a multi-stage Dockerfile. Where we have Two stages, and Stage 2 is dependent on Stage 1 Build.&lt;/p&gt;

&lt;p&gt;Dockerfile has to be added into the Project Home path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```dockerfile
# Stage 1: Build the React app
FROM node:14-alpine as build

WORKDIR /app

COPY package.json ./
COPY package-lock.json ./

RUN npm install

COPY . ./

RUN npm run build

# Stage 2: Serve the React app using Nginx
FROM nginx:alpine

COPY --from=build /app/build /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build and Run&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once the Docker file is created, we can run the commands below to create the Image in user Workstation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```sh
docker build -t my-react-app .
docker run -d -p 80:80 my-react-app
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Packaging a Java-based Application
&lt;/h3&gt;

&lt;p&gt;Let us consider another application, which is a Java based web application. So here is what the container creation Dockerfile will look like,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Dockerfile&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is also a multi-stage Dockerfile. Where we have Two stages, Stage 1 build code and Stage 2 is dependent on Stage 1 Build.&lt;/p&gt;

&lt;p&gt;Dockerfile has to be added into the Project Home path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;    &lt;span class="c"&gt;# Stage 1: Build the Java app&lt;/span&gt;
    FROM maven:3.8.1-jdk-11 as build

    WORKDIR /app

    COPY pom.xml ./
    COPY src ./src

    RUN mvn clean package -DskipTests

    &lt;span class="c"&gt;# Stage 2: Run the Java app&lt;/span&gt;
    FROM openjdk:11-jre-slim

    COPY --from=build /app/target/my-java-app.jar /app/my-java-app.jar

    EXPOSE 8080

    CMD ["java", "-jar", "/app/my-java-app.jar"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build and Run&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once the Docker file is created, we can run the commands below to create the Image in user Workstation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```sh
docker build -t my-java-app .
docker run -d -p 8080:8080 my-java-app
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Pushing Images to Docker Hub or Cloud Registry
&lt;/h2&gt;

&lt;p&gt;Once your container images are built and tested locally, you often need to push them to a container registry for storage and deployment to other environment. Here’s how to push images to different registries.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pushing Images to Docker Hub
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a Docker Hub Account&lt;/strong&gt;: If you don't already have one, go to &lt;a href="https://hub.docker.com/" rel="noopener noreferrer"&gt;Docker Hub&lt;/a&gt; and create an account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Login to Docker Hub&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will be prompted to enter your Docker Hub username and password.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Tag Your Image&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker tag my-image:latest your-dockerhub-username/my-image:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Push the Image&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker push your-dockerhub-username/my-image:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pushing Images to Google Container Registry (GCR)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Set Up GCloud&lt;/strong&gt;: Install the Google Cloud SDK and authenticate.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   gcloud auth login
   gcloud auth configure-docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Tag Your Image&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker tag my-image:latest gcr.io/your-project-id/my-image:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Push the Image&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker push gcr.io/your-project-id/my-image:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pushing Images to Amazon Elastic Container Registry (ECR)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create an ECR Repository&lt;/strong&gt;: Use the AWS Management Console or CLI to create a repository.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   aws ecr create-repository &lt;span class="nt"&gt;--repository-name&lt;/span&gt; my-repo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Authenticate Docker to Your ECR&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   aws ecr get-login-password &lt;span class="nt"&gt;--region&lt;/span&gt; your-region | docker login &lt;span class="nt"&gt;--username&lt;/span&gt; AWS &lt;span class="nt"&gt;--password-stdin&lt;/span&gt; your-account-id.dkr.ecr.your-region.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Tag Your Image&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker tag my-image:latest your-account-id.dkr.ecr.your-region.amazonaws.com/my-repo:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Push the Image&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker push your-account-id.dkr.ecr.your-region.amazonaws.com/my-repo:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pushing Images to Azure Container Registry (ACR)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create an ACR&lt;/strong&gt;: Use the Azure CLI to create a registry.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   az acr create &lt;span class="nt"&gt;--resource-group&lt;/span&gt; myResourceGroup &lt;span class="nt"&gt;--name&lt;/span&gt; myACR &lt;span class="nt"&gt;--sku&lt;/span&gt; Basic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Login to ACR&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   az acr login &lt;span class="nt"&gt;--name&lt;/span&gt; myACR
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Tag Your Image&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker tag my-image:latest myACR.azurecr.io/my-repo:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Push the Image&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker push myACR.azurecr.io/my-repo:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Summary of Steps
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create an Account/Repository&lt;/strong&gt;: Create an account on the desired registry platform and create a repository if necessary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Login to the Registry&lt;/strong&gt;: Use CLI commands to authenticate your Docker client with the registry.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tag Your Image&lt;/strong&gt;: Properly tag your Docker image to match the registry's naming conventions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Push the Image&lt;/strong&gt;: Use the &lt;code&gt;docker push&lt;/code&gt; command to upload your image to the registry.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;Containers have transformed the way we package and deploy applications, offering significant advantages over traditional methods. &lt;/p&gt;

&lt;p&gt;By following best practices for container image creation, we can build efficient, secure, and reliable containerized applications. Whether you're working with modern JavaScript frameworks like React or more traditional Java applications, containerization can streamline your development and deployment processes, ensuring consistency and scalability across different environments. &lt;/p&gt;

&lt;p&gt;Start leveraging containers today to take your application development to the next level.&lt;/p&gt;

&lt;h2&gt;
  
  
  Suggested Next Steps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Explore container orchestration platforms like Kubernetes.&lt;/li&gt;
&lt;li&gt;Integrate continuous integration and continuous deployment (CI/CD) pipelines with containerization.&lt;/li&gt;
&lt;li&gt;Learn about service mesh technologies for managing microservices within a containerized environment.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By embracing these technologies and practices, you can further enhance the efficiency and scalability of your applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reach out to me
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/saravanan-gnanaguru" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="//github.com/chefgs"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>development</category>
      <category>devrel</category>
    </item>
    <item>
      <title>Create Architecture Diagram as Code for a 2-Tier Bookstore Application</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Tue, 09 Jul 2024 15:20:30 +0000</pubDate>
      <link>https://forem.com/aws-builders/create-architecture-diagram-as-code-for-a-2-tier-bookstore-application-2356</link>
      <guid>https://forem.com/aws-builders/create-architecture-diagram-as-code-for-a-2-tier-bookstore-application-2356</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;How to Create Architecture Diagram as Code for a 2-Tier Bookstore Application&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Creating architecture &lt;code&gt;diagrams as code&lt;/code&gt; is a modern approach that offers numerous benefits over traditional diagramming methods, including architecture diagram automation, and consistency. This approach allows for version-controlled, easily reproducible, and modifiable diagrams that can evolve alongside your application.&lt;/p&gt;

&lt;p&gt;This article will guide you through the process of creating an architecture diagram for a 2-tier bookstore application in AWS Cloud using &lt;code&gt;Python&lt;/code&gt; and its [&lt;code&gt;diagrams&lt;/code&gt;] library.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Diagrams as Code?
&lt;/h2&gt;

&lt;p&gt;Diagrams as code offer several advantages over traditional diagramming tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Version Control&lt;/strong&gt;: Changes to diagrams can be tracked over time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automation&lt;/strong&gt;: Diagrams can be automatically updated as part of your CI/CD pipeline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consistency&lt;/strong&gt;: Ensures uniformity in the presentation of your architecture.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Diagram as code makes it easy to &lt;strong&gt;Architects&lt;/strong&gt; and &lt;strong&gt;Developers&lt;/strong&gt; to update their architecture diagram, and use version control to maintain various versions of the Architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools &amp;amp; Technology Used
&lt;/h2&gt;

&lt;p&gt;We'll use the [&lt;code&gt;diagrams&lt;/code&gt;] Python library, which allows for creating cloud system architecture diagrams using code. It supports various providers, including &lt;strong&gt;AWS, GCP, Azure&lt;/strong&gt;, and many more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python 3.x installed on your system&lt;/li&gt;
&lt;li&gt;Basic understanding of Python programming&lt;/li&gt;
&lt;li&gt;Familiarity with virtual environments in Python&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sample Application: Bookstore 2-Tier Architecture
&lt;/h2&gt;

&lt;p&gt;Our sample application is a simple bookstore with a 2-tier architecture consisting of a frontend and a backend, along with a database. It also includes a CI/CD pipeline and monitoring services.&lt;/p&gt;

&lt;p&gt;To run the Python code that generates an architecture diagram for a bookstore application, follow these detailed steps. These steps include setting up a virtual environment, installing dependencies, and running the script.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Setting Up a Python Virtual Environment
&lt;/h3&gt;

&lt;p&gt;First, you need to create a virtual environment. A virtual environment is a self-contained directory that contains a Python installation for a particular version of Python, plus a number of additional packages.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your terminal.&lt;/li&gt;
&lt;li&gt;Navigate to the directory where you want to store your project.&lt;/li&gt;
&lt;li&gt;Run the following command to create a virtual environment named &lt;code&gt;venv&lt;/code&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv venv


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Activate the Virtual Environment
&lt;/h3&gt;

&lt;p&gt;Activate the virtual environment to use it for your project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On macOS and Linux:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nb"&gt;source &lt;/span&gt;venv/bin/activate


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;On Windows:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

.&lt;span class="se"&gt;\v&lt;/span&gt;&lt;span class="nb"&gt;env&lt;/span&gt;&lt;span class="se"&gt;\S&lt;/span&gt;cripts&lt;span class="se"&gt;\a&lt;/span&gt;ctivate


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Install the Required Libraries
&lt;/h3&gt;

&lt;p&gt;With the environment activated, install the &lt;code&gt;diagrams&lt;/code&gt; library, which enables you to generate architecture diagrams using Python code.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

pip &lt;span class="nb"&gt;install &lt;/span&gt;diagrams graphviz


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Step 2: Writing the Diagram Code
&lt;/h2&gt;

&lt;p&gt;Create a new Python file named [&lt;code&gt;architecture.py&lt;/code&gt;] and open it in your favorite text editor. &lt;br&gt;
Copy the following code into the file. This code defines the architecture of a simple bookstore application with a 2-tier architecture, including a frontend, a backend, a database, a CI/CD pipeline, and monitoring services.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Diagram&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Edge&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.aws.compute&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;EC2&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.aws.database&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RDS&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.aws.network&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ELB&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Route53&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.aws.general&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Client&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.onprem.network&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Internet&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.onprem.monitoring&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Prometheus&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Grafana&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.programming.framework&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;React&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.custom&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Custom&lt;/span&gt;

&lt;span class="n"&gt;graph_attr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ranksep&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;1.0&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;#, 'rankdir': 'TB'}
&lt;/span&gt;
&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Diagram&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Two Tier Application Architecture&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;show&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;graph_attr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;graph_attr&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User Network&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;internet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Internet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Internet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CI/CD Pipeline&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Source Code&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;react&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;React&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;terraform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Custom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Terraform&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./tf.png&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;github_actions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Custom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GitHub Actions&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./ghactions.png&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AWS Cloud&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;VPC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Public Subnet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="n"&gt;dns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Route53&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DNS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;lb&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ELB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Load Balancer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="c1"&gt;# public_subnet = Subnet("Public Subnet")
&lt;/span&gt;                &lt;span class="n"&gt;dns&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;lb&lt;/span&gt;

            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Private Subnet for Backend&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="c1"&gt;# private_subnet_backend = Subnet("Private Subnet")
&lt;/span&gt;                &lt;span class="n"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;EC2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Backend (Node.js)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;RDS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Database (MongoDB)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;

            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Private Subnet for Frontend&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="c1"&gt;# private_subnet_frontend = Subnet("Private Subnet")
&lt;/span&gt;                &lt;span class="n"&gt;frontend&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;EC2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Frontend (React)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="c1"&gt;# private_subnet_frontend &amp;gt;&amp;gt; frontend
&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Monitoring&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;prometheus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Prometheus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Prometheus&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;grafana&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Grafana&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Grafana&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;internet&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;dns&lt;/span&gt;
    &lt;span class="n"&gt;react&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;github_actions&lt;/span&gt;
    &lt;span class="n"&gt;terraform&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;github_actions&lt;/span&gt;
    &lt;span class="n"&gt;lb&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Edge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HTTP/HTTPS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;frontend&lt;/span&gt;
    &lt;span class="n"&gt;lb&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Edge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HTTP/HTTPS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;backend&lt;/span&gt;
    &lt;span class="n"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Edge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Database Connection&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;
    &lt;span class="n"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;prometheus&lt;/span&gt;
    &lt;span class="n"&gt;frontend&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;prometheus&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;prometheus&lt;/span&gt;
    &lt;span class="n"&gt;prometheus&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;grafana&lt;/span&gt;

    &lt;span class="c1"&gt;# Connecting CI/CD Pipeline to AWS Cloud
&lt;/span&gt;    &lt;span class="n"&gt;github_actions&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Edge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;blue&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dashed&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Deploy to AWS Cloud&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;dns&lt;/span&gt;

&lt;span class="c1"&gt;# Creating Custom Node 
# Custom Node: We can create a custom node to represent the subnet. 
# The diagrams library allows you to create custom nodes with your own images, 
# which can be useful for representing components that are not available as predefined classes.
# from diagrams import Node
# class Subnet(Node):
#    _icon_dir = "path/to/custom/icons"
#    _icon = "subnet.png"
&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Full source code has been available in GitHub. Please &lt;a href="https://github.com/chefgs/gpt_demos/tree/main/bookstore-app/arch-diagram" rel="noopener noreferrer"&gt;check it out here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python Code Break down of the Architecture Diagram
&lt;/h2&gt;

&lt;p&gt;Let's break down the Python code used to generate the architecture diagram step-by-step:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Diagram&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Edge&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.aws.compute&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;EC2&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.aws.database&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RDS&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.aws.network&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ELB&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Route53&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.aws.devtools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Codepipeline&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Codebuild&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.aws.general&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Client&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.onprem.network&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Internet&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.onprem.container&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Docker&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.onprem.monitoring&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Prometheus&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Grafana&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;diagrams.programming.language&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Python&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Imports
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Diagram, Cluster, Edge&lt;/strong&gt;: Core components from the &lt;code&gt;diagrams&lt;/code&gt; library to create diagrams, group components, and define connections.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Components&lt;/strong&gt;: Various AWS components (&lt;code&gt;EC2&lt;/code&gt;, &lt;code&gt;RDS&lt;/code&gt;, &lt;code&gt;ELB&lt;/code&gt;, &lt;code&gt;Route53&lt;/code&gt;, &lt;code&gt;Codepipeline&lt;/code&gt;, &lt;code&gt;Codebuild&lt;/code&gt;, &lt;code&gt;Client&lt;/code&gt;) to represent different parts of the architecture.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On-Prem Components&lt;/strong&gt;: Components for non-cloud (on-prem) services (&lt;code&gt;Internet&lt;/code&gt;, &lt;code&gt;Docker&lt;/code&gt;, &lt;code&gt;Prometheus&lt;/code&gt;, &lt;code&gt;Grafana&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Programming Language&lt;/strong&gt;: Represents GitHub Actions with a generic programming language icon (&lt;code&gt;Python&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Creating the Diagram
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Diagram&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Two Tier Application Architecture&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;show&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;graph_attr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;graph_attr&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User Network&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;internet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Internet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Internet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Diagram&lt;/strong&gt;: The main context for the diagram, with the title "Bookstore Application Architecture". &lt;code&gt;show=False&lt;/code&gt; prevents the diagram from being immediately displayed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: Represents the user accessing the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DNS&lt;/strong&gt;: Uses Route53 to represent the DNS service.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  CI/CD Pipeline
&lt;/h3&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CI/CD Pipeline&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Source Code&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;react&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;React&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;terraform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Custom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Terraform&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./tf.png&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;github_actions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Custom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GitHub Actions&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./ghactions.png&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cluster&lt;/strong&gt;: Groups components logically. Here, it groups the CI/CD pipeline components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Actions&lt;/strong&gt;: Represented using a generic programming language user uploaded icon (&lt;code&gt;ghactions.png&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React and Custom&lt;/strong&gt;: MERN code and Terraform code representation (with user uploaded Terraform icon). They are integrated with the GitHub action workflow for CICD deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Cloud &amp;amp; Monitoring Components
&lt;/h3&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AWS Cloud&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;VPC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Public Subnet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="n"&gt;dns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Route53&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DNS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;lb&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ELB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Load Balancer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="c1"&gt;# public_subnet = Subnet("Public Subnet")
&lt;/span&gt;                &lt;span class="n"&gt;dns&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;lb&lt;/span&gt;

            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Private Subnet for Backend&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="c1"&gt;# private_subnet_backend = Subnet("Private Subnet")
&lt;/span&gt;                &lt;span class="n"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;EC2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Backend (Node.js)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;RDS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Database (MongoDB)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;

            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Private Subnet for Frontend&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="c1"&gt;# private_subnet_frontend = Subnet("Private Subnet")
&lt;/span&gt;                &lt;span class="n"&gt;frontend&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;EC2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Frontend (React)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="c1"&gt;# private_subnet_frontend &amp;gt;&amp;gt; frontend
&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Cluster&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Monitoring&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;prometheus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Prometheus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Prometheus&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;grafana&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Grafana&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Grafana&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Cloud Cluster&lt;/strong&gt;: Groups all AWS cloud components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load Balancer (ELB) and DNS&lt;/strong&gt;: Distributes traffic between frontend and backend services. DNS used to be exposed to the public internet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC Cluster&lt;/strong&gt;: VPC cluster has been created to indicate private and public subnet networks for UI layer and backend layer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend Service Cluster&lt;/strong&gt;: Contains the backend server (Node.js on EC2) and the database (MongoDB on RDS).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend Service Cluster&lt;/strong&gt;: Contains the frontend server (React on EC2).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring Cluster&lt;/strong&gt;: Contains Prometheus for metrics collection and Grafana for visualization.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Defining Connections
&lt;/h3&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;internet&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;dns&lt;/span&gt;
    &lt;span class="n"&gt;react&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;github_actions&lt;/span&gt;
    &lt;span class="n"&gt;terraform&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;github_actions&lt;/span&gt;
    &lt;span class="n"&gt;lb&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Edge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HTTP/HTTPS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;frontend&lt;/span&gt;
    &lt;span class="n"&gt;lb&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Edge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HTTP/HTTPS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;backend&lt;/span&gt;
    &lt;span class="n"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Edge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Database Connection&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;
    &lt;span class="n"&gt;backend&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;prometheus&lt;/span&gt;
    &lt;span class="n"&gt;frontend&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;prometheus&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;prometheus&lt;/span&gt;
    &lt;span class="n"&gt;prometheus&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;grafana&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Connections&lt;/strong&gt;: Represented using &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; operator, defining the flow and connections between components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;client &amp;gt;&amp;gt; internet &amp;gt;&amp;gt; dns&lt;/strong&gt;: The user accesses the DNS service, via public internet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;react &amp;gt;&amp;gt; github_actions&lt;/strong&gt;: Represents the CI/CD pipeline flow from MERN Code into integration GitHub Actions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;terraform &amp;gt;&amp;gt; github_actions&lt;/strong&gt;: Represents the CI/CD pipeline flow from Terraform infra deployment code into integration GitHub Actions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;lb &amp;gt;&amp;gt; Edge(label="HTTP/HTTPS") &amp;gt;&amp;gt; frontend&lt;/strong&gt;: The load balancer directs traffic to the frontend services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;lb &amp;gt;&amp;gt; Edge(label="HTTP/HTTPS") &amp;gt;&amp;gt; backend&lt;/strong&gt;: The load balancer directs traffic to the backend services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;backend &amp;gt;&amp;gt; Edge(label="Database Connection") &amp;gt;&amp;gt; db&lt;/strong&gt;: The backend service connects to the MongoDB database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;backend &amp;gt;&amp;gt; prometheus&lt;/strong&gt; and &lt;strong&gt;frontend &amp;gt;&amp;gt; prometheus&lt;/strong&gt;: Both frontend and backend services send metrics to Prometheus.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;prometheus &amp;gt;&amp;gt; grafana&lt;/strong&gt;: Prometheus metrics are visualized using Grafana.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;github_actions &amp;gt;&amp;gt; Edge(color="blue", style="dashed", label="Deploy to AWS Cloud") &amp;gt;&amp;gt; dns&lt;/strong&gt;: Depicts to connection from GitHub Action to AWS Cloud infra deployment and code deployment into servers&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Summary of Diagram Breakdown
&lt;/h3&gt;

&lt;p&gt;The Python script leverages the &lt;code&gt;diagrams&lt;/code&gt; library to create a structured, version-controlled architecture diagram. It groups related components into clusters, defines the interactions between them using directed edges, and ensures the entire infrastructure is visually represented in a clear, consistent manner. This approach makes it easy to update and maintain the architecture diagram as the application evolves.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding custom node for user-defined components
&lt;/h3&gt;

&lt;p&gt;Let us see how to create a custom node in Python using the &lt;code&gt;diagrams&lt;/code&gt; library. This library allows developers to visually represent their infrastructure and systems.&lt;/p&gt;

&lt;p&gt;The purpose of creating a custom node is to represent a user-defined architecture component and ICON/logo. &lt;/p&gt;

&lt;p&gt;Method 1: Defining the &lt;code&gt;from diagrams.custom import Custom&lt;/code&gt; Diagrams Custom module, and using this section along with the valid logo/ICON PNG image of the architecture component.&lt;br&gt;
For example, we have added Terraform Icon using this method.&lt;/p&gt;

&lt;p&gt;We need to store the license free PNG image for this purpose.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

from diagrams.custom import Custom

terraform = Custom("Terraform", "./tf.png")


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Method 2:&lt;br&gt;
As depicted on the &lt;em&gt;commented out&lt;/em&gt; example, a custom node definition for subnet has been added.&lt;/p&gt;

&lt;p&gt;A subnet is part of VPC architecture &amp;amp;, and is a logical subdivision of an IP network. The ability to create custom nodes is particularly useful when the predefined classes provided by the &lt;code&gt;diagrams&lt;/code&gt; library do not cover all the components you need to represent in your architecture diagrams.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The code snippet begins by importing the &lt;code&gt;Node&lt;/code&gt; class from the &lt;code&gt;diagrams&lt;/code&gt; library.&lt;/li&gt;
&lt;li&gt;This &lt;code&gt;Node&lt;/code&gt; class is the base class for all diagram nodes, and custom nodes can be created by subclassing it. &lt;/li&gt;
&lt;li&gt;The subclass shown in the example is named &lt;code&gt;Subnet&lt;/code&gt;, indicating its intended use to represent subnetworks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Within the &lt;code&gt;Subnet&lt;/code&gt; class, two class attributes are defined:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;_icon_dir&lt;/code&gt;: This attribute specifies the directory path where custom icons are stored. In this example, it's set to &lt;code&gt;"path/to/custom/icons"&lt;/code&gt;, which should be replaced with the actual path to the directory containing the icon files.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;_icon&lt;/code&gt;: This attribute specifies the filename of the icon image that will be used to visually represent the node in the diagram. Here, it is set to &lt;code&gt;"subnet.png"&lt;/code&gt;, indicating that an image file named &lt;code&gt;subnet.png&lt;/code&gt; in the specified directory will be used as the icon for the subnet node.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By defining these attributes, the &lt;code&gt;Subnet&lt;/code&gt; class tells the &lt;code&gt;diagrams&lt;/code&gt; library where to find the custom icon and which icon to use when rendering the subnet node in a diagram. This allows for a more customized and visually accurate representation of the system's architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Generating the Diagram
&lt;/h2&gt;

&lt;p&gt;Ensure the Python script ([&lt;code&gt;architecture.py&lt;/code&gt;] is saved in your project directory.&lt;/p&gt;

&lt;p&gt;Run the script to generate the architecture diagram. Ensure your virtual environment is activated, then execute:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

python architecture.py


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This command executes the script, which generates a PNG image named &lt;code&gt;Bookstore Application Architecture.png&lt;/code&gt; in the same directory, illustrating the architecture of the bookstore application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding the Diagram &lt;code&gt;Bookstore Application Architecture.png&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;User Network&lt;/strong&gt;: Represents the entry point for users, connecting through the internet to our application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD Pipeline&lt;/strong&gt;: Showcases the automation for deploying our React frontend and Terraform configurations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Cloud&lt;/strong&gt;: Hosts our application, including the load balancer, DNS service, backend service (Node.js), frontend service (React), and database (MongoDB).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring&lt;/strong&gt;: Utilizes Prometheus for monitoring and Grafana for visualization.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fedqzic58yebbm0s1un8e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fedqzic58yebbm0s1un8e.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Deactivating the Virtual Environment
&lt;/h2&gt;

&lt;p&gt;Once you're done working in the virtual environment, you can deactivate it by running:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

deactivate


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This command returns you to the system’s default Python interpreter with all its installed libraries.&lt;/p&gt;

&lt;p&gt;By following these steps, you've successfully set up a virtual environment, installed necessary dependencies, and run a Python script to generate an architecture diagram for a bookstore application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits &amp;amp; Use-cases of Diagram as code
&lt;/h2&gt;

&lt;p&gt;Diagrams as code offer numerous benefits in real-time project scenarios, providing a powerful and efficient way to manage and visualize complex system architectures. Here are some typical use-cases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Documentation and Communication&lt;br&gt;
Architecture Documentation: Automatically generate up-to-date diagrams that accurately reflect the current state of the system architecture. This ensures that documentation is always current and avoids the pitfalls of manually maintained diagrams.&lt;br&gt;
Team Communication: Facilitate better communication among team members by providing a clear and consistent visualization of the architecture, which can be easily shared and discussed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Infrastructure as Code (IaC) Integration&lt;br&gt;
IaC Synchronization: Use diagrams as code to keep architecture diagrams in sync with the actual infrastructure managed by tools like Terraform, CloudFormation, or Ansible. This provides a visual representation of the infrastructure that matches the code.&lt;br&gt;
Automated Updates: Automatically update architecture diagrams as part of the CI/CD pipeline whenever changes are made to the IaC scripts. This ensures that diagrams reflect the latest infrastructure changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CI/CD Pipeline Integration&lt;br&gt;
Pipeline Visualization: Visualize the CI/CD pipeline stages and the flow of code from development to production. This helps in understanding the deployment process and identifying potential bottlenecks.&lt;br&gt;
Deployment Architecture: Generate diagrams that show the architecture of the deployed application, including microservices, databases, and other components. This can be especially useful for troubleshooting and optimizing deployment strategies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Microservices and Distributed Systems&lt;br&gt;
Service Dependencies: Visualize the dependencies and interactions between microservices in a distributed system. This helps in understanding the overall system behavior and identifying potential points of failure.&lt;br&gt;
Dynamic Environments: Automatically generate diagrams for dynamic environments where services and dependencies may frequently change. This ensures that the architecture diagram remains accurate and up-to-date.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Architecture diagram AI automation:&lt;br&gt;
If you want to create AI to generate architecture diagram for given prompt, then we can use this method of generating diagrams&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;You've now successfully created an architecture diagram as code for a 2-tier bookstore application. This method allows for easy updates, version control, and integration into CI/CD pipelines, making it an efficient tool for modern software development practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docs Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://diagrams.mingrammer.com/" rel="noopener noreferrer"&gt;Python Diagrams&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://diagrams.mingrammer.com/docs/getting-started/installation" rel="noopener noreferrer"&gt;Installation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://diagrams.mingrammer.com/docs/getting-started/examples" rel="noopener noreferrer"&gt;Examples&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Follow me on,
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/chefgs"&gt;Dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/chefgs" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/saravanan-gnanaguru/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/saransid" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gsaravanan.dev" rel="noopener noreferrer"&gt;gsaravanan.dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Share your views about creating Architecture Diagrams as code.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>architecture</category>
      <category>devrel</category>
    </item>
    <item>
      <title>Practicing Kubernetes Control Plane environment in Killercoda Interactive Terminal</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Tue, 23 May 2023 16:18:54 +0000</pubDate>
      <link>https://forem.com/kcdchennai/practicing-kubernetes-control-plane-environment-in-killercoda-2pj4</link>
      <guid>https://forem.com/kcdchennai/practicing-kubernetes-control-plane-environment-in-killercoda-2pj4</guid>
      <description>&lt;h2&gt;
  
  
  Killercoda Interactive Terminal
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://killercoda.com/" rel="noopener noreferrer"&gt;Killercoda&lt;/a&gt; offers free environments (based on Ubuntu) with various tools for beginners to try hands-on. It also has the Kubernetes playground which provides control plane server access for 1 hour. In which we can try to practice hands-on with control plane components.&lt;br&gt;
Because sometimes we are dependent on training platforms to try the control plane (or kubeadm) practice, and killercoda comes handy as a free platform to satisfy the needs.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;killercoda&lt;/code&gt; environment is similar to the &lt;code&gt;killershell&lt;/code&gt; Kubernetes certification exam environment, but without the test scenarios.&lt;/p&gt;

&lt;p&gt;So to get started with &lt;code&gt;killercoda&lt;/code&gt;, users need to sign up for an account using their preferred method listed on the screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f3tolp94po2iixatlt9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f3tolp94po2iixatlt9.png" alt="Image description" width="455" height="445"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  What is available in Killercoda Playground
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;There are variety of options available in Killercoda, plain Ubuntu OS, Kubernetes control plane with various versions and other options related to Kubernetes environment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmxew8rtjptqdd69o543u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmxew8rtjptqdd69o543u.png" alt="Image description" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Choose a Kubernetes environment
&lt;/h3&gt;

&lt;p&gt;Let us choose &lt;strong&gt;Kubernetes v1.26&lt;/strong&gt; environment and inspect the internal components of Kubernetes control plane&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kubectl &lt;code&gt;get nodes&lt;/code&gt; and &lt;code&gt;get namespace&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcxf6hjzez02ehhpde0v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcxf6hjzez02ehhpde0v.png" alt="Image description" width="345" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This control plane has 2 nodes and 5 namespaces&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kubectl &lt;code&gt;get pods -A -o wide&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight livescript"&gt;&lt;code&gt;&lt;span class="nv"&gt;controlplane&lt;/span&gt; &lt;span class="nv"&gt;$&lt;/span&gt; &lt;span class="nv"&gt;k&lt;/span&gt; &lt;span class="nv"&gt;get&lt;/span&gt; &lt;span class="nv"&gt;pods&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;A&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;o&lt;/span&gt; &lt;span class="nv"&gt;wide&lt;/span&gt;
&lt;span class="nv"&gt;NAMESPACE&lt;/span&gt;            &lt;span class="nv"&gt;NAME&lt;/span&gt;                                       &lt;span class="nv"&gt;READY&lt;/span&gt;   &lt;span class="nv"&gt;STATUS&lt;/span&gt;    &lt;span class="nv"&gt;RESTARTS&lt;/span&gt;   &lt;span class="nv"&gt;AGE&lt;/span&gt;     &lt;span class="nv"&gt;IP&lt;/span&gt;            &lt;span class="nv"&gt;NODE&lt;/span&gt;           &lt;span class="nv"&gt;NOMINATED&lt;/span&gt; &lt;span class="nv"&gt;NODE&lt;/span&gt;   &lt;span class="nv"&gt;READINESS&lt;/span&gt; &lt;span class="nv"&gt;GATES&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;calico-kube-controllers&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5f94594857&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;kjbzt&lt;/span&gt;   &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;4&lt;/span&gt;          &lt;span class="mi"&gt;2d20h&lt;/span&gt;   &lt;span class="mf"&gt;192.168&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;   &lt;span class="nv"&gt;controlplane&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;canal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5zh75&lt;/span&gt;                                &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="mi"&gt;32m&lt;/span&gt;     &lt;span class="mf"&gt;172.30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;    &lt;span class="nv"&gt;controlplane&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;canal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9wbgc&lt;/span&gt;                                &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="mi"&gt;32m&lt;/span&gt;     &lt;span class="mf"&gt;172.30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;    &lt;span class="nv"&gt;node01&lt;/span&gt;         &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;coredns&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;68dc769db8&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;4nd5b&lt;/span&gt;                   &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="mi"&gt;2d19h&lt;/span&gt;   &lt;span class="mf"&gt;192.168&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;   &lt;span class="nv"&gt;controlplane&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;coredns&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;68dc769db8&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;fmx25&lt;/span&gt;                   &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="mi"&gt;2d19h&lt;/span&gt;   &lt;span class="mf"&gt;192.168&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;   &lt;span class="nv"&gt;node01&lt;/span&gt;         &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;etcd-controlplane&lt;/span&gt;                          &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="mi"&gt;2d20h&lt;/span&gt;   &lt;span class="mf"&gt;172.30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;    &lt;span class="nv"&gt;controlplane&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;kube-apiserver-controlplane&lt;/span&gt;                &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;2&lt;/span&gt;          &lt;span class="mi"&gt;2d20h&lt;/span&gt;   &lt;span class="mf"&gt;172.30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;    &lt;span class="nv"&gt;controlplane&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;kube-controller-manager-controlplane&lt;/span&gt;       &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;2&lt;/span&gt;          &lt;span class="mi"&gt;2d20h&lt;/span&gt;   &lt;span class="mf"&gt;172.30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;    &lt;span class="nv"&gt;controlplane&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;kube-proxy&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7zc4f&lt;/span&gt;                           &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="mi"&gt;2d20h&lt;/span&gt;   &lt;span class="mf"&gt;172.30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;    &lt;span class="nv"&gt;controlplane&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;kube-proxy-glxxb&lt;/span&gt;                           &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="mi"&gt;2d19h&lt;/span&gt;   &lt;span class="mf"&gt;172.30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;    &lt;span class="nv"&gt;node01&lt;/span&gt;         &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;kube-system&lt;/span&gt;          &lt;span class="nv"&gt;kube-scheduler-controlplane&lt;/span&gt;                &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;2&lt;/span&gt;          &lt;span class="mi"&gt;2d20h&lt;/span&gt;   &lt;span class="mf"&gt;172.30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;    &lt;span class="nv"&gt;controlplane&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;local-path-storage&lt;/span&gt;   &lt;span class="nv"&gt;local-path-provisioner&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;8bc8875b&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;lspfz&lt;/span&gt;      &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;     &lt;span class="nc"&gt;Running&lt;/span&gt;   &lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="mi"&gt;2d20h&lt;/span&gt;   &lt;span class="mf"&gt;192.168&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;   &lt;span class="nv"&gt;controlplane&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;           &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;none&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We can see the list contains the control plane components&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprzs4wt7of5rf790k0xc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprzs4wt7of5rf790k0xc.png" alt="Image description" width="325" height="130"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Contents of the directory &lt;code&gt;/etc/kubernetes&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;We can find all the important files of Kubernetes control plane components, configurations, secrets and key files inside &lt;code&gt;/etc/kubernetes&lt;/code&gt; directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight livescript"&gt;&lt;code&gt;&lt;span class="nv"&gt;controlplane&lt;/span&gt; &lt;span class="nv"&gt;$&lt;/span&gt; &lt;span class="nv"&gt;pwd&lt;/span&gt;   
&lt;span class="err"&gt;/e&lt;/span&gt;&lt;span class="nv"&gt;tc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;

&lt;span class="nv"&gt;controlplane&lt;/span&gt; &lt;span class="nv"&gt;$&lt;/span&gt; &lt;span class="nv"&gt;tree&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;dirsfirst&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;manifests&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;yaml&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;kube-apiserver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;yaml&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;kube-controller-manager&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;yaml&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;kube-scheduler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;yaml&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;pki&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;etcd&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;healthcheck-client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;healthcheck-client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;peer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;peer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;apiserver-etcd-client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;apiserver-etcd-client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;apiserver-kubelet-client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;apiserver-kubelet-client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;apiserver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;apiserver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;front-proxy-ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;front-proxy-ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;front-proxy-client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;front-proxy-client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;sa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;   &lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;sa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pub&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;conf&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;controller-manager&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;conf&lt;/span&gt;
&lt;span class="k"&gt;|&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;kubelet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;conf&lt;/span&gt;
&lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="nv"&gt;scheduler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;conf&lt;/span&gt;

&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="nv"&gt;directories&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="nv"&gt;files&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Control Plane Component Manifest files
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Let us see the contents of &lt;code&gt;manifests/kube-apiserver.yaml&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;We can notice the manifest has config values of etcd, tls and other components
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;controlplane $ cat manifests/kube-apiserver.yaml&lt;/span&gt; 
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;172.30.1.2:6443&lt;/span&gt;
  &lt;span class="na"&gt;creationTimestamp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;component&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kube-apiserver&lt;/span&gt;
    &lt;span class="na"&gt;tier&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;control-plane&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kube-apiserver&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kube-system&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;kube-apiserver&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--advertise-address=172.30.1.2&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--allow-privileged=true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--authorization-mode=Node,RBAC&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--client-ca-file=/etc/kubernetes/pki/ca.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--enable-admission-plugins=NodeRestriction&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--enable-bootstrap-token-auth=true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--etcd-servers=https://127.0.0.1:2379&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--requestheader-allowed-names=front-proxy-client&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--requestheader-extra-headers-prefix=X-Remote-Extra-&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--requestheader-group-headers=X-Remote-Group&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--requestheader-username-headers=X-Remote-User&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--secure-port=6443&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--service-account-issuer=https://kubernetes.default.svc.cluster.local&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--service-account-key-file=/etc/kubernetes/pki/sa.pub&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--service-account-signing-key-file=/etc/kubernetes/pki/sa.key&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--service-cluster-ip-range=10.96.0.0/12&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--tls-cert-file=/etc/kubernetes/pki/apiserver.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--tls-private-key-file=/etc/kubernetes/pki/apiserver.key&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;registry.k8s.io/kube-apiserver:v1.26.1&lt;/span&gt;
    &lt;span class="na"&gt;imagePullPolicy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;IfNotPresent&lt;/span&gt;
    &lt;span class="na"&gt;livenessProbe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8&lt;/span&gt;
      &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;172.30.1.2&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/livez&lt;/span&gt;
        &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6443&lt;/span&gt;
        &lt;span class="na"&gt;scheme&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;HTTPS&lt;/span&gt;
      &lt;span class="na"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
      &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
      &lt;span class="na"&gt;timeoutSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kube-apiserver&lt;/span&gt;
    &lt;span class="na"&gt;readinessProbe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;
      &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;172.30.1.2&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/readyz&lt;/span&gt;
        &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6443&lt;/span&gt;
        &lt;span class="na"&gt;scheme&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;HTTPS&lt;/span&gt;
      &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
      &lt;span class="na"&gt;timeoutSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;50m&lt;/span&gt;
    &lt;span class="na"&gt;startupProbe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24&lt;/span&gt;
      &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;172.30.1.2&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/livez&lt;/span&gt;
        &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6443&lt;/span&gt;
        &lt;span class="na"&gt;scheme&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;HTTPS&lt;/span&gt;
      &lt;span class="na"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
      &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
      &lt;span class="na"&gt;timeoutSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15&lt;/span&gt;
    &lt;span class="na"&gt;volumeMounts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/ssl/certs&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ca-certs&lt;/span&gt;
      &lt;span class="na"&gt;readOnly&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/ca-certificates&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etc-ca-certificates&lt;/span&gt;
      &lt;span class="na"&gt;readOnly&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/pki&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etc-pki&lt;/span&gt;
      &lt;span class="na"&gt;readOnly&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/kubernetes/pki&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;k8s-certs&lt;/span&gt;
      &lt;span class="na"&gt;readOnly&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/usr/local/share/ca-certificates&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;usr-local-share-ca-certificates&lt;/span&gt;
      &lt;span class="na"&gt;readOnly&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/usr/share/ca-certificates&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;usr-share-ca-certificates&lt;/span&gt;
      &lt;span class="na"&gt;readOnly&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;hostNetwork&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;priorityClassName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;system-node-critical&lt;/span&gt;
  &lt;span class="na"&gt;securityContext&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;seccompProfile&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;RuntimeDefault&lt;/span&gt;
  &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;hostPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/ssl/certs&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DirectoryOrCreate&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ca-certs&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;hostPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/ca-certificates&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DirectoryOrCreate&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etc-ca-certificates&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;hostPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/pki&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DirectoryOrCreate&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etc-pki&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;hostPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/kubernetes/pki&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DirectoryOrCreate&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;k8s-certs&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;hostPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/usr/local/share/ca-certificates&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DirectoryOrCreate&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;usr-local-share-ca-certificates&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;hostPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/usr/share/ca-certificates&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DirectoryOrCreate&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;usr-share-ca-certificates&lt;/span&gt;
&lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Similarly, let us inspect the contents of manifests/etcd.yaml&lt;/li&gt;
&lt;li&gt;We notice the manifest has an etcd key, cert files and other config values.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;controlplane $ cat manifests/etcd.yaml&lt;/span&gt; 
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;kubeadm.kubernetes.io/etcd.advertise-client-urls&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://172.30.1.2:2379&lt;/span&gt;
  &lt;span class="na"&gt;creationTimestamp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;component&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etcd&lt;/span&gt;
    &lt;span class="na"&gt;tier&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;control-plane&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etcd&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kube-system&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;etcd&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--advertise-client-urls=https://172.30.1.2:2379&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--cert-file=/etc/kubernetes/pki/etcd/server.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--client-cert-auth=true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--data-dir=/var/lib/etcd&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--experimental-initial-corrupt-check=true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--experimental-watch-progress-notify-interval=5s&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--initial-advertise-peer-urls=https://172.30.1.2:2380&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--initial-cluster=controlplane=https://172.30.1.2:2380&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--key-file=/etc/kubernetes/pki/etcd/server.key&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--listen-client-urls=https://127.0.0.1:2379,https://172.30.1.2:2379&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--listen-metrics-urls=http://127.0.0.1:2381&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--listen-peer-urls=https://172.30.1.2:2380&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--name=controlplane&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--peer-client-cert-auth=true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--peer-key-file=/etc/kubernetes/pki/etcd/peer.key&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--snapshot-count=10000&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;--trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;registry.k8s.io/etcd:3.5.6-0&lt;/span&gt;
    &lt;span class="na"&gt;imagePullPolicy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;IfNotPresent&lt;/span&gt;
    &lt;span class="na"&gt;livenessProbe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8&lt;/span&gt;
      &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;127.0.0.1&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/health?exclude=NOSPACE&amp;amp;serializable=true&lt;/span&gt;
        &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2381&lt;/span&gt;
        &lt;span class="na"&gt;scheme&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;HTTP&lt;/span&gt;
      &lt;span class="na"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
      &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
      &lt;span class="na"&gt;timeoutSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etcd&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;25m&lt;/span&gt;
        &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;100Mi&lt;/span&gt;
    &lt;span class="na"&gt;startupProbe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24&lt;/span&gt;
      &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;127.0.0.1&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/health?serializable=false&lt;/span&gt;
        &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2381&lt;/span&gt;
        &lt;span class="na"&gt;scheme&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;HTTP&lt;/span&gt;
      &lt;span class="na"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
      &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
      &lt;span class="na"&gt;timeoutSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15&lt;/span&gt;
    &lt;span class="na"&gt;volumeMounts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/var/lib/etcd&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etcd-data&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/kubernetes/pki/etcd&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etcd-certs&lt;/span&gt;
  &lt;span class="na"&gt;hostNetwork&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;priorityClassName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;system-node-critical&lt;/span&gt;
  &lt;span class="na"&gt;securityContext&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;seccompProfile&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;RuntimeDefault&lt;/span&gt;
  &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;hostPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/kubernetes/pki/etcd&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DirectoryOrCreate&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etcd-certs&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;hostPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/var/lib/etcd&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DirectoryOrCreate&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;etcd-data&lt;/span&gt;
&lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Taking ETCD Backup snapshot in control plane
&lt;/h3&gt;

&lt;p&gt;Now, let us try a ETCD backup using the command from &lt;a href="https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/#backing-up-an-etcd-cluster" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight livescript"&gt;&lt;code&gt;&lt;span class="nv"&gt;ETCDCTL_API&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="nv"&gt;etcdctl&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;endpoints&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="na"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="mf"&gt;127.0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;2379&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;cacert&lt;/span&gt;&lt;span class="o"&gt;=&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;trusted-ca-file&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;cert&lt;/span&gt;&lt;span class="o"&gt;=&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;cert-file&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;key-file&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="nv"&gt;snapshot&lt;/span&gt; &lt;span class="nv"&gt;save&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;backup-file-location&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can grep for &lt;code&gt;pki&lt;/code&gt; values in &lt;code&gt;manifests/etcd.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight livescript"&gt;&lt;code&gt;&lt;span class="nv"&gt;controlplane&lt;/span&gt; &lt;span class="nv"&gt;$&lt;/span&gt; &lt;span class="nv"&gt;grep&lt;/span&gt; &lt;span class="nv"&gt;pki&lt;/span&gt; &lt;span class="nv"&gt;manifests&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;yaml&lt;/span&gt; 
    &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;cert-file&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
    &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;key-file&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
    &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;peer-cert-file&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;peer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
    &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;peer-key-file&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;peer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;
    &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;peer-trusted-ca-file&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
    &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;trusted-ca-file&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace values of &lt;code&gt;cert-file&lt;/code&gt;, &lt;code&gt;key-file&lt;/code&gt; and &lt;code&gt;trusted-ca-file&lt;/code&gt; in the &lt;code&gt;etcdctl snapshot save&lt;/code&gt; command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight livescript"&gt;&lt;code&gt;&lt;span class="nv"&gt;ETCDCTL_API&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="nv"&gt;etcdctl&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;endpoints&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="na"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="mf"&gt;127.0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;2379&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;cacert&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;cert&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="nv"&gt;snapshot&lt;/span&gt; &lt;span class="nv"&gt;save&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;snapshot-pre-boot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;db&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we will run the snapshot save command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight livescript"&gt;&lt;code&gt;&lt;span class="nv"&gt;controlplane&lt;/span&gt; &lt;span class="nv"&gt;$&lt;/span&gt; &lt;span class="nv"&gt;ETCDCTL_API&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="nv"&gt;etcdctl&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;endpoints&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="na"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="mf"&gt;127.0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;2379&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;cacert&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;cert&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;crt&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;kubernetes&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;pki&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etcd&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;snapshot&lt;/span&gt; &lt;span class="nv"&gt;save&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;snapshot-pre-boot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;db&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"info"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"ts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;1684855944.7321026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"caller"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"snapshot/v3_snapshot.go:68"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"msg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"created temporary db file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"/tmp/snapshot-pre-boot.db.part"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"info"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"ts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;1684855944.7623043&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"logger"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"client"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"caller"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"v3/maintenance.go:211"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"msg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"opened snapshot stream; downloading"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"info"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"ts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;1684855944.7625878&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"caller"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"snapshot/v3_snapshot.go:76"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"msg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"fetching snapshot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"endpoint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"https://127.0.0.1:2379"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"info"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"ts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;1684855946.5906115&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"logger"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"client"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"caller"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"v3/maintenance.go:219"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"msg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"completed snapshot read; closing"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"info"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"ts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;1684855948.752495&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"caller"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"snapshot/v3_snapshot.go:91"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"msg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"fetched snapshot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"endpoint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"https://127.0.0.1:2379"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"6.1 MB"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"took"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"4 seconds ago"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"info"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"ts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;1684855948.7526174&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"caller"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"snapshot/v3_snapshot.go:100"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"msg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"saved"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s"&gt;"/tmp/snapshot-pre-boot.db"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;Snapshot&lt;/span&gt; &lt;span class="nv"&gt;saved&lt;/span&gt; &lt;span class="nv"&gt;at&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;snapshot-pre-boot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;db&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Idea of this blog is to introduce the &lt;code&gt;killercoda&lt;/code&gt; environment to newbies of Kubernetes. So they can explore the Control plane components as part of their learning.&lt;br&gt;
I believe seeing things and getting your hands dirty at the same time allows anyone to catch hold of things faster. &lt;br&gt;
In terms of kubernetes learning the more practice we do, the more confidence we do get.&lt;/p&gt;

&lt;h3&gt;
  
  
  Follow me on,
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/chefgs"&gt;Dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/chefgs" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/saravanan-gnanaguru-1941a919/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/saransid" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gsaravanan.dev" rel="noopener noreferrer"&gt;gsaravanan.dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>kubernetes</category>
      <category>beginners</category>
      <category>kcdchennai</category>
      <category>blogathon</category>
    </item>
    <item>
      <title>Automate Kubernetes Deployment using Terraform and GitHub Actions</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Mon, 22 May 2023 19:03:40 +0000</pubDate>
      <link>https://forem.com/chefgs/automate-kubernetes-deployment-using-terraform-and-github-actions-3m5c</link>
      <guid>https://forem.com/chefgs/automate-kubernetes-deployment-using-terraform-and-github-actions-3m5c</guid>
      <description>&lt;h2&gt;
  
  
  Automate Kubernetes Deployment using Terraform and GitHub Actions
&lt;/h2&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I've created Terraform code that will create a namespace and deploys the Nginx server in the minikube cluster and TF code verification and deployment has been automated using GitHub actions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How I built
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Created a GitHub Actions workflow using the Marketplace Github actions plugins,

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;actions/checkout@v2.5.0&lt;/code&gt; -&amp;gt; to Checkout the code&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;medyagh/setup-minikube@v0.0.13&lt;/code&gt; -&amp;gt; to setup &lt;code&gt;minikube&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Azure/setup-kubectl@v3&lt;/code&gt; -&amp;gt; to setup &lt;code&gt;kubectl&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hashicorp/setup-terraform@v2.0.2&lt;/code&gt; -&amp;gt; to setup &lt;code&gt;terraform&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;This workflow can be used in development environments, in which an Infra developer can create the Terraform code to deploy kubernetes workload. Once after creating the tf code, the developer can trigger the Terraform workflow, that will do the CI for Terraform code, and deploy the infra in &lt;code&gt;minikube&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;The kube config context has been created as a variable in Terraform, so it can be overridden with other Kubernetes Cluster config and contexts from Cloud providers like Amazon EKS or Azure AKS or GCP GKE Clusters.&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Category Submission
&lt;/h3&gt;

&lt;p&gt;DIY Deployments&lt;/p&gt;

&lt;h3&gt;
  
  
  App Link
&lt;/h3&gt;

&lt;p&gt;Source code for the Repo is &lt;a href="https://github.com/chefgs/tf_k8s_actions" rel="noopener noreferrer"&gt;available here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Github Action &lt;a href="https://github.com/chefgs/tf_k8s_actions/blob/main/.github/workflows/tf_k8s_workflow.yml" rel="noopener noreferrer"&gt;Workflow Yaml&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Screenshots
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd8ifcj9ohlly83o0v16l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd8ifcj9ohlly83o0v16l.png" alt="tf k8s workflow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Description
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Triggering the Workflow
&lt;/h3&gt;

&lt;p&gt;This workflow can be triggered from the &lt;code&gt;actions&lt;/code&gt; tab, by providing the Terraform code directory as an input (Refer the screenshot above).&lt;br&gt;
So it will run the below steps in the directory provided as input,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Workflow installs, &lt;code&gt;minikube&lt;/code&gt;, &lt;code&gt;kubectl&lt;/code&gt; and &lt;code&gt;terraform&lt;/code&gt; CLI executables needed to be used by the rest of workflow&lt;/li&gt;
&lt;li&gt;It runs &lt;code&gt;terraform init&lt;/code&gt; command to download the &lt;code&gt;kubernetes&lt;/code&gt; provider&lt;/li&gt;
&lt;li&gt;Then runs &lt;code&gt;terraform validate&lt;/code&gt; command to check the tf code is valid or not&lt;/li&gt;
&lt;li&gt;After that it runs, &lt;code&gt;terraform plan&lt;/code&gt; and &lt;code&gt;terraform apply&lt;/code&gt;  commands and performs the Kubernetes namespace creation and deploys the nginx server. &lt;/li&gt;
&lt;li&gt;Workflow also has &lt;code&gt;terraform destroy&lt;/code&gt; command, that deletes the kubernetes infra created in the workflow&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Workflow Dispatch
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;This workflow uses, &lt;code&gt;workflow_displatch&lt;/code&gt; Github feature - It is the sub block inside the on event triggering block, in which we can specify what are the inputs needed to trigger the workflow.&lt;/li&gt;
&lt;li&gt;In the on event block &lt;code&gt;workflow_dispatch&lt;/code&gt; section, we will be adding the inputs directory path, on which we are going to run our Terraform code validation&lt;/li&gt;
&lt;li&gt;It is defaulted to the 'kubernetes' directory present in the repo for the ease of demo purpose.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Link to Source Code
&lt;/h3&gt;

&lt;p&gt;Source code for the Repo is &lt;a href="https://github.com/chefgs/tf_k8s_actions" rel="noopener noreferrer"&gt;available here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Github Action &lt;a href="https://github.com/chefgs/tf_k8s_actions/actions/runs/5048663621/jobs/9057128988" rel="noopener noreferrer"&gt;Workflow Log&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Github Action &lt;a href="https://github.com/chefgs/tf_k8s_actions/blob/main/.github/workflows/tf_k8s_workflow.yml" rel="noopener noreferrer"&gt;Workflow Yaml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqt9kh6g1yc6b5bfqwwlu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqt9kh6g1yc6b5bfqwwlu.png" alt="GH Action workflow run"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Permissive License
&lt;/h3&gt;

&lt;p&gt;MIT License&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;As mentioned earlier,&lt;br&gt;
This workflow (or pipeline) can be configured for testing the terraform code pushed by DevOps engineers/SREs/Developers, and can be triggered whenever there is new tf code is pushed into a specific branch for Kubernetes workload management&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources/Info
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs" rel="noopener noreferrer"&gt;Terraform Kubernetes Provider&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs" rel="noopener noreferrer"&gt;Workflow Dispatch Inputs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobs" rel="noopener noreferrer"&gt;Jobs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/marketplace/actions/hashicorp-setup-terraform" rel="noopener noreferrer"&gt;Terraform Market place Action&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>githubhack23</category>
      <category>terraform</category>
      <category>kubernetes</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>Platform Engineering and Internal Developer Platform</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Thu, 11 May 2023 07:25:02 +0000</pubDate>
      <link>https://forem.com/aws-builders/platform-engineering-and-internal-developer-platform-3deb</link>
      <guid>https://forem.com/aws-builders/platform-engineering-and-internal-developer-platform-3deb</guid>
      <description>&lt;h2&gt;
  
  
  Platform engineering and IDP
&lt;/h2&gt;

&lt;p&gt;The concept of platform engineering is the step up evolution of setting up deployment automation using CICD tools and utilizing the Cloud provider integration for hosting the apps.&lt;br&gt;
IDP is its further evolution to reduce the dependency of DevOps engineers' interaction with Developers. Because these concepts help to set up a self service platform for developers to onboard their app when they are ready to deploy.&lt;/p&gt;

&lt;p&gt;These concepts are mainly driven by the pipeline automation done using Pipeline as a code and creating templates for reusable deployments.&lt;/p&gt;

&lt;p&gt;Approaching the platform engineering concept is a step by step process, so let me explain my view of this concept (this might be different from person to person).&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment automation using CICD
&lt;/h2&gt;

&lt;p&gt;Step 1: Usual cycle of application onboarding,&lt;/p&gt;

&lt;p&gt;It starts with usual deployment automation using CICD,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;when the dev teams complete developing a feature, there is a need for development teams to reach out to DevOps engineers to onboard their application for promoting the code for the release&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So before the feature development starts, devops engineers or leads works in parallel with development team to understand the build and app deployment process from dev teams&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DevOps engineer/lead will come up with a deployment strategy (including the integration with infra automation, test automation tools and monitoring tools) for the specific feature development, that was based on the nature of programming language used typically. In some cases, architecture decisions need to be considered, if the application is fit for container based deployment or non container based deployment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then using the tools automation knowledge of DevOps engineers pipeline will be created with various integration needed for CI and CD tools&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the pipeline is ready, it is recommended to test the build and deployment strategy with some sample application provided by the dev team, to confirm the strategy works good and it can be used to on-board when the actual application development is complete&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In case of multiple feature development teams, this process will be repeated for each teams&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So finally when the feature development is completed, the dev team approaches the DevOps engineer to on-board the application in the pipeline&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The process so far explained can be the typical example of how a feature development team utilizes the DevOps engineer team for application onboarding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Platform Engineering
&lt;/h2&gt;

&lt;p&gt;Step 2: Evolution from Individual deployment automation to Platform Engineering&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now we can notice there is a repeatable pattern of efforts involved here for feature teams and there is dependency for developers with devops engineers. Here is when the usual deployment automation gets evolved into platform engineering. As I mentioned earlier every deployment orchestration tool available now be it OSS or enterprise tools, supports creating the pipeline as code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So to simplify the application onboarding for development teams, DevOps engineers will be creating a pipeline as code and will make it as a template for each specific development team. The template can be re-used onboarding apps of the same programming language.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also another advantage of pipeline as code is, it can be source controlled in git so the pipeline will be versioned for various releases too.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So the process of strategising the deployment automation and templating the deployment will be a major responsibility here. The team responsible for implementing it is as platform engineering team and engineers are called platform engineers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This entire deployment automation and onboarding of apps will be documented and handover will be given to developers on how to use this template for further app onboarding. So this reduces the dependency of DevOps engineers for dev teams.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Internal Developer Portal
&lt;/h2&gt;

&lt;p&gt;Then let's quickly discuss what is IDP as well. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Internal Developer Portal (or Platform) - IDP in short is an extension of the platform engineering team. We have discussed how the deployment automation process was simplified using pipeline as code template, and version controlling it. &lt;/li&gt;
&lt;li&gt;So the IDP platform will be having an UI to wrap all the various existing pipeline templates of specific tech stacks in the portal. Thus it further simplifies the job for developers. &lt;/li&gt;
&lt;li&gt;Typical IDP platform should have customisation options to choose the tech stack and what is required in the pipeline. When the developers chooses the feature development repo, the internal pipeline template will be picked up for the specific tech stack and generate an automated pipeline to onboard the app. &lt;/li&gt;
&lt;li&gt;Also it will contain various dashboards which will show various release metrics for stakeholders to understand how the feature development is going. For typical IDP contain the pipeline health metric which will show how the deployments are performing and how is the health of specific services deployed in infrastructure.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;In this blog, I've explained the abstract understanding of platform engineering and IDP in this post. We have not deep dived into each topic. So If you want to know more about the specific topic please reach out to me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Follow me to share your thoughts,
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/saravanan-gnanaguru-1941a919/"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/saransid"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/@gsaravanantech"&gt;YouTube&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gsaravanan.dev"&gt;gsaravanan.dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/chefgs"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devops</category>
      <category>platformengineering</category>
      <category>idp</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Setup HarperDB on Equinix Bare Metal Server</title>
      <dc:creator>Saravanan Gnanaguru</dc:creator>
      <pubDate>Wed, 19 Apr 2023 15:03:43 +0000</pubDate>
      <link>https://forem.com/chefgs/setup-harperdb-on-equinix-bare-metal-server-43eo</link>
      <guid>https://forem.com/chefgs/setup-harperdb-on-equinix-bare-metal-server-43eo</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction to HarperDB&lt;/li&gt;
&lt;li&gt;Ways to Host HarperDB&lt;/li&gt;
&lt;li&gt;Introduction to Equinix Bare Metal&lt;/li&gt;
&lt;li&gt;Equinix Account Setup and Completing Prerequisites&lt;/li&gt;
&lt;li&gt;Create an On Demand Server in Equinix&lt;/li&gt;
&lt;li&gt;Login into the Server using SSH&lt;/li&gt;
&lt;li&gt;
Install and Run HarperDB on Equinix Server

&lt;ul&gt;
&lt;li&gt;Prerequisites&lt;/li&gt;
&lt;li&gt;HarperDB installation using npm&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Run HarperDB in Equinix

&lt;ul&gt;
&lt;li&gt;Alternate method to run HarperDB&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Access the HarperDB using Equinix IP&lt;/li&gt;

&lt;li&gt;

Start using HarperDB hosted in Equinix

&lt;ul&gt;
&lt;li&gt;Create Schema&lt;/li&gt;
&lt;li&gt;Create Table&lt;/li&gt;
&lt;li&gt;Insert a Record&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Conclusion&lt;/li&gt;

&lt;li&gt;Document References&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction to HarperDB
&lt;/h2&gt;

&lt;p&gt;HarperDB is a &lt;strong&gt;globally-distributed edge data platform&lt;/strong&gt; that is designed to handle massive amounts of data with &lt;em&gt;ultra low latency&lt;/em&gt;. Other edge database solutions are not write optimized and global replication is slow. Whereas HarperDB is read and write optimized, handling upwards of 20K writes per second per node, with 110 ms global replication. &lt;/p&gt;

&lt;p&gt;HarperDB’s clustering methodology relies on eventual consistency to be much more efficient than more traditional options, and you can’t lock out the database globally. Read more about HarperDB and the use case it is trying to solve in this &lt;a href="https://www.harperdb.io/post/industries-that-need-distributed-database" rel="noopener noreferrer"&gt;blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;HarperDB has the solutions listed below and if you’re an organization looking for database solutions in this area can utilize the HarperDB for your need,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Distributed Database&lt;/li&gt;
&lt;li&gt;Edge Computing / &lt;a href="https://www.harperdb.io/post/edge-caching-explained-why-you-should-be-using-it" rel="noopener noreferrer"&gt;Edge Caching&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Infrastructure Savings&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Ways to Host HarperDB
&lt;/h2&gt;

&lt;p&gt;There are multiple ways available to getting started with HarperDB, but the quickest way to get up and running with HarperDB is with HarperDB Cloud.&lt;/p&gt;

&lt;p&gt;It is also possible to Install HarperDB on Cloud Instances across public cloud providers like AWS, Azure, GCP and On premise Cloud providers like Equinix and Linode.&lt;/p&gt;

&lt;p&gt;In this blog, we will see how to set-up the HarperDB database in Equinix Cloud Bare Metal Server and create steps to create a DB schema, Table, and insert a record.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to Equinix Bare Metal
&lt;/h2&gt;

&lt;p&gt;Equinix is one of the leaders in providing on-demand bare metal as a service product offering. You can &lt;a href="https://deploy.equinix.com/get-started/" rel="noopener noreferrer"&gt;sign-up here&lt;/a&gt; to get started with Equinix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Equinix Account Setup and Completing Prerequisites
&lt;/h2&gt;

&lt;p&gt;In this section we will see the steps to get started with Equinix.&lt;/p&gt;

&lt;p&gt;Step 1: Sign-up for an account, &lt;br&gt;
Step 2: During the sign-up we need to add payment method for billing (apply “deploynow” code to get the trial credit of $250)&lt;br&gt;
Step 3: Create an organization and a project under the org&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjhdzpyij6roebgjwitu0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjhdzpyij6roebgjwitu0.png" alt="Equinix Org Project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 5: Click on the name of the Project to go to the project page&lt;br&gt;
Step 6: Click on Project Settings &amp;gt; SSH Keys&lt;/p&gt;

&lt;p&gt;Step 7: Create an ssh key in your workstation from which we will be using to logging into “Equinix Instance” using the SSH method. Follow the &lt;a href="https://www.ssh.com/academy/ssh/keygen#creating-an-ssh-key-pair-for-user-authentication" rel="noopener noreferrer"&gt;guide here&lt;/a&gt; if you’re new to creating the SSH key for your workstation&lt;br&gt;
Step 8: Copy the public key (generally file name will be id_rsa.pub) from the file ending with *.pub &lt;br&gt;
Step 9: Paste Public key value in SSH key page by adding new “Add new key”. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xug9qtp8q9nbelg86y1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xug9qtp8q9nbelg86y1.png" alt="new ssh key"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create an On Demand Server in Equinix
&lt;/h2&gt;

&lt;p&gt;In this section we will see the steps to deploy our on-demand server to install HarperDB.&lt;br&gt;
Step 1: Go to project &amp;gt; Bare metal servers &amp;gt; On demand&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz9gy5119u01gf8qqa1ph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz9gy5119u01gf8qqa1ph.png" alt="Step 1 select ondemand"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2: Go to the “Classic” tab, choose the metro region in which you want to host the HarperDB server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6fk6e92meoc2quiiam1r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6fk6e92meoc2quiiam1r.png" alt="Step 2 equinix create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 3: Choose operating system - for this HarperDB demo I’ve selected the OS “Ubuntu 20.04”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fugnzipscr4jjaq94yie0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fugnzipscr4jjaq94yie0.png" alt="Step 3 equinix create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 4: Expand “Optional settings” and go to “SSH keys” to select SSH key we have added earlier&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypz50rsnbbsp0pfrvdyr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypz50rsnbbsp0pfrvdyr.png" alt="Step 4 equinix create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 5: Verify the summary and click on “Deploy Now”&lt;br&gt;
Step 6: We can observe the server instance is getting deployed&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3h1q6wv6ejfx4ld4ekc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3h1q6wv6ejfx4ld4ekc.png" alt="Step 6 equinix create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 7: After some time the instance deployment will be complete, and we can see the instance is up and running&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwtm24e9xgx0vjo4gp0tm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwtm24e9xgx0vjo4gp0tm.png" alt="Step 7 equinix create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 8: Click the instance “hostname” to open the instance details &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxb8r9poqszqmrt2t1s0o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxb8r9poqszqmrt2t1s0o.png" alt="Step 8 equinix create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Login into the Server using SSH
&lt;/h2&gt;

&lt;p&gt;Using the public IPV4 address, we can get into the server using SSH method&lt;br&gt;
Use the private key pair of the public key we have added in the SSH key while creating the instance. It will be located in the path &lt;code&gt;~/.ssh&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

$ ssh -i ~/.ssh/equinix_key root@145.40.77.227
The authenticity of host '145.40.77.227 (145.40.77.227)' can't be established.
ED25519 key fingerprint is SHA256:A8G3NWfuX9wEvSbiTtReGwSqouiUirqvXbfBjB/StmM.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '145.40.77.227' (ED25519) to the list of known hosts.
Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 5.4.0-137-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Thu Apr  6 05:42:41 UTC 2023

  System load:  0.25               Processes:            261
  Usage of /:   0.5% of 438.04GB   Users logged in:      0
  Memory usage: 1%                 IP address for bond0: 145.40.77.227
  Swap usage:   0%

0 updates can be applied immediately.

Your Hardware Enablement Stack (HWE) is supported until April 2023.


The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

root@c3-small-x86-01:~#



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now we logged into the server and let us see the steps to install HarperDB in the Equinix Server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install and Run HarperDB on Equinix Server
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;I’ve followed the installation steps available &lt;a href="https://docs.harperdb.io/docs/install-harperdb" rel="noopener noreferrer"&gt;here&lt;/a&gt; and followed the Linux installation steps for installing &lt;code&gt;nvm&lt;/code&gt;, since we deployed Ubuntu OS in Equinix.&lt;/p&gt;

&lt;p&gt;Since it is just a demo installation, I’ve skipped the LVM configuration and Configure Data volume sections.&lt;br&gt;
Now, HarperDB needs npm and NodeJS.  So we need to install them using,&lt;br&gt;&lt;br&gt;
&lt;code&gt;nvm&lt;/code&gt; - Node version manager, which is the recommended way for installing NodeJS and npm&lt;/p&gt;

&lt;p&gt;I’ve used below commands to install &lt;code&gt;nvm&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] &amp;amp;&amp;amp; \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] &amp;amp;&amp;amp; \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After running the above commands, either you can exit and re-login to the Equinix server so the changes will go into effect.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

exit


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then install &lt;code&gt;nvm&lt;/code&gt; version 17, which worked fine for me.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

nvm install 17


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  HarperDB installation using npm
&lt;/h3&gt;

&lt;p&gt;I’ve used the offline installation method for installing HarperDB in Equinix.&lt;/p&gt;

&lt;p&gt;Step 1: &lt;a href="https://products-harperdb-io.s3.us-east-2.amazonaws.com/harperdb-4.0.5.tgz" rel="noopener noreferrer"&gt;Download installation package&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

wget https://products-harperdb-io.s3.us-east-2.amazonaws.com/harperdb-4.0.5.tgz


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Step 2: install using npm&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

sudo npm install -g harperdb-4.0.5.tgz harperdb install


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;There are some optional steps available in the documentation which can help HarperDB to start when the OS boots. &lt;/p&gt;

&lt;h2&gt;
  
  
  Run HarperDB in Equinix
&lt;/h2&gt;

&lt;p&gt;After the successful installation execute the command &lt;code&gt;harperdb run&lt;/code&gt; to start the database&lt;/p&gt;

&lt;p&gt;Follow the prompts to start the database&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;$ harperdb run&lt;br&gt;
This version of HarperDB is tested against Node.js version 18.13.0, the currently installed Node.js version is: 17.9.1. Some issues may occur with untested versions of Node.js.&lt;br&gt;
Starting HarperDB...&lt;br&gt;
HarperDB not found, starting install process.&lt;/p&gt;

&lt;p&gt;Starting HarperDB install...&lt;/p&gt;

&lt;p&gt;Terms &amp;amp; Conditions can be found at &lt;a href="https://harperdb.io/legal/end-user-license-agreement" rel="noopener noreferrer"&gt;https://harperdb.io/legal/end-user-license-agreement&lt;/a&gt;&lt;br&gt;
and can be viewed by typing or copying and pasting the URL into your web browser.&lt;br&gt;
I Agree to the HarperDB Terms and Conditions. (yes/no) yes&lt;br&gt;
Please enter a destination for HarperDB: /root/hdb&lt;br&gt;
Please enter a server listening port for HarperDB: 9925&lt;br&gt;
Please enter a username for the HDB_ADMIN: HDB_ADMIN&lt;br&gt;
Please enter a password for the HDB_ADMIN: [hidden]&lt;/p&gt;

&lt;p&gt;HarperDB installation was successful.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           ▒▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒                                
       ▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒                     
   ▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒                    
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▒&lt;br&gt;&lt;br&gt;
   ▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▒&lt;br&gt;&lt;br&gt;
    ▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▒▒&lt;br&gt;&lt;br&gt;
    ▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒&lt;br&gt;&lt;br&gt;
   ▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒&lt;br&gt;&lt;br&gt;
  ▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒&lt;br&gt;
 ▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒ &lt;br&gt;
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒&lt;br&gt;&lt;br&gt;
  ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒&lt;br&gt;&lt;br&gt;
     ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒&lt;br&gt;&lt;br&gt;
         ▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒&lt;br&gt;&lt;br&gt;
            ▒▒▒▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒&lt;br&gt;&lt;br&gt;
               ▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒&lt;br&gt;&lt;br&gt;
                   ▒▒▒▓▓▒▒▒▒▒▒▒▒▒▒▒&lt;br&gt;&lt;br&gt;
                      ▒▒▒▒▒▒▒                                  &lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                HarperDB, Inc. Denver, CO.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;|------------- HarperDB 4.0.5 successfully started ------------|&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Alternate method to run HarperDB&lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;There is also a single line command available to run HarperDB, which has all the database invocation arguments passed as CLI options&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;harperdb install --TC_AGREEMENT "yes" --ROOTPATH "/home/ubuntu/hdb" --OPERATIONSAPI_NETWORK_PORT "9925" --HDB_ADMIN_USERNAME "HDB_ADMIN" --HDB_ADMIN_PASSWORD "abc123!"&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Access the HarperDB using Equinix IP&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;HarperDB runs in the server, so it can be accessed via localhost:port &lt;code&gt;http://localhost:9925&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Also we can access the server from outside using the “equinix-public-ip:port” as &lt;code&gt;http://145.40.77.227:9925&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Start using HarperDB hosted in Equinix
&lt;/h2&gt;

&lt;p&gt;We will now see how to create a DB schema, create tables and insert records in it.&lt;/p&gt;

&lt;p&gt;Refer the “Quick Start Examples” in &lt;a href="https://api.harperdb.io/#c50e9963-888a-4ccd-99f6-4ae266dfdf60" rel="noopener noreferrer"&gt;API docs&lt;/a&gt; to explore the various programming methods for creating HarperDB elements like schema, tables, etc.&lt;/p&gt;

&lt;p&gt;I’ll be using the &lt;code&gt;curl&lt;/code&gt; method to play around with HarperDB&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Schema
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;root@c3-small-x86-01:~ curl --location --request POST -u HDB_ADMIN:admin123 '&lt;a href="http://localhost:9925" rel="noopener noreferrer"&gt;http://localhost:9925&lt;/a&gt;' --header 'Content-Type: application/json' --data-raw '{&lt;br&gt;
    "operation": "create_schema",&lt;br&gt;
    "schema": "dev"&lt;br&gt;
}'&lt;br&gt;
{"message":"schema 'dev' successfully created"}&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Create Table&lt;br&gt;
&lt;/h3&gt;
&lt;br&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;root@c3-small-x86-01:~ curl --location --request POST -u HDB_ADMIN:admin123 '&lt;a href="http://localhost:9925" rel="noopener noreferrer"&gt;http://localhost:9925&lt;/a&gt;' --header 'Content-Type: application/json' --data-raw '{&lt;br&gt;
    "operation": "create_table",&lt;br&gt;
    "schema": "dev",&lt;br&gt;
    "table": "dog",&lt;br&gt;
    "hash_attribute": "id"&lt;br&gt;
}'&lt;br&gt;
{"message":"table 'dev.dog' successfully created."}&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Insert a Record&lt;br&gt;
&lt;/h3&gt;
&lt;br&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;root@c3-small-x86-01:~ curl --location --request POST -u HDB_ADMIN:admin123 '&lt;a href="http://localhost:9925" rel="noopener noreferrer"&gt;http://localhost:9925&lt;/a&gt;' --header 'Content-Type: application/json' --data-raw '{&lt;br&gt;
    "operation": "insert",&lt;br&gt;
    "schema": "dev",&lt;br&gt;
    "table": "dog",&lt;br&gt;
    "records": [&lt;br&gt;
        {&lt;br&gt;
            "id": 1,&lt;br&gt;
            "dog_name": "Penny",&lt;br&gt;
            "owner_name": "Kyle",&lt;br&gt;
            "breed_id": 154,&lt;br&gt;
            "age": 7,&lt;br&gt;
            "weight_lbs": 38&lt;br&gt;
        }&lt;br&gt;
    ]&lt;br&gt;
}'&lt;br&gt;
{"message":"inserted 1 of 1 records","inserted_hashes":[1],"skipped_hashes":[]}&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Conclusion&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;In this article, we discussed the introduction to HarperDB data platform, and how it was easy to get started with the HarperDB setup in the Equinix Bare metal on-demand server. &lt;br&gt;
Also we have gone through how to access the database and tried out creating a DB schema, Table and Record.&lt;br&gt;
Hope this article should be useful for database professionals, developers and data architects looking for a tutorial of HarperDB installation on Equinix bare metal servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Document References
&lt;/h2&gt;

&lt;p&gt;HarperDB &lt;a href="https://docs.harperdb.io/docs/getting-started" rel="noopener noreferrer"&gt;Getting Started&lt;/a&gt;&lt;br&gt;
HarperDB &lt;a href="https://api.harperdb.io/#2dc540c1-d62b-4521-a078-4e8d60e3b391" rel="noopener noreferrer"&gt;API documentation&lt;/a&gt;&lt;br&gt;
Equinix &lt;a href="https://deploy.equinix.com/get-started/" rel="noopener noreferrer"&gt;Getting Started&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Follow my work and get in touch,&lt;br&gt;
This is Saravanan, I'm a DevOps Evangelist | Tech Blogger | Mentor | AWS Community Builder | Hashicorp Ambassador | Content Creator&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/chefgs" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/saravanan-gnanaguru-1941a919/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/saransid" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/@gsaravanantech" rel="noopener noreferrer"&gt;YouTube&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gsaravanan.dev" rel="noopener noreferrer"&gt;gsaravanan.dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>harperdb</category>
      <category>database</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
