คอนเทนเนอร์และการจัดการระบบด้วย Kubernetes
เรียนรู้ว่าคอนเทนเนอร์บรรจุบริการอย่างไร และ Kubernetes จัดตารางงาน ปรับขนาด และกู้คืนบริการเหล่านั้นอย่างไร ซึ่งเป็นพื้นฐานที่ทำให้การติดตั้งไมโครเซอร์วิสและการประมวลผลแบบไร้เซิร์ฟเวอร์จัดการได้ง่าย
คอนเทนเนอร์และการจัดการระบบด้วย Kubernetes เป็นบทเรียน API Rate Limiting & Scalability Patterns ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน API Rate Limiting & Scalability Patterns และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส API Rate Limiting & Scalability Patterns มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Why Containers
Microservices multiply the number of deployable units. Containers package each service with its dependencies into a portable, isolated image that runs the same everywhere.
Image vs. Container
An image is the immutable blueprint; a container is a running instance of it. You build an image once and run many identical containers from it.
FROM node:20-alpine
WORKDIR /app
COPY . .
RUN npm ci
CMD ["node", "server.js"]The Orchestration Problem
Running a few containers by hand is easy. Running hundreds across many machines — restarting crashes, balancing load, rolling out updates — needs an orchestrator.
Kubernetes Basics
Kubernetes schedules containers onto a cluster of machines and keeps them running. Core objects:
- Pod — one or more containers that run together
- Deployment — declares desired replicas
- Service — stable network endpoint
Declarative Desired State
You declare what you want; Kubernetes makes reality match. Ask for 3 replicas and it keeps 3 alive, restarting any that die.
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
selector:
matchLabels:
app: ordersSelf-Healing
If a node fails or a container crashes, Kubernetes reschedules the pod elsewhere automatically. The system converges back to the declared state without manual intervention.
Health Probes
Kubernetes uses probes to know container state:
- liveness — restart if it is hung
- readiness — only send traffic when ready
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5Horizontal Pod Autoscaling
The Horizontal Pod Autoscaler adds or removes pods based on metrics like CPU, letting microservices scale out under load and back in when quiet.
minReplicas: 2
maxReplicas: 20
targetCPUUtilizationPercentage: 70Rolling Updates
Deploying a new version replaces pods gradually, keeping the service available throughout. If the new version misbehaves, Kubernetes can roll back to the previous one.
How This Powers Serverless
Many serverless and Functions-as-a-Service platforms run on top of Kubernetes. Understanding pods, autoscaling, and probes demystifies what happens beneath a deployed function.
Resource Requests and Limits
Each container declares a CPU and memory request (what it needs to be scheduled) and a limit (its hard ceiling). Correct values let the scheduler pack nodes efficiently and stop one greedy pod from starving its neighbors.
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
cpu: 500m
memory: 512MiQuick Check
Test your orchestration knowledge.
Recap
You learned the container platform behind scalable services:
- Containers package services portably
- Kubernetes schedules and self-heals them
- Probes guide restarts and traffic
- Autoscaling and rolling updates keep services elastic and available
เรียนรู้ API Rate Limiting & Scalability Patterns ด้วย AI tutor — ฟรี
เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป
- คอร์ส
- 12
- บทเรียน
- 48
คำถามที่พบบ่อย
บทเรียน “คอนเทนเนอร์และการจัดการระบบด้วย Kubernetes” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “คอนเทนเนอร์และการจัดการระบบด้วย Kubernetes” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส API Rate Limiting & Scalability Patterns ให้อัปเกรดเป็น CoddyKit PRO คอร์ส API Rate Limiting & Scalability Patterns มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “คอนเทนเนอร์และการจัดการระบบด้วย Kubernetes”
เรียนรู้ว่าคอนเทนเนอร์บรรจุบริการอย่างไร และ Kubernetes จัดตารางงาน ปรับขนาด และกู้คืนบริการเหล่านั้นอย่างไร ซึ่งเป็นพื้นฐานที่ทำให้การติดตั้งไมโครเซอร์วิสและการประมวลผลแบบไร้เซิร์ฟเวอร์จัดการได้ง่าย คุณปฏิบัติ API Rate Limiting & Scalability Patterns ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน API Rate Limiting & Scalability Patterns หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน API Rate Limiting & Scalability Patterns บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “คอนเทนเนอร์และการจัดการระบบด้วย Kubernetes” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน API Rate Limiting & Scalability Patterns นี้ได้ไหม
ได้ บทเรียน API Rate Limiting & Scalability Patterns ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- การขยายขนาดด้วยสถาปัตยกรรมไมโครเซอร์วิส
- ฟังก์ชันแบบไร้เซิร์ฟเวอร์สำหรับ API ที่ขับเคลื่อนด้วยเหตุการณ์
- แนวคิดและประโยชน์ของเมชบริการ
- คอนเทนเนอร์และการจัดการระบบด้วย Kubernetes