惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Jina AI
Jina AI
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
Help Net Security
Help Net Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LINUX DO - 最新话题
PCI Perspectives
PCI Perspectives
博客园 - 三生石上(FineUI控件)
V2EX - 技术
V2EX - 技术
Spread Privacy
Spread Privacy
T
Tor Project blog
量子位
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
小众软件
小众软件
博客园 - 叶小钗
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
Y
Y Combinator Blog
N
News | PayPal Newsroom
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
Tenable Blog
Scott Helme
Scott Helme
G
GRAHAM CLULEY
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
IT之家
IT之家
Schneier on Security
Schneier on Security
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
T
Threat Research - Cisco Blogs
博客园 - 司徒正美
Application and Cybersecurity Blog
Application and Cybersecurity Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The Last Watchdog
The Last Watchdog
L
LangChain Blog
C
Check Point Blog
Google Online Security Blog
Google Online Security Blog
V
Visual Studio Blog
Latest news
Latest news

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Intro to kubernetes
Hatem Temimi · 2026-05-07 · via DEV Community

Intro to Kubernetes

This guide is aimed for people who do not know what kubernetes is, but know what a container and what a virtual machine is.
We will go through the why to kubernetes, and core concepts you need to know, along with a few commands and code snippets to put things into perspective.

Quickstart

Before kubernetes was created, containers were managed within a virtual machine, and one operating system had multiple virtual machines running, each with its own operating system and multiple containers, this method works, but it’s imperative and has its own limitations when we want to handle millions of containers. Google created kubernetes exactly for this usecase.

Kubernetes is used to manage containers, it was mainly created to orchestrate how multiple containers are being handled (networking / run / down..), it does this via multiple abstraction layers, these abstractions follow a hierarchy and are designed to simplify managing containers.

Kubernetes vs. Traditional Virtual Machines (VMs)

Before Kubernetes and containers, the standard for isolation was the Virtual Machine. While both allow you to run multiple applications on a single physical server, they operate at different layers of the stack.

1. Architectural Difference

  • Virtual Machines: Each VM includes a full copy of an operating system, the application, and necessary binaries/libraries. This runs on a Hypervisor (like VMware or Hyper-V).
  • Kubernetes (Containers): Containers share the host's OS kernel. They only package the application and its dependencies, making them significantly lighter.

2. Side-by-Side Comparison

Feature Virtual Machines (VMs) Kubernetes (Containers)
Size Large (Gigabytes) - includes full OS. Small (Megabytes) - includes only app + libs.
Boot Time Minutes (needs to boot the whole OS). Seconds (starts like a standard process).
Efficiency High overhead; resources are often wasted. High density; many containers on one host.
Portability Hard to move between different cloud providers. "Build once, run anywhere" (Docker/OCI standard).
Isolation Stronger (hardware-level virtualization). Process-level (shared kernel, though very secure).

3. Why the Shift?

In Kubernetes, If a pod fails (we will get to what a pod is), Kubernetes doesn't try to "heal" it; it simply kills it and starts a brand new one. This Self-Healing is the core power of Kubernetes.

Scalability

Scaling a VM-based app usually involves spinning up an entire new server, which is slow. Scaling in Kubernetes involves telling the Deployment to run more replicas, which happens almost instantly.

Resource Utilization

With VMs, you often pay for CPU/RAM that isn't being used because the OS itself is idling. Kubernetes allows you to "bin-pack" containers, squeezing the maximum value out of your AWS EC2 instances by filling up every available gap of memory and CPU.


Core and Abstractions

A simplified Kubernetes abstractions hierarchy looks like this: clusters are the parent component; they contain nodes and nodes contain pods and pods contain containers, but they also contain one special component called the control plane.

Within a cluster we find a control plane and one or multiple nodes, and for each node we have a special component called a kubelet that makes sure every pod within the node is running fine, as for the control plane it’s what we can access via kubectl: a CLI that allows us to access the control plane of kubernetes

Pods are the atomic unit that kubernetes handles, If we make an equivalent to the old model, pods are the equivalent of virtual machines as they have a dedicated IP address.

Within a pod we can run one or multiple containers, which share the same network, and can communicate with each other via localhost for example

Pods live and die within nodes, but they cannot come back to life, they can run on only one node and they are unique to it, they cannot for example run across multiple nodes

Kubernetes needs an environment to be run within such as: minikube which is well known and probably most used, kubeadm (most heavy) or kind (most lightweight)

We can use kubernetes imperatively by managing containers via the cli or we can use it declaratively with YAML (the most common way)

this is an example of a pod definition via YAML:

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
  labels:
    app: my-app
spec:
  containers:
  - name: my-container
    image: nginx:1.14.2
    ports:
    - containerPort: 80
      ressources:
          requests: #this section checks for ressources in the pod before starting the container
              memory: "64Mi"
              cpu: "100m" #10% of the cpu
            limits:
                memory: "128Mi"
                cpu: "250m" #25% of the cpu

