<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bot-kids</title>
    <description>The latest articles on DEV Community by Bot-kids (@botkids).</description>
    <link>https://dev.to/botkids</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F239706%2F47d744f9-65f1-4915-806a-ce831bea0c1d.png</url>
      <title>DEV Community: Bot-kids</title>
      <link>https://dev.to/botkids</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/botkids"/>
    <language>en</language>
    <item>
      <title>How to Manage Context in Long ChatGPT Coding Sessions</title>
      <dc:creator>Bot-kids</dc:creator>
      <pubDate>Sat, 01 Aug 2026 14:49:15 +0000</pubDate>
      <link>https://dev.to/botkids/how-to-manage-context-in-long-chatgpt-coding-sessions-l6c</link>
      <guid>https://dev.to/botkids/how-to-manage-context-in-long-chatgpt-coding-sessions-l6c</guid>
      <description>&lt;p&gt;I found myself moving more coding work into ChatGPT after the price I paid for Codex increased and I ran into usage limits in my Codex workflow. A fresh Codex chat required me to restate project constraints, recover old evidence, and rebuild the debugging trail before I could return to the actual problem.&lt;/p&gt;

&lt;p&gt;Long coding work becomes hard to steer when old decisions, current failures, and reusable instructions sit in the same conversation. I use four buckets to keep each new request grounded in the facts that control it.&lt;/p&gt;

&lt;p&gt;The buckets keep the project context, the task in front of me, reusable prompts, and saved outcomes visible instead of leaving them buried among debugging attempts, pasted errors, and abandoned approaches.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep project context separate from the current task.&lt;/li&gt;
&lt;li&gt;Save recurring instructions as templates with named variables and a clear output contract.&lt;/li&gt;
&lt;li&gt;Treat visual decluttering as an interface aid. It leaves the model's context unchanged.&lt;/li&gt;
&lt;li&gt;Export decisions, commands, and final code when they become useful outside the chat.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Projects keep the history. The working state guides the next task
&lt;/h2&gt;

&lt;p&gt;I keep a long chat when the current work still depends on earlier decisions. The conversation may contain the reason a storage key cannot change, the failed approach that ruled out a shortcut, or the error output that the next debugging step needs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://help.openai.com/en/articles/10169521-projects-in-chatgpt" rel="noopener noreferrer"&gt;ChatGPT Projects&lt;/a&gt; keep related chats, files, and instructions together, while &lt;a href="https://help.openai.com/en/articles/8590148-memory-faq" rel="noopener noreferrer"&gt;ChatGPT memory&lt;/a&gt; can carry useful context across chats. I still choose the objective, constraints, and next action that the model should treat as the working state. The four buckets give me a compact record that I can review before I continue.&lt;/p&gt;

&lt;p&gt;Usage limits add a practical reason to avoid unnecessary resets. Some tools and managed workspaces apply usage or spend controls to eligible coding activity. In Codex, these controls depend on the plan and workspace, while rebuilding context always requires more exchanges and more capacity.&lt;/p&gt;

&lt;p&gt;Start a new chat when the objective changes, the old history conflicts with the new task, or a reviewed handoff gives the next session a smaller and clearer working set. Stay in the current chat when the decision trail still saves more work than it costs to carry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a long ChatGPT chat still becomes hard to use
&lt;/h2&gt;

&lt;p&gt;A long coding chat mixes material that changes at different rates: architecture constraints may remain valid for months, a failing test may matter for an hour, and a pull request review template may return every week. When those materials occupy the same conversational stream, both you and the model must infer which detail controls the current task.&lt;/p&gt;

&lt;p&gt;Keep the history that contains evidence, then move the facts you will reuse into distinct buckets. A reviewed note should carry the decision that rules out a shortcut, while the transcript remains available when you need to revisit the evidence behind it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep four buckets separate
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Bucket&lt;/th&gt;
&lt;th&gt;Contains&lt;/th&gt;
&lt;th&gt;Update when&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Project context&lt;/td&gt;
&lt;td&gt;Architecture, constraints, conventions, key files, definitions&lt;/td&gt;
&lt;td&gt;The project changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Current task&lt;/td&gt;
&lt;td&gt;Goal, inputs, failing behavior, acceptance criteria&lt;/td&gt;
&lt;td&gt;You start a new task&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reusable prompts&lt;/td&gt;
&lt;td&gt;Stable instruction, variables, examples, output format&lt;/td&gt;
&lt;td&gt;You improve the workflow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saved outcomes&lt;/td&gt;
&lt;td&gt;Decision, command, code, reviewed summary, next action&lt;/td&gt;
&lt;td&gt;The session produces work worth keeping&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Project context stays stable while the current task changes, so a useful prompt needs both in an ordered structure. Raw facts, examples, and old requests do not become useful context merely because you paste them together.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Keep project context in one document
&lt;/h2&gt;

&lt;p&gt;Project context should contain the facts a new task needs before the model can propose a safe change, while remaining short enough to review and specific enough to constrain the answer.&lt;/p&gt;

&lt;p&gt;Start with a document like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Stable context&lt;/span&gt;

&lt;span class="gu"&gt;## Product&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Web application for teams that manage customer accounts.

&lt;span class="gu"&gt;## Architecture&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; React frontend and Node.js API.
&lt;span class="p"&gt;-&lt;/span&gt; PostgreSQL stores account and subscription data.
&lt;span class="p"&gt;-&lt;/span&gt; Account rules live in &lt;span class="sb"&gt;`src/services/account-service.ts`&lt;/span&gt;.

&lt;span class="gu"&gt;## Constraints&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Keep account changes auditable.
&lt;span class="p"&gt;-&lt;/span&gt; Require confirmation before cancelling a subscription.
&lt;span class="p"&gt;-&lt;/span&gt; Avoid returning billing data to users who do not own the account.

