Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบเครือข่าย >> ความปลอดภัยเครือข่าย

Containerization ในความปลอดภัยเครือข่ายคืออะไร

Containerization ในเครือข่ายคืออะไร

Containerization เป็นเทคโนโลยีการ Virtualization ระดับ OS (OS-level Virtualization) ที่บรรจุแอปพลิเคชัน พร้อม Dependency, Library, Config ไว้ใน Container ที่แยกจากกัน (Isolated) แต่ใช้ Kernel ของ Host OS เดียวกัน ทำให้ Deploy/Run ได้เหมือนกันทุกสภาพแวดล้อม (Dev, Test, Prod, Cloud, On-prem)

Containerization หมายถึงอะไร

การแยก User Space (Containers) บน Kernel เดียวกัน แอปพลิเคชันรันใน Container แต่ละตัว แยก Process, Network, Filesystem, IPC ผ่าน Linux Namespaces และควบคุมทรัพยากรด้วย Cgroups

Containerization ทำงานอย่างไร

  • ไม่ต้อง Ship OS ทั้งตัว (ต่างจาก VM)
  • Container Image ประกอบด้วย Layers (Base OS, Dependency, App Code)
  • ขนาดเล็ก เริ่มเร็ว (วินาที) ใช้ทรัพยากรน้อยกว่า VM มาก
  • Docker/containerd/Podman เป็น Runtime ยอดนิยม

Containerization ใช้ทำอะไร

  • Deploy Distributed Apps (Microservices) โดยไม่ต้องสร้าง VM ต่อ App
  • CI/CD Pipeline (Build, Test, Deploy เดียวกันทุก Env)
  • Hybrid/Multi-cloud Portability
  • Legacy App Modernization (Lift & Shift)
  • Batch Processing, ML Training, Edge Computing

Container ช่วยปรับปรุงความปลอดภัยอย่างไร

  1. Immutable Infrastructure: Image ไม่เปลี่ยนแปลง Deploy ใหม่แทนการ Patch Live
  2. Reduced Attack Surface: Minimal Base Image (Distroless, Alpine, Scratch)
  3. Isolation: Namespace, Cgroups, Seccomp, SELinux/AppArmor, Capabilities Drop
  4. Supply Chain Security: Image Signing (Cosign/Notary), SBOM, Vulnerability Scanning (Trivy, Grype, Snyk)
  5. Runtime Security: Falco, Sysdig, eBPF-based Monitoring (Detect Anomaly: Exec, Network, File Access)
  6. Zero Trust Network: Service Mesh (Istio, Linkerd) mTLS, Authorization Policy

ทำไม Containerization จึงปลอดภัย

  • แยก Dependency ระหว่าง App (No Dependency Hell)
  • Update/Rollback เร็ว ไม่กระทบ Service อื่น (Microservices Independence)
  • Image Scanning & Signing ใน Pipeline (Shift Left Security)
  • Non-root User, Read-only Rootfs, Drop All Capabilities

ตัวอย่าง Containerization

  • ย้าย Code จาก Laptop (Linux) → VM (Linux) → Cloud (Linux/Windows) รันได้เหมือนกัน
  • Container Image บรรจุ: App Binary, Config, Library, Runtime, OS Libs (Base Image)

Container Network ทำงานอย่างไร

  • Docker/Podman สร้าง Virtual Bridge (docker0, cni0)
  • Container ได้ veth pair เชื่อมต่อ Bridge
  • CNI Plugins (Calico, Cilium, Flannel, Weave) จัดการ Overlay Network, Network Policy, Load Balancing, Service Discovery
  • Microservices 溝通ผ่าน Service Name (DNS) หรือ Sidecar Proxy (Envoy)

Containerization vs Virtualization

ContainerizationVirtualization (VM)
Share Host KernelGuest OS Kernel แต่ละ VM
OS-level IsolationHardware-level Isolation (Hypervisor)
Startup: วินาที, Size: MBStartup: นาที, Size: GB
Density สูง (หลายร้อยต่อ Host)Density ต่ำ (สิบต่อ Host)
เหมาะ Microservices, Cloud-nativeเหมาะ Legacy App, Windows/Linux Mixed, Strong Isolation

กระบวนการ Containerization (Containerize Process)

  1. เขียน Dockerfile / Containerfile: FROM, COPY, RUN, ENV, EXPOSE, CMD/ENTRYPOINT
  2. Build Image: `docker build -t myapp:1.0 .`
  3. Scan Image: Trivy, Grype, Snyk (Vulnerability, Secret, Misconfig)
  4. Sign Image: Cosign (Keyless/Sigstore)
  5. Push Registry: Docker Hub, GHCR, ECR, Harbor
  6. Deploy: Kubernetes (Helm/Kustomize), Docker Compose, Nomad, ECS/Fargate
  7. Runtime Security: Admission Control (Kyverno/OPA), Runtime Monitor (Falco)

Containerization ใน DevOps

บรรจุ Software Component, Environment, Dependency, Config ใน Container แยกกัน Deploy ได้เหมือนกัน On-prem และ Cloud (Consistent Deployment)

Docker และ Containerization

Docker เป็น Platform/Toolchain ยอดนิยมสำหรับ Build, Ship, Run Container ทำให้ Developer บรรจุ App + OS Libs + Dependency ใน Multi-platform Executable

คุณสมบัติหลักของ Containerization

  • Efficiency: Resource Utilization สูง, Density สูง
  • Portability/Flexibility: Run Anywhere (Linux/Windows/macOS/Cloud/Edge)
  • Security: Isolation, Immutable, Scannable, Signable, Policy-enforceable

ประโยชน์ของ Containerization

  • ลดต้นทุน Infra (Density สูง, Bin Packing)
  • Scalability ระดับ Microservice/Function (HPA, VPA, KEDA)
  • ปรับปรุงความปลอดภัย: Process Isolation, Image Scanning, Zero Trust Network
  • Developer Velocity: Dev/Prod Parity, Fast Iteration

Containerised Applications คืออะไร

แอปพลิเคชันที่บรรจุใน Container รันบน Kernel เดียวกัน แยกด้วย Namespace/Cgroups เปลี่ยนวิธี Dev/Test/Run Cloud App ให้เป็น Cloud-native, Immutable, Scalable, Observable

สรุป

Containerization เป็นพื้นฐานของ Cloud-native Security ให้ Isolation, Immutability, Supply Chain Security, Runtime Protection, Zero Trust Networking ทำให้สามารถ Build/Ship/Run แอปได้ปลอดภัยและรวดเร็วในทุกสภาพแวดล้อม