Enter fullscreen mode Exit fullscreen mode

Mandatory commands kit

run a container inside a pod

kubectl run -f file.pod.yml ## will crash if the container already exist
kubectl apply -f file.pod.yml ## creates the container if not running

Enter fullscreen mode Exit fullscreen mode

view running pods

kubectl get all ##gets all pods
kubecet get pod ## gets all pods

Enter fullscreen mode Exit fullscreen mode

inspect a certain pod (gets networking info, running containers inside..)

kubectl describe pod/my-nginx

Enter fullscreen mode Exit fullscreen mode

Check the logs of a certain pod

kubectl logs pod/my-nginx

Enter fullscreen mode Exit fullscreen mode

shells into a container running inside a pod

kubectl exec pod-name -c container-name -it /bin/sh 

Enter fullscreen mode Exit fullscreen mode

delete a pod

kubectl delete pod/my-nginx

Enter fullscreen mode Exit fullscreen mode

Probes

To ensure a pod is alive, we can check the logs, or use describe, but we can also set this conditionally in the yaml definition of the pod via probes; liveness probes and readiness probes

liveness tells us if the pod is alive and when the pod should restart, and readiness if it’s ready to receive requests

Liveness and readiness probe via http (can be done via other ways such as TCP)

apiVersion: v1
kind: Pod
metadata:
  labels:
    test: liveness
  name: liveness-http
spec:
  containers:
  - name: liveness
    image: registry.k8s.io/e2e-test-images/agnhost:2.40
    args:
    - liveness
    livenessProbe:
      httpGet:
        path: /healthz
        port: 8080
        httpHeaders:
        - name: Custom-Header
          value: Awesome
      initialDelaySeconds: 3
      periodSeconds: 3
    readinessProbe:
        ##same as liveness probe for http

Enter fullscreen mode Exit fullscreen mode

Deployments & ReplicaSets:

Until now, we have focused on Pods. While pods are the smallest unit in Kubernetes, they are "mortal." If a standalone pod crashes or a node fails, the pod is gone. In a production environment, you don't manually recreate pods; you use Deployments.

1. The Updated Hierarchy

Kubernetes uses a layered abstraction to manage your containers:

ClusterNodesDeploymentReplicaSetPodsContainers

  • Deployment: The high-level object. It handles updates, rollbacks, and the desired state of your application.
  • ReplicaSet: The "enforcer" under the hood. Its only job is to ensure that the exact number of pod replicas you requested are running at all times.

2. Declarative "Magic" (Self-Healing)

Kubernetes is declarative. You don't tell the cluster to "start a pod." You tell the Deployment: "I want 3 replicas of this pod."

If you manually delete a pod belonging to a ReplicaSet, Kubernetes notices the gap (e.g., only 2 pods are running when 3 were requested) and instantly spins up a new one to match your Desired State.


3. Understanding the Deployment YAML

The syntax for a Deployment introduces Selectors and Templates, which act as the "glue" between the deployment and the pods.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: http-echo-app
spec:
  replicas: 2           # Desired number of pod units
  selector:             # How the Deployment finds its Pods
    matchLabels:
      app: http-echo-app
  template:             # The Blueprint for the Pods to be created
    metadata:
      labels:           # These MUST match the selector above
        app: http-echo-app
    spec:
      containers:
        - name: http-echo
          image: hashicorp/http-echo:0.2.3
          args:
            - "-text=Hello from the app!"
            - "-listen=:8080"
          ports:
            - containerPort: 8080

          # ---------- HEALTH CHECKS ----------
          # Liveness: Is the container alive? If not, restart it.
          livenessProbe:
            httpGet:
              path: /health
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 5

          # Readiness: Is the app ready to receive traffic?
          readinessProbe:
            httpGet:
              path: /ready
              port: 8080
            initialDelaySeconds: 3
            periodSeconds: 5

Enter fullscreen mode Exit fullscreen mode

ZERO DOWNTIME DEPLOYMENTS

this is probably kube’s most powerful feature, the ability to rollout older images and create new ones with zero downtime, if you had to do this manually, it’s far more challenging as you will taking down the older release images and manually creating the new ones which will probably cause an outage in the updated service while this process is done, kubernetes does this automatically, via aliases, you can create multiple versions of the app, as long as we have the same alias in common between these files, when using apply, kubectl will terminate the older pods, and create new ones, here is a sample deployment file of our new version of the app that bumps the image to latest

apiVersion: apps/v1
kind: Deployment
metadata:
  name: http-echo-app
  labels:
    app: http-echo-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: http-echo-app
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 1
  template:
    metadata:
      labels:
        app: http-echo-app
    spec:
      containers:
        - name: http-echo
          image: hashicorp/http-echo:latest
          args:
            - "-text=Hello from Kubernetes v2!"
            - "-listen=:8080"
          ports:
            - containerPort: 8080

          readinessProbe:
            httpGet:
              path: /
              port: 8080
            initialDelaySeconds: 2
            periodSeconds: 5

          livenessProbe:
            httpGet:
              path: /
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 5