&lt;span class="gu"&gt;## Compatibility rules&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Preserve &lt;span class="sb"&gt;`account_status`&lt;/span&gt; and &lt;span class="sb"&gt;`billing_customer_id`&lt;/span&gt; during migrations.
&lt;span class="p"&gt;-&lt;/span&gt; Keep existing API response fields for current clients.

&lt;span class="gu"&gt;## Working conventions&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Inspect the repository before proposing code changes.
&lt;span class="p"&gt;-&lt;/span&gt; Separate verified facts from open questions.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep the complete project history elsewhere and reserve this document for rules that prevent an otherwise sensible answer from breaking the product. A task such as "fix stale data after an account update" will expire, while a rule such as "preserve existing API response fields" should remain available for future tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Write a current task document
&lt;/h2&gt;

&lt;p&gt;The current task document gives ChatGPT the changing facts by stating the goal, the evidence, the files to inspect, and the definition of done.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Current task&lt;/span&gt;

&lt;span class="gu"&gt;## Goal&lt;/span&gt;
Prevent the account page from showing stale data after an account update.

&lt;span class="gu"&gt;## Evidence&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; The API returns the updated account record.
&lt;span class="p"&gt;-&lt;/span&gt; The page keeps the value from an earlier cache entry.

&lt;span class="gu"&gt;## Files to inspect&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`src/services/account-cache.ts`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Account page tests and API client tests

&lt;span class="gu"&gt;## Acceptance criteria&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; The page displays the record returned after the update.
&lt;span class="p"&gt;-&lt;/span&gt; Existing account pages keep their current behavior.
&lt;span class="p"&gt;-&lt;/span&gt; Tests cover a stale cache entry and a successful refresh.

&lt;span class="gu"&gt;## Open questions&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Which cache key identifies an account across account changes?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The document tells the model where to look and how you will judge the result, while giving you a compact record of the problem when you return after a break.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Watch out:&lt;/strong&gt; A long project context and a long task document can repeat the same fact. Keep the durable rule in project context and leave task-specific evidence in the task document.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 3: Save reusable prompts
&lt;/h2&gt;

&lt;p&gt;A prompt deserves a saved template when you expect to reuse its reasoning pattern, structure, or output format. "Explain this error" does not need a library entry. "Review this account data change for compatibility and regression risks" probably does.&lt;/p&gt;

&lt;p&gt;Store each reusable prompt with a name, a purpose, variables, and an output contract so that you can tell whether two saved prompts solve the same problem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Prompt: Review a risky account data change&lt;/span&gt;

&lt;span class="gu"&gt;## Purpose&lt;/span&gt;
Review a proposed change before implementation.

&lt;span class="gu"&gt;## Inputs&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`{change_description}`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`{relevant_files}`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`{known_constraints}`&lt;/span&gt;

&lt;span class="gu"&gt;## Instructions&lt;/span&gt;
Identify implementation risks, compatibility risks, privacy risks, and tests.
Flag assumptions that need repository inspection.

&lt;span class="gu"&gt;## Output format&lt;/span&gt;
&lt;span class="p"&gt;1.&lt;/span&gt; Summary of the change
&lt;span class="p"&gt;2.&lt;/span&gt; Risks, ranked by impact
&lt;span class="p"&gt;3.&lt;/span&gt; Files to inspect
&lt;span class="p"&gt;4.&lt;/span&gt; Tests to add or run
&lt;span class="p"&gt;5.&lt;/span&gt; Open questions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Templates work best when the fixed parts stay fixed and the changing facts arrive through variables. You can then improve the instruction without rewriting the surrounding task document each time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Reduce visual noise without confusing it with context management
&lt;/h2&gt;

&lt;p&gt;Long chats create two separate problems: the model receives a long history, while you must visually scan that history. An interface can address only the second problem, so use a visual mode to hide or collapse material you do not need to read right now. It changes the page you scan, not the conversation context ChatGPT receives or the speed at which the model generates.&lt;/p&gt;

&lt;p&gt;That boundary keeps the workflow honest because visual decluttering helps you find the current request, the answer you need, and the next action, while context selection still requires you to decide which project and task facts belong in the prompt.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw66479u2hz50x0gnvjzx.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw66479u2hz50x0gnvjzx.PNG" alt="Diagram showing project context, the current task, and reusable prompts feeding a ChatGPT conversation, then a saved outcome." width="800" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The diagram shows the working set. Keep the relevant inputs explicit even when you hide older conversation turns from view.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Save useful outcomes from the session
&lt;/h2&gt;

&lt;p&gt;Raw transcripts preserve history, while saved outcomes preserve the decisions you need to act on. Export a transcript when you need an audit trail or source material for a later summary, then save a shorter outcome when you need the command that fixed the issue, a decision and its rationale, a code block, an unresolved risk, or the next task.&lt;/p&gt;

&lt;p&gt;Use this end-of-session prompt when the conversation produces work you may need again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Summarize this coding session for a developer who will continue the work later.

Use these headings:
- Objective
- Decisions and rationale
- Files and functions involved
- Commands or code worth preserving
- Work completed
- Open risks and questions
- Next action

Keep concrete names. Mark uncertain claims as questions.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Review the result before you save it, because a summary can compress a long history while omitting details that the original chat never stated clearly. That review turns the summary into a working note instead of a plausible reconstruction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use the workflow manually before you add a tool
&lt;/h2&gt;

&lt;p&gt;You can use this system in any ChatGPT session. Start with a Project when its shared chats, files, and instructions fit the work, then add your short project context and current task as documents you can review.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Keep a short project context document.&lt;/li&gt;
&lt;li&gt;Start each coding task with a current task document.&lt;/li&gt;
&lt;li&gt;Save prompts that describe work you repeat.&lt;/li&gt;
&lt;li&gt;Capture a developer note when a session produces a decision or a fix.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Start with one short project context and one reusable prompt. You can add to the system only when you find yourself repeating the same type of work.&lt;/p&gt;

&lt;h2&gt;
  
  
  The small tool I built for this workflow
&lt;/h2&gt;

&lt;p&gt;After using the workflow in long chats, I built Power Booster for ChatGPT to keep the material I need beside the conversation. Its Side Panel keeps Project Context, Prompt Favorites, and TXT exports within reach. Pro adds custom-variable Dynamic Templates, Dev Handoff, Markdown exports, and JSON exports. In version 0.4, you still manage the current task and outcome notes yourself.&lt;/p&gt;

&lt;p&gt;The extension does not choose the working state or replace engineering judgment. You still need to inspect code, test changes, and decide whether a generated answer fits the product constraints. If you want to try it, &lt;a href="https://chromewebstore.google.com/detail/power-booster-for-chatgpt/mbbaalocbmnmhjfefniaamdiejfdmhmo" rel="noopener noreferrer"&gt;Power Booster for ChatGPT is available here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits worth keeping in view
&lt;/h2&gt;

&lt;p&gt;Project context helps only when it stays relevant, because a stale constraint can steer the model as badly as a missing constraint. Review it when the architecture, storage schema, product policy, or release goal changes. Revisit reusable prompts when the project gains a migration layer, a licensing flow, or a more complex test suite.&lt;/p&gt;

&lt;p&gt;Any ChatGPT automation should preserve user control. Structured outputs and review steps improve predictability and reliability, but neither makes a model's answer correct by default.&lt;/p&gt;

&lt;p&gt;I haven’t found a clean rule for when to leave a long chat. Do you wait until it becomes hard to steer, or do you start a new one as soon as the task changes?&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do ChatGPT Projects replace these documents?
&lt;/h3&gt;

&lt;p&gt;Projects keep related chats, files, and instructions together. I use the project context, current task, and saved outcome documents to select the details that should guide the next coding decision.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I put my whole repository into project context?
&lt;/h3&gt;

&lt;p&gt;Add the facts that constrain the current class of work, including architecture, key interfaces, conventions, and compatibility rules, then point ChatGPT toward files that need inspection instead of pasting an entire repository into every prompt.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does hiding messages improve ChatGPT’s answer quality?
&lt;/h3&gt;

&lt;p&gt;Hiding messages changes the interface you read, while the quality of the response still depends on the instructions and context sent to the model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which prompts should I save?
&lt;/h3&gt;

&lt;p&gt;Save prompts that you repeat with a stable reasoning pattern or output shape, then keep individual questions in the conversation and give saved prompts a purpose, named variables, and a defined output format.&lt;/p&gt;

&lt;h3&gt;
  
  
  Are exports the same as summaries?
&lt;/h3&gt;

&lt;p&gt;An export preserves material from the conversation, while a summary interprets that material and may omit details. Use the export for source material and save a reviewed summary as developer notes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the working set small and explicit
&lt;/h2&gt;

&lt;p&gt;Use a Project to keep related material together, then keep the project context stable and the current task short. Add reusable prompts and saved outcomes only when the work gives you something worth carrying forward. The workflow works with plain text documents, while a Side Panel removes some of the repetition once the habit has proved useful.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>chatgpt</category>
    </item>
    <item>
      <title>🚀 How to Deploy PostgreSQL in Kubernetes (Like a Pro, but for Kids!)</title>
      <dc:creator>Bot-kids</dc:creator>
      <pubDate>Sat, 01 Feb 2025 19:31:51 +0000</pubDate>
      <link>https://dev.to/botkids/how-to-deploy-postgresql-in-kubernetes-like-a-pro-but-for-kids-1fb7</link>
      <guid>https://dev.to/botkids/how-to-deploy-postgresql-in-kubernetes-like-a-pro-but-for-kids-1fb7</guid>
      <description>&lt;p&gt;👋 Hey there, young coder! Today, we’re going to deploy PostgreSQL inside Kubernetes just like building a LEGO tower! 🏗️ But wait—this isn’t just any setup. We’re making it super strong with magical treasure chests (persistent storage), secret vaults (security), enchanted scrolls (configurations)! 🚀&lt;/p&gt;

&lt;p&gt;I remember the first time I tried to deploy PostgreSQL in Kubernetes… It was a total disaster! 😅 My database disappeared twice before I realized I forgot to set up the treasure chest. But don’t worry, you won’t make the same mistakes—because we’re doing this the right way from the start! 🎉&lt;/p&gt;

&lt;h2&gt;
  
  
  1. We Need a Safe Storage Box! (Persistent Volume Claim) 🔒
&lt;/h2&gt;

&lt;p&gt;Kubernetes likes to clean up things when it restarts. But we don’t want PostgreSQL to be one of those things! That’s why we need a magical treasure chest that keeps everything safe! 🎁&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📜 Create a file called&lt;/strong&gt; &lt;code&gt;postgres-pvc.yaml&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;apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: postgres-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔑 What’s Happening Here?
&lt;/h3&gt;

&lt;p&gt;🏷️ &lt;strong&gt;PersistentVolumeClaim (PVC)&lt;/strong&gt; – Think of this as a treasure chest where PostgreSQL stores all its magical data.&lt;br&gt;
🔄 &lt;strong&gt;ReadWriteOnce&lt;/strong&gt; – Only one wizard (pod) can write to this chest at a time (but many can read!).&lt;br&gt;
📦 &lt;strong&gt;10Gi of Storage&lt;/strong&gt; – That’s 10GB of space to keep all your precious treasures safe.&lt;/p&gt;

&lt;p&gt;Apply the magic spell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f postgres-pvc.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Now, PostgreSQL has a special treasure chest for its data! 🏴‍☠️&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Building a Magical Shield (Network Policy) 🛡️
&lt;/h2&gt;