Enter fullscreen mode Exit fullscreen mode

we now only have to run:

kubectl apply -f *echo-v2.deployment.yml*

Enter fullscreen mode Exit fullscreen mode

this will terminate older pods and create new ones with the newer version.

Up until now, all of these deployments are not exposed, we are just checking them running or not, well it’s time to expose these pods and start poking on with http, this can be done via services.

Services: Connecting to your Pods

In Kubernetes, Pods are ephemeral (they die and are replaced). If you tried to connect directly to a Pod's IP address, your connection would break the moment that Pod was recreated.

Services act as a stable "Entry Point" (or a tunnel) that routes traffic to a set of Pods using labels.


1. Service Types: Finding the Right Entry Point

Service Type Scope Use Case
ClusterIP Internal Only Default type. Used for internal communication (e.g., your Frontend talking to your Backend).
NodePort External Opens a specific port (30000-32767) on every Node's IP. Great for testing or simple dev environments.
LoadBalancer External The standard for Production. On AWS/GCP/Azure, it provisions a real Cloud Load Balancer with a public IP.
ExternalName Proxy Acts as a redirect to an external DNS name (e.g., an external RDS database or a third-party API).

2. Anatomy of a Service

The most important part of a Service is the Selector—this is how the Service knows which Pods to send traffic to.

Example: LoadBalancer

This is ideal for exposing your app to the internet.

apiVersion: v1
kind: Service
metadata:
  name: http-echo-service
spec:
  type: LoadBalancer
  selector:
    app: http-echo-app # Finds Pods with this label
  ports:
    - protocol: TCP
      port: 80         # Port accessible on the LoadBalancer IP
      targetPort: 8080 # Port your Go/Node/Python app is listening on

Enter fullscreen mode Exit fullscreen mode

Now that we have setup our app and exposed it via the service, we have one more thing to worry about: storage. For now if we take down a pod, we loose all the data, since pods are ephemeral, we need a way to link pods to some sort of storage, this can be done via Volumes.

Volumes: Orchestrating Storage in Kubernetes

In Kubernetes, a Volume is a directory accessible to the containers within a pod. Unlike a container's local writable layer—which is destroyed if the container crashes or restarts—volumes allow data to persist and be shared across the pod's lifecycle.

1. Storage Lifecycles

Kubernetes handles the lifecycle of data in two primary ways:

  • Ephemeral Storage: Tied strictly to the Pod's lifetime. If the pod is deleted, the data is gone forever.
    • Core Example: emptyDir. Often used as a "scratch pad" for temporary computation or as a shared space between containers in the same pod.
  • Persistent Storage: Decoupled from the Pod. If the pod dies or is moved to another node, the volume remains and can be re-attached to a new pod.
    • Core Examples: hostPath (storing data on the node's disk), NFS, or cloud-specific storage like AWS EBS.

2. The Persistence Workflow: PV vs. PVC

To manage persistent storage efficiently, Kubernetes uses an abstraction layer that separates the physical storage from the developer's request.

  • PersistentVolume (PV): This is a "physical" resource in the cluster (e.g., a 10GB SSD on AWS). It is provisioned by an administrator or a StorageClass and exists independently of any pod.
  • PersistentVolumeClaim (PVC): This is a "request" for storage by a developer. You define the size and access mode, and Kubernetes automatically "binds" it to a matching PV.

Analogy: A PV is a physical hard drive sitting on a shelf. A PVC is a request form for a drive of a certain size. Once the request is fulfilled, the drive is "plugged into" your Pod.


3. Access Modes

When configuring persistent volumes, you must define how they can be mounted:

Mode Description
ReadWriteOnce (RWO) Mounted as read-write by a single node.
ReadOnlyMany (ROX) Mounted as read-only by many nodes.
ReadWriteMany (RWX) Mounted as read-write by many nodes (ideal for shared logs/CMS).

4. Implementation Example

To use persistent storage, the Pod points to the Claim, not the disk itself. This ensures the application remains portable.

# 1. The Claim: "I need 1GB of storage"
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: app-storage-claim
spec:
  accessModes: [ "ReadWriteOnce" ]
  resources:
    requests:
      storage: 1Gi
---
# 2. The Pod: "Use the claim named app-storage-claim"
apiVersion: v1
kind: Pod
metadata:
  name: app-server
spec:
  volumes:
    - name: data-volume
      persistentVolumeClaim:
        claimName: app-storage-claim
  containers:
    - name: app-container
      image: nginx
      volumeMounts:
        - mountPath: "/var/www/html"
          name: data-volume

Enter fullscreen mode Exit fullscreen mode