&lt;p&gt;We don’t want bad wizards (hackers) sneaking into our treasure chest! Let’s create a magical shield to protect it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📜 Create a file called&lt;/strong&gt; &lt;code&gt;postgres-network-policy.yaml&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;apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: postgres-network-policy
spec:
  podSelector:
    matchLabels:
      app: postgres
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          app: my-app
    ports:
    - protocol: TCP
      port: 5432
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔑 What’s Happening Here?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;🚪 NetworkPolicy&lt;/strong&gt; – This is our magical shield that keeps out bad wizards! 🛡️&lt;br&gt;
&lt;strong&gt;🔍 PodSelector&lt;/strong&gt; – Only friendly creatures (like your app) can talk to PostgreSQL.&lt;br&gt;
&lt;strong&gt;🔒 Port 5432&lt;/strong&gt; – Think of this as the door PostgreSQL listens through. Only trusted friends get the key!&lt;/p&gt;

&lt;p&gt;Apply the shield:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f postgres-network-policy.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ PostgreSQL is &lt;strong&gt;now protected like a fortress! 🏰&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Setting Up the Magic Scroll (ConfigMap) 📜
&lt;/h2&gt;

&lt;p&gt;We need a scroll to tell PostgreSQL its secrets—like which spells (settings) to use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📜 Create a file called&lt;/strong&gt; &lt;code&gt;postgres-configmap.yaml&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;apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-config
data:
  POSTGRES_DB: "mydatabase"
  POSTGRES_USER: "admin"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔑 What’s Happening Here?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;📜 ConfigMap&lt;/strong&gt; – Think of this as a magical scroll that holds PostgreSQL’s important instructions.&lt;br&gt;
&lt;strong&gt;🗂️ POSTGRES_DB &amp;amp; POSTGRES_USER&lt;/strong&gt; – These are PostgreSQL’s magic words—like its username and the name of the database.&lt;br&gt;
Apply the spell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f postgres-configmap.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ PostgreSQL now knows which magic spells to use! ✨&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Locking Secrets in a Vault (Secret) 🔐
&lt;/h2&gt;

&lt;p&gt;We don’t want anyone to see our super-secret passwords. Let’s lock them in a vault!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📜 Create a file called&lt;/strong&gt; &lt;code&gt;postgres-secret.yaml&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;apiVersion: v1
kind: Secret
metadata:
  name: postgres-secret
type: Opaque
data:
  POSTGRES_PASSWORD: c3VwZXJzZWN1cmVwYXNzd29yZA==  # This is "supersecurepassword" encoded in Base64
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔑 What’s Happening Here?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;🔐 Secret&lt;/strong&gt; – This is like hiding your password in a vault with a magic lock.&lt;br&gt;
&lt;strong&gt;🔑 POSTGRES_PASSWORD&lt;/strong&gt; – The password is encoded (disguised) so no sneaky goblins can read it easily.&lt;br&gt;
Lock the vault:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f postgres-secret.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Our password is now safe and sound! 🔒&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Building the Magic Tower (StatefulSet) 🏰
&lt;/h2&gt;

&lt;p&gt;PostgreSQL needs a magical tower to live in. That’s where the StatefulSet comes in!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📜 Create a file called&lt;/strong&gt; &lt;code&gt;postgres-statefulset.yaml&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;apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
spec:
  serviceName: "postgres"
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
      - name: postgres
        image: postgres:15
        ports:
        - containerPort: 5432
        envFrom:
        - configMapRef:
            name: postgres-config
        - secretRef:
            name: postgres-secret
        volumeMounts:
        - name: postgres-storage
          mountPath: /var/lib/postgresql/data
  volumeClaimTemplates:
  - metadata:
      name: postgres-storage
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 10Gi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔑 What’s Happening Here?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;🏰 StatefulSet&lt;/strong&gt; – This is like building a magical tower that remembers PostgreSQL’s secrets even if it falls down.&lt;br&gt;
&lt;strong&gt;🗂️ ConfigMap &amp;amp; Secret&lt;/strong&gt; – PostgreSQL reads the magic scrolls and vaults to get its settings.&lt;br&gt;
&lt;strong&gt;💾 VolumeClaimTemplates&lt;/strong&gt; – This is PostgreSQL’s storage room where it keeps all its important scrolls.&lt;br&gt;
Build the tower:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f postgres-statefulset.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ PostgreSQL’s magical tower is now standing tall! 🏰&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Giving PostgreSQL a Door (Service) 🚪
&lt;/h2&gt;

&lt;p&gt;How will our apps talk to PostgreSQL? They need a doorway!&lt;/p&gt;

&lt;p&gt;📜 Create a file called postgres-service.yaml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: postgres
spec:
  selector:
    app: postgres
  ports:
    - protocol: TCP
      port: 5432
      targetPort: 5432
  type: ClusterIP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔑 What’s Happening Here?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;🚪 Service&lt;/strong&gt; – This is like adding a door to PostgreSQL’s tower so other apps can visit.&lt;br&gt;
&lt;strong&gt;🗝️ Port 5432&lt;/strong&gt; – This is the magic keyhole where apps can knock to get PostgreSQL’s attention.&lt;br&gt;
Open the door:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f postgres-service.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ PostgreSQL is ready to welcome visitors (apps)! 🚪&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>postgressql</category>
      <category>database</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Diving into JavaScript: Real-World Projects for Beginners</title>
      <dc:creator>Bot-kids</dc:creator>
      <pubDate>Sun, 18 Jun 2023 15:18:44 +0000</pubDate>
      <link>https://dev.to/botkids/diving-into-javascript-real-world-projects-for-beginners-1go6</link>
      <guid>https://dev.to/botkids/diving-into-javascript-real-world-projects-for-beginners-1go6</guid>
      <description>&lt;p&gt;Hello, Dev.to community!&lt;/p&gt;

&lt;p&gt;I hope this post finds you well. Today, I want to discuss a topic that's close to my heart: learning JavaScript as a beginner. We all know that the best way to learn is by doing, not just reading theory or tinkering with small, isolated tasks. But what if we could take this a step further?&lt;/p&gt;

&lt;p&gt;Instead of the standard beginner projects we often see, like the ubiquitous to-do list app or weather app, I want to explore real-world, practical examples that beginners could start building in JavaScript. Projects that not only teach the basics but also provide a glimpse into the vast potential of what one can create with this versatile language.&lt;/p&gt;

&lt;p&gt;Here are a few ideas:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Budget Tracker&lt;/strong&gt;: A tool that allows users to input their income and expenses, categorize them, and visualize their spending habits over time. This project could introduce beginners to concepts like DOM manipulation, event handling, and data visualization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recipe Finder&lt;/strong&gt;: An application where users can input ingredients they have on hand, and the app will suggest recipes based on these ingredients. This could be a great way to learn about APIs, asynchronous programming, and user input handling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;: A quiz app where users can take quizzes on various topics and get scored at the end. This project can help beginners understand how to work with forms, handle user input, and manage application state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;E-commerce Storefront&lt;/strong&gt;: A simplified version of an online shop, where users can browse products, add them to a cart, and simulate a checkout process. This project can introduce beginners to concepts like managing complex state, working with forms, and handling user interactions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Personal Portfolio&lt;/strong&gt;: A website where beginners can showcase their projects, skills, and professional experience. This project can help beginners learn about HTML/CSS integration, DOM manipulation, and responsive design.&lt;/p&gt;

&lt;p&gt;But I'm just one person, and I'd love to hear from all of you. What were your first projects when you started learning JavaScript? How did you learn, and what did you do right or wrong? What was useful, and what wasn't?&lt;/p&gt;

&lt;p&gt;My main goal with this discussion is to create a comprehensive course that guides beginners through building a meaningful, real-world project in JavaScript. I believe that by sharing our experiences and insights, we can help shape a learning journey that is not only educational but also exciting and fulfilling.&lt;/p&gt;

&lt;p&gt;Looking forward to your responses!&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>🌟Top JavaScript Animation Libraries: A Complete Guide for Young Coders🌟</title>
      <dc:creator>Bot-kids</dc:creator>
      <pubDate>Sun, 28 May 2023 16:08:56 +0000</pubDate>
      <link>https://dev.to/botkids/top-javascript-animation-libraries-a-complete-guide-for-young-coders-257h</link>
      <guid>https://dev.to/botkids/top-javascript-animation-libraries-a-complete-guide-for-young-coders-257h</guid>
      <description>&lt;p&gt;Hello there, young tech wizards! Today, we're going on a magical coding journey through the enchanted forest of JavaScript, filled with the most charming animation libraries. Let's dive in!&lt;/p&gt;

&lt;p&gt;🦄 &lt;a href="https://greensock.com/"&gt;GSAP&lt;/a&gt; (GreenSock Animation Platform): Imagine you have a magic wand that can animate anything - that's GSAP for you! This library gives you the power to make things move, spin, change colors, and lots more, all with a snap of your fingers (or, in this case, a stroke of your keys).&lt;/p&gt;

&lt;p&gt;🚀 &lt;a href="https://threejs-journey.com/"&gt;Three.js&lt;/a&gt;: Want to build a 3D world of your own? With Three.js, you can! It's like a magical toolbox, providing everything you need to create amazing 3D graphics. Whether it's a bustling city or an alien planet, Three.js brings your dreams to life.&lt;/p&gt;

&lt;p&gt;🌈 &lt;a href="https://animejs.com/"&gt;Anime.js&lt;/a&gt;: Anime.js is like a rainbow in the sky - it brings color and joy to your creations! It's light, fast, and perfect for adding smooth, fluid animations. You can make your characters dance, the sun rise, and the flowers bloom with Anime.js!&lt;/p&gt;

&lt;p&gt;🦋&lt;a href="http://velocityjs.org/"&gt;Velocity.js&lt;/a&gt;: Speedy as a cheetah, smooth as a butterfly – that's Velocity.js for you. This library is all about making your animations swift and seamless. So, whether you're racing cars or flying birds, Velocity.js helps them glide smoothly on the screen.&lt;/p&gt;

&lt;p&gt;🍃 &lt;a href="https://brm.io/matter-js/"&gt;Matter.js&lt;/a&gt;: Ever dreamt of being a scientist? Matter.js is your lab coat! This physics engine lets you simulate real-world behavior. With Matter.js, your animations can bounce, swing, slide and behave just like in the real world.&lt;/p&gt;

&lt;p&gt;🌠 &lt;a href="https://popmotion.io/"&gt;Popmotion&lt;/a&gt;: Popmotion is like a magical paintbrush. It gives you simple tools to create complex animations. With Popmotion, your creations can bounce like a ball, glide like an eagle, or flicker like a star – it's all about your imagination!&lt;/p&gt;

&lt;p&gt;🐼 &lt;a href="https://mojs.github.io/"&gt;Mo.js&lt;/a&gt;: As adorable as a baby panda, Mo.js is all about making your animations fun and cute. Its easy-to-use tools let you create delightful animations that will surely bring a smile to anyone's face.&lt;/p&gt;

&lt;p&gt;🎨 &lt;a href="http://paperjs.org/"&gt;Paper.js&lt;/a&gt;: Dreaming of being an artist? Paper.js turns your code into a masterpiece! It's a library for vector graphics, which means you can draw, paint, and animate beautiful pictures and designs.&lt;/p&gt;

&lt;p&gt;💫 &lt;a href="https://scrollmagic.io/"&gt;ScrollMagic.js&lt;/a&gt;: With ScrollMagic.js, your scrolls become magical! As you scroll down your website, this library lets you animate parts of it, making it look like magic spells are being cast with every scroll!&lt;/p&gt;

&lt;p&gt;🎠 &lt;a href="https://pixijs.com/"&gt;PixiJS&lt;/a&gt;: Bring the fun of a carnival to your animations with PixiJS! This library is fast and flexible, helping you create entertaining animations that are as exciting as a rollercoaster ride.&lt;/p&gt;

&lt;p&gt;🚀 &lt;a href="https://barba.js.org/"&gt;Barba.js&lt;/a&gt;: Ever dreamt of teleporting between places like in a sci-fi movie? Barba.js makes that possible in your website! This tiny yet powerful library helps you create seamless transitions between your web pages, making it feel like you're in a Single Page Application (SPA) universe. Imagine your website like a magical book - instead of flipping through pages, with Barba.js, you can seamlessly teleport from one chapter to the next! By reducing delays and minimizing requests, Barba.js makes your web journey as smooth and fast as a spaceship ride. Hop on and experience the magic of seamless navigation! 🚀💫&lt;/p&gt;

&lt;p&gt;🌬️ &lt;a href="https://dixonandmoe.com/rellax/"&gt;Rellax.js&lt;/a&gt;: Imagine you're floating on a magic carpet, gliding at different speeds. That's what Rellax.js does to your web animations! It’s a buttery smooth, super lightweight library that adds a parallax effect to your website. You can adjust the speed of your magical carpet ride, from extra slow and smooth (-10) to super fast (10). It's not just vertical scrolling that Rellax.js can handle, but horizontal scrolling too, perfect for panoramic views. With its ability to center parallax elements, adjust z-index, and even customize wrappers, Rellax.js offers the magic of versatile scrolling. Now, with Rellax.js, you can fly at your own speed! 🧞🌬️🌴&lt;/p&gt;

&lt;p&gt;🌌 &lt;a href="https://github.com/VincentGarreau/particles.js/"&gt;Particles.js&lt;/a&gt;: Get ready to launch your web animations into space with Particles.js! It's like having a magical wand that sprinkles stardust across your website. This lightweight library helps you create particles, just like the stars in the sky. With Particles.js, you can make your website sparkle and twinkle, as if it's a clear night sky full of stars. Remember, a sprinkle of stardust can make your animations look out of this world! So get your spacesuits on, and let's sprinkle some magic on your website with Particles.js. 🌟💫🌌&lt;/p&gt;

&lt;p&gt;🎹 &lt;a href="https://mattboldt.com/demos/typed-js/"&gt;Typed.js&lt;/a&gt;: Imagine if your keyboard could come alive and start typing on its own! That's what Typed.js does to your text on the web. It's like having a ghostwriter that types out any string you want, at the speed you set. It can even erase what it's written and start a new sentence - as if it's thinking on its own! You can set it to write as many sentences as you want. It's like having a friendly ghost telling your story on the web. With Typed.js, you're not just coding, you're bringing a keyboard to life! 🎹👻📝&lt;/p&gt;

&lt;p&gt;🎨 &lt;a href="https://p5js.org/"&gt;p5.js&lt;/a&gt;: Imagine you're an artist, and the web is your canvas. You can sketch, paint, and create a masterpiece with your coding skills. This is what p5.js brings to your coding adventure. It’s a library designed for creative coding, making it fun and accessible for artists, designers, educators, beginners, and everyone who wants to paint with code. p5.js is like your magic paintbrush, providing a full set of drawing functionalities. But the magic doesn't stop at the canvas, you can think of your whole browser page as your sketch! You can also add magical elements like text, video, webcam input, and even sound. With p5.js, you're not just coding, you're creating a digital masterpiece! 🖌️🖼️🎭&lt;/p&gt;

&lt;p&gt;🍫 &lt;a href="http://chocolat.insipi.de/"&gt;Chocolat.js&lt;/a&gt;: Let's add a sweet touch to our magical coding journey with Chocolat.js. It's like a magical photo album that lets you display one or many images without changing the page. You can group a series of pictures together as a link or show them as thumbnails - the choice is yours! And the best part? The viewer can be full-page or fit within a block, just like choosing between a full chocolate bar or a piece of it! With Chocolat.js, you can make your web page as deliciously attractive as a box of chocolates. 🍫📸🖼️&lt;/p&gt;

&lt;p&gt;And there you go, young coders! These are the top magical tools for you to create incredible animations with JavaScript. Remember, learning to code is like going on an adventure - it's all about exploring, experimenting, and most importantly, having fun. So grab your coding wands and let's make magic happen! 🌟👩‍💻👨‍💻🌟&lt;/p&gt;

&lt;p&gt;Let me know if you need a guide on these libraries, I'll be glad to help &lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>animation</category>
      <category>frontend</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Redis Server: Deploying on Kubernetes for Kids</title>
      <dc:creator>Bot-kids</dc:creator>
      <pubDate>Mon, 01 May 2023 14:42:47 +0000</pubDate>
      <link>https://dev.to/botkids/ho-to-deploy-redis-stack-server-statefulset-in-kubernetes-4j8g</link>
      <guid>https://dev.to/botkids/ho-to-deploy-redis-stack-server-statefulset-in-kubernetes-4j8g</guid>
      <description>&lt;p&gt;Hi there! BotKids here.&lt;br&gt;
Today, I'll explain how to deploy a &lt;strong&gt;Redis Stack Server&lt;/strong&gt; on &lt;strong&gt;Kubernetes&lt;/strong&gt; while keeping it kids-friendly 😊.&lt;/p&gt;

&lt;p&gt;Before starting, please make sure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A working Kubernetes Cluster&lt;/li&gt;
&lt;li&gt;kubectl installed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A Redis Stack Server is like a Redis with superpowers! These superpowers come from extra features called "modules." Our Redis Stack Server has five amazing modules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RedisTimeSeries&lt;/strong&gt;: A cool way to remember things that happened in the past, like a time machine!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RedisBloom&lt;/strong&gt;: A super-fast way to find and count things without having to remember everything. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RediSearch&lt;/strong&gt;: A search engine for Redis, like a detective that helps you find stuff quickly. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RedisJSON&lt;/strong&gt;: A way to store and play with JSON data, like having a toy box for JSON. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RedisGraph&lt;/strong&gt;: A way to explore connections between things, like a map of your friendships.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before we start deploying our Redis Stack Server, let's first prepare our Kubernetes playground.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create the Redis namespace&lt;/strong&gt;&lt;br&gt;
A namespace is like a big room where we keep our Redis Stack Server and its friends. We want to create a room called "redis". To create the Redis namespace, run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create namespace redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have a big room called "Redis" for our Redis Stack Server!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Check and create the "standard" storage class&lt;/strong&gt;&lt;br&gt;
A storage class is like a recipe that tells Kubernetes how to make a special kind of storage for our data. We need a recipe called "standard". First, let's check if we already have this recipe.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get storageclass standard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see the "standard" storage class in the results, great! We already have the recipe. If not, don't worry. We can create it ourselves. Save the following YAML code as a file named "standard-storageclass.yaml":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: standard
provisioner: kubernetes.io/gce-pd
parameters:
  type: pd-standard
reclaimPolicy: Retain
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, run this command to create the "standard" storage class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f standard-storageclass.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! We have our "standard" recipe ready for use.&lt;/p&gt;

&lt;p&gt;Now that we have our Redis namespace and the "standard" storage class, let's deploy our Redis Stack Server with superpowers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Create the ConfigMap&lt;/strong&gt;&lt;br&gt;
A ConfigMap is like a little box where we store some settings. In this case, we're storing settings for the Redis master and slave nodes. To create the ConfigMap, save the YAML code provided as a file named "configmap.yaml":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: ConfigMap
metadata:
  name: redis-stack-configuration
  namespace: redis
  labels:
    app: redis
data:
  master.conf: |
    maxmemory 1000mb
    maxmemory-policy allkeys-lru
    maxclients 20000
    timeout 300
    dbfilename dump.rdb
    dir /data
    appendonly yes
    save ""
  slave.conf: |
    slaveof redis-stack-0.redis-service.redis 6379
    maxmemory 1000mb
    maxmemory-policy allkeys-lru
    maxclients 20000
    timeout 300
    dir /data
    appendonly yes
    save ""
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f configmap.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;So what did we "apply" ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's imagine Redis is a magical toy box. We use the ConfigMap to set some rules about how our toy box works. Here are the rules we set:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;maxmemory&lt;/strong&gt;:Our toy box can only hold a certain number of toys. We set a limit on how many toys it can hold (1000 toy-sized spaces in our case).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;maxmemory-policy&lt;/strong&gt;: If our toy box gets too full, we need to remove some toys to make room for new ones. We choose the "allkeys-lru" policy, which means we'll remove the toys that we haven't played with in a while first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;maxclients&lt;/strong&gt;: Our toy box can have many friends playing with it at the same time. We set a limit on how many friends can play together (20,000 friends in our case).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;timeout&lt;/strong&gt;: If a friend stops playing with our toy box and goes to do something else, we want to give their spot to another friend who wants to play. We set a rule that says if a friend hasn't played with the toy box for 300 seconds, they'll have to wait their turn again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;dbfilename&lt;/strong&gt;: We give a special name to the list of toys inside our toy box, so we know what's inside.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;dir&lt;/strong&gt;: We pick a special room in our house where we'll keep our toy box and the list of toys.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;appendonly&lt;/strong&gt;: We decide to write down every time we add a new toy to our toy box in a special notebook. This way, if anything happens to our toy box, we can look at the notebook and know exactly which toys were inside.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;save&lt;/strong&gt;: We also have a camera that takes pictures of our toy box from time to time. But since we have our special notebook, we decide not to use the camera for now. So, we tell the camera not to take any pictures by providing an empty string.&lt;/p&gt;

&lt;p&gt;These rules in the ConfigMap help us manage our magical Redis toy box and make sure everything runs smoothly and efficiently.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;About "Master-Slave" concept&lt;/strong&gt;&lt;br&gt;
In Redis, we have a concept called "master-slave." Let's think of the master as a wise teacher and the slaves as students who follow the master. The master holds all the important information, and the students want to learn from the master.&lt;br&gt;
When we use a master-slave setup in Redis, we have one master Redis server and one or more slave Redis servers. The master Redis server is the main place where all the data is stored, and the slave Redis servers are like backup copies that hold the same data as the master.&lt;br&gt;
Whenever the master Redis server gets new information, it tells the slave Redis servers about it. The slaves then update their copies of the information to match the master. This way, if something happens to the master, we still have the slave Redis servers that know all the same information, so we don't lose any data.&lt;br&gt;
Now, in our ConfigMap, we have two different configurations - one for the master and one for the slave. The master configuration is for the wise teacher (the main Redis server), and the slave configuration is for the students (the backup Redis servers). These configurations help set up the master-slave relationship and make sure the master and slave Redis servers know their roles.&lt;br&gt;
So, in our Redis clubhouse, the master is the superhero who takes care of all the important stuff, and the slaves are like sidekicks who follow the superhero and help when needed. This way, if our superhero is busy or needs help, the sidekicks are always there to save the day!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Create the Service&lt;/strong&gt;&lt;br&gt;
A Service is like a phonebook for our application. It helps other parts of our app find and talk to Redis (our toy box). Save the YAML code provided as a file named "service.yaml".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: redis-service
  namespace: redis
  labels:
    app: redis
spec:
  ports:
    - port: 6379
  clusterIP: None
  selector:
    app: redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f service.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;So, what did we "apply" this time ?&lt;/strong&gt;&lt;br&gt;
Remember, a Redis service is like a magical phonebook for our Redis toy box. This phonebook helps our friends (other parts of our application) find and connect to Redis. Here's how our phonebook works:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ports&lt;/strong&gt;: Our phonebook has a special number that our friends can call to talk to our toy box. We set the number to 6379, which is the favorite number of Redis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;selector&lt;/strong&gt;: Our phonebook also needs to know which toy box it's helping. So, we give it a magical sticker that says "app: redis." Our phonebook looks for toy boxes with the same magical sticker and helps connect our friends to the right one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;clusterIP: None&lt;/strong&gt;: Remember how our phonebook usually gives our friends a single phone number to call, which connects them to the toy box? When we set clusterIP: None, we're telling our magical phonebook not to use a single phone number for our toy box. Instead, it creates a special kind of phonebook called a "headless service."&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A headless service is like a magical phonebook that doesn't have one phone number for all our friends to call. Instead, it gives each friend a direct connection to Redis, so they can talk to it without going through a shared phone number. This can be helpful when Redis needs to work closely with our friends, and they need a faster and more direct way to connect. By using a headless service, we make sure that our friends can quickly and easily talk to our Redis whenever they want.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Create the StatefulSet&lt;/strong&gt;&lt;br&gt;
A StatefulSet is like a blueprint for building a house. It defines the structure of our Redis deployment. Save the YAML code provided as a file named "statefulset.yaml".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis-stack
  namespace: redis
spec:
  serviceName: "redis-service"
  replicas: 2
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      labels:
        app: redis
    spec:
      initContainers:
      - name: init-redis
        image: redis/redis-stack-server:latest
        command:
        - /bin/bash
        - -c
        - |
          set -ex
          # Extract pod ordinal index from the hostname to generate the redis server-id.
          hostname_regex='-([0-9]+)$'
          if [[ `hostname` =~ ${hostname_regex} ]]; then
            ordinal=${BASH_REMATCH[1]}
          else
            exit 1
          fi

          # Copy the appropriate redis config files from the config map to their respective directories.
          config_map_path="/mnt"
          config_destination="/etc/redis-config.conf"

          if [[ ${ordinal} -eq 0 ]]; then
            cp "${config_map_path}/master.conf" "${config_destination}"
          else
            cp "${config_map_path}/slave.conf" "${config_destination}"
          fi
        volumeMounts:
        - name: redis-claim
          mountPath: /etc
        - name: config-map
          mountPath: /mnt/
      containers:
      - name: redis
        image: redis/redis-stack-server:latest
        ports:
        - containerPort: 6379
          name: redis-stack
        command:
          - redis-stack-server
          - "/etc/redis-config.conf"
        volumeMounts:
        - name: redis-data
          mountPath: /var/lib/redis-stack
        - name: redis-claim
          mountPath: /etc
      volumes:
      - name: config-map
        configMap:
          name: redis-stack-configuration
  volumeClaimTemplates:
  - metadata:
      name: redis-claim
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
      storageClassName: standard
  - metadata:
      name: redis-data
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
      storageClassName: standard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f statefulset.yaml

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

&lt;/div&gt;



&lt;p&gt;We're building a house for our Redis, and we're using a special blueprint called a "statefulset." This blueprint has a lot of important parts that make sure our house is built perfectly for Redis:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;serviceName&lt;/strong&gt;: This connects our house blueprint to the magical phonebook we made before. This way, our friends can find our house easily when they want to play with Redis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;replicas&lt;/strong&gt;: This tells us how many houses we want to build for our Redis. Right now, we want to build 2 houses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;initContainers&lt;/strong&gt;: These are like little helpers that get our houses ready before Redis moves in. We have one helper here who sets up the rules for Redis, depending on if it's the leader (master) or a helper (slave).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;containers&lt;/strong&gt;: This is where we put Redis in houses. We make sure Redis knows the rules set up by our little helper.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;volumes&lt;/strong&gt;: These are like storage rooms in our houses where we keep important things. In this case, we have a storage room for the list of rules we made for Redis earlier (the ConfigMap).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;volumeClaimTemplates&lt;/strong&gt;: These are like asking our house builder to add more storage rooms. Here, we ask for two more storage rooms: one for our list of rules and another for the actual Redis data.&lt;/p&gt;

&lt;p&gt;By understanding these important parts of our house blueprint (the statefulset), we can make sure our house is built perfectly for our Redis toy box. This way, Redis can work together with our friends and make our playtime a lot more fun!&lt;/p&gt;

&lt;p&gt;Step 6: Check if everything works !&lt;br&gt;
Check our Configmap&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kubectl get configmap -n redis
NAME                        DATA   AGE
redis-stack-configuration   2      50s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check our Service&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kubectl get service -n redis
NAME          TYPE       CLUSTER-IP EXTERNAL-IP PORT(S)  AGE
redis-service ClusterIP  None       &amp;lt;none&amp;gt;      6379/TCP 55s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check our StatefulSet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kubectl get statefulset -n redis
NAME          READY   AGE
redis-stack   2/2     2m19s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check pods&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -n redis   
NAME            READY   STATUS    RESTARTS   AGE
redis-stack-0   1/1     Running   0          3m12s
redis-stack-1   1/1     Running   0          2m52s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How these components work together:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The ConfigMap stores the Redis settings, acting as a central place for both master and slave configurations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Service acts as a phonebook, helping other parts of the app find and talk to the Redis nodes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The StatefulSet is the blueprint that describes the structure of our Redis deployment:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It connects to the Service using the serviceName attribute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It specifies how many Redis instances we want with the replicas attribute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It uses an initContainer to prepare the Redis configuration files for master and slave nodes based on the pod's hostname.&lt;br&gt;
It defines the main container running the Redis server, telling it to use the configuration file prepared by the init container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It sets up volumes to store data, including the ConfigMap and storage for the Redis data.&lt;br&gt;
When you apply these files with &lt;code&gt;kubectl apply -f&lt;/code&gt;, Kubernetes builds the Redis house using the blueprint (StatefulSet), the phonebook (Service), and the little box for settings (ConfigMap).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope this simpler explanation helps you understand the key components and their interactions in deploying a Redis StatefulSet on Kubernetes. If you have any questions, feel free to ask! Happy coding! 😊&lt;/p&gt;

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