เมื่อพูดถึงการพัฒนาและดูแลระบบสมัยใหม่ เรามักพบคำว่า Cloud Native, Kubernetes และ OpenShift อยู่ด้วยกันเสมอ แต่ทั้งสามคำไม่ได้มีความหมายเหมือนกัน

  • Cloud Native คือแนวคิดและรูปแบบการออกแบบ พัฒนา และดำเนินงานระบบให้เหมาะกับสภาพแวดล้อมแบบ Cloud
  • Kubernetes คือระบบ Container Orchestration สำหรับจัดการแอปพลิเคชันที่ทำงานใน Container
  • Red Hat OpenShift คือ Application Platform ที่มี Kubernetes เป็นแกนกลาง และเพิ่มเครื่องมือสำหรับ Developer, DevOps, Security และ Operations ให้พร้อมใช้งานในระดับองค์กร

กล่าวอย่างง่ายได้ว่า

Cloud Native คือแนวคิด → Kubernetes คือ Engine สำคัญ → OpenShift คือ Platform ที่นำ Kubernetes และเครื่องมือรอบข้างมาประกอบเป็นระบบพร้อมใช้งาน


#1. Cloud Native คืออะไร

Cloud Native ไม่ได้หมายถึงเพียงแค่นำ Application ไปติดตั้งบน AWS, Azure หรือ Google Cloud เท่านั้น แต่หมายถึงการออกแบบระบบให้สามารถใช้ประโยชน์จาก Infrastructure ที่มีความยืดหยุ่นและเปลี่ยนแปลงได้ตลอดเวลา

แนวคิดที่พบได้บ่อย ได้แก่

  • Containers
  • Microservices
  • Declarative Configuration
  • Infrastructure as Code
  • Immutable Infrastructure
  • Automated Deployment
  • CI/CD
  • GitOps
  • Observability
  • Auto Scaling
  • Self-Healing
  • Service Mesh
  • DevSecOps

Cloud Native Application จึงควรถูกออกแบบให้สามารถ

  1. Scale ได้
  2. Recover จากความล้มเหลวได้
  3. Deploy ได้บ่อย
  4. Automation ได้
  5. Observability ได้
  6. ทำงานได้บน Infrastructure หลายรูปแบบ

#2. Kubernetes อยู่ตรงไหนใน Cloud Native

Kubernetes หรือ K8s เป็น Open Source Container Orchestration Platform ที่ช่วยจัดการ Containerized Application

หน้าที่สำคัญ เช่น

  • Deploy Application
  • Scheduling Container
  • Scaling
  • Service Discovery
  • Load Balancing
  • Self-Healing
  • Rolling Update
  • Configuration Management
  • Secret Management
  • Persistent Storage Integration

ตัวอย่าง Kubernetes Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-api
spec:
  replicas: 3
  selector:
    matchLabels:
      app: demo-api
  template:
    metadata:
      labels:
        app: demo-api
    spec:
      containers:
        - name: api
          image: ghcr.io/example/demo-api:1.0
          ports:
            - containerPort: 8080

Deployment นี้ประกาศว่า Application ต้องมีจำนวน 3 replicas และ Kubernetes จะพยายามรักษา Desired State ดังกล่าวไว้


#3. OpenShift คืออะไร

Red Hat OpenShift เป็น Enterprise Application Platform ที่ใช้ Kubernetes เป็นแกนกลาง

OpenShift ไม่ได้แทน Kubernetes แต่เพิ่ม Platform Services และ Operational Tooling เข้าไปเพื่อให้ใช้งาน Kubernetes ในองค์กรได้ง่ายขึ้น

ภาพแนวคิดโดยย่อ

Application
    ↓
Developer Platform
    ↓
OpenShift
    ↓
Kubernetes
    ↓
Containers
    ↓
Linux / Cloud / Datacenter

OpenShift ช่วยรวมความสามารถหลายด้านไว้ใน Platform เดียว เช่น

  • Kubernetes
  • Container Runtime
  • Networking
  • Ingress / Routing
  • Authentication / Authorization
  • Operators
  • Monitoring
  • Logging Integration
  • CI/CD Integration
  • GitOps
  • Developer Console
  • Security Policies
  • Registry Integration
  • Service Mesh Integration
  • Serverless Integration

#4. ความสัมพันธ์ระหว่าง Cloud Native, Kubernetes และ OpenShift

สามารถมองได้เป็นลำดับดังนี้

flowchart TD

A[Cloud Native Principles]

A --> B[Containers]
A --> C[Microservices]
A --> D[DevOps / DevSecOps]
A --> E[Automation]
A --> F[Observability]

B --> G[Kubernetes]
C --> G
E --> G

G --> H[Red Hat OpenShift]

H --> I[Developer Platform]
H --> J[GitOps]
H --> K[Operators]
H --> L[Security]
H --> M[Monitoring]
H --> N[Hybrid Cloud]

Cloud Native จึงเป็นแนวคิดที่กว้างกว่า OpenShift และ Kubernetes


#5. OpenShift Architecture แบบเข้าใจง่าย

โครงสร้างสามารถแบ่งเป็นหลายชั้น

┌────────────────────────────────────┐
│          Applications              │
│ Java | Go | Python | Node | .NET   │
├────────────────────────────────────┤
│        Developer Experience        │
│ Console | CLI | Pipelines | GitOps │
├────────────────────────────────────┤
│            OpenShift               │
│ Operators | Routes | Security      │
│ Monitoring | Registry | Policies   │
├────────────────────────────────────┤
│            Kubernetes              │
│ Pod | Deployment | Service | PVC   │
├────────────────────────────────────┤
│           Infrastructure           │
│ AWS | Azure | GCP | VMware | Bare  │
└────────────────────────────────────┘

#6. Kubernetes กับ OpenShift ต่างกันอย่างไร

ประเด็น Kubernetes OpenShift
ประเภท Container Orchestration Platform Enterprise Application Platform
Kubernetes API มี มี
Web Console ขึ้นกับ Distribution / Tool มี OpenShift Console
Developer Workflow ต้องประกอบเครื่องมือเพิ่ม มี Platform Integration มากกว่า
Security Defaults กำหนดได้ยืดหยุ่น มีแนวทางและ Defaults สำหรับองค์กร
Operators รองรับ ผสานเข้ากับ Platform อย่างมาก
Monitoring ต้องเลือก Stack มีระบบ Monitoring ที่ integrate กับ Platform
GitOps ติดตั้งเพิ่มเติม รองรับผ่าน OpenShift GitOps
Enterprise Support แล้วแต่ Vendor Red Hat Support
Hybrid Cloud ทำได้ เป็น Use Case สำคัญของ Platform

ดังนั้น OpenShift เหมาะกับองค์กรที่ต้องการ Kubernetes + Enterprise Platform + Governance + Support


#7. ตัวอย่าง Cloud Native Stack บน OpenShift

ตัวอย่าง Stack

Developer
   │
   ▼
Git Repository
   │
   ▼
CI Pipeline
   │
   ▼
Container Image
   │
   ▼
Container Registry
   │
   ▼
GitOps Repository
   │
   ▼
Argo CD / OpenShift GitOps
   │
   ▼
OpenShift
   │
   ├── Kubernetes
   ├── Operators
   ├── Monitoring
   ├── Security
   └── Networking

Workflow นี้ช่วยให้การ Deploy ระบบเป็นแบบ Declarative และตรวจสอบย้อนหลังผ่าน Git ได้


#8. OpenShift กับ GitOps

GitOps ใช้ Git เป็น Source of Truth ของระบบ

ตัวอย่าง Repository

gitops-repository/
├── applications/
│   ├── frontend/
│   └── backend/
├── environments/
│   ├── development/
│   ├── staging/
│   └── production/
└── argocd/

เมื่อมีการเปลี่ยน Manifest

Developer
   ↓
Git Push
   ↓
Git Repository
   ↓
Argo CD
   ↓
OpenShift Cluster

Argo CD จะตรวจสอบความแตกต่างระหว่าง Desired State ใน Git กับ Actual State ของ Cluster และ Sync ให้ตรงกันตาม Policy ที่กำหนด


#9. OpenShift Operators

แนวคิดสำคัญอีกอย่างคือ Operator

Operator เป็นวิธีเพิ่มความรู้ด้านการดูแล Application เข้าไปใน Kubernetes Controller

ตัวอย่างเช่น

PostgreSQL Operator
Kafka Operator
Prometheus Operator
OpenShift GitOps Operator
Service Mesh Operator

แทนที่จะติดตั้ง Software ด้วย Script จำนวนมาก ผู้ดูแลสามารถประกาศ Desired State ผ่าน Custom Resource

apiVersion: example.io/v1
kind: Database
metadata:
  name: production-db
spec:
  replicas: 3
  storage: 100Gi

Operator จะรับผิดชอบ Lifecycle ของระบบตาม Logic ที่ถูกเขียนไว้


#10. OpenShift สำหรับ Microservices

Architecture ตัวอย่าง

flowchart LR

U[User]

U --> R[OpenShift Route]

R --> F[Frontend]

F --> A[API Gateway]

A --> S1[User Service]
A --> S2[Order Service]
A --> S3[Payment Service]

S1 --> DB1[(Database)]
S2 --> DB2[(Database)]

S3 --> MQ[Message Broker]

MQ --> S4[Notification Service]

แต่ละ Service สามารถ

  • Deploy แยกกัน
  • Scale แยกกัน
  • Update แยกกัน
  • Monitor แยกกัน
  • กำหนด Resource Limit แยกกัน

ได้ตามแนวทาง Microservices


#11. OpenShift กับ DevSecOps

Cloud Native Platform ที่ใช้งานในองค์กรไม่ได้สนใจเฉพาะ Deployment แต่ต้องคำนึงถึง Security ตั้งแต่ต้น

ตัวอย่าง Pipeline

Source Code
   ↓
Unit Test
   ↓
SAST
   ↓
Dependency Scan
   ↓
Build Image
   ↓
Container Scan
   ↓
Push Registry
   ↓
Deploy
   ↓
Runtime Monitoring

จึงสามารถผสานแนวคิด DevSecOps เข้าไปใน Software Delivery Lifecycle ได้


#12. OpenShift กับ Hybrid Cloud

จุดเด่นของ OpenShift คือการออกแบบให้ Application Platform มีรูปแบบการทำงานสอดคล้องกันในหลาย Infrastructure

ตัวอย่าง

                 OpenShift Platform

 ┌────────────┬────────────┬────────────┐
 │ On-Premise │ Public     │ Edge       │
 │ Datacenter │ Cloud      │            │
 └────────────┴────────────┴────────────┘

      AWS | Azure | GCP | VMware | Bare Metal

องค์กรจึงสามารถวาง Workload ตามข้อกำหนดด้าน

  • Cost
  • Security
  • Compliance
  • Performance
  • Data Residency
  • Availability

ได้


#13. ตัวอย่าง Developer Workflow

Developer สร้าง Application เช่น

Node.js API

สร้าง Containerfile

FROM registry.access.redhat.com/ubi9/nodejs-20

WORKDIR /opt/app-root/src

COPY package*.json ./

RUN npm ci

COPY . .

CMD ["npm", "start"]

จากนั้น Build Image

podman build -t demo-api:1.0 .

Login OpenShift

oc login https://api.example.com:6443

สร้าง Project

oc new-project demo

Deploy Application

oc new-app demo-api:1.0

ตรวจสอบ Pod

oc get pods

ดู Service

oc get svc

Expose Application

oc expose service demo-api

ดู Route

oc get route

Workflow พื้นฐานจึงคล้าย Kubernetes แต่ OpenShift เพิ่ม abstraction และ tooling เพื่อช่วย Developer


#14. OpenShift CLI

คำสั่ง oc เป็น CLI หลักของ OpenShift

ตัวอย่างคำสั่ง

oc login
oc project
oc get pods
oc get deployments
oc get services
oc get routes
oc logs
oc describe
oc apply
oc delete

หลายคำสั่งมีรูปแบบเดียวกับ kubectl

เช่น

kubectl get pods

และ

oc get pods

#15. OpenShift เหมาะกับใคร

OpenShift เหมาะกับองค์กรที่มีความต้องการ เช่น

  • ใช้ Kubernetes ระดับ Enterprise
  • มีหลาย Development Teams
  • ต้องการ Standard Platform
  • ต้องการ Governance
  • ต้องการ DevSecOps
  • ต้องการ Hybrid Cloud
  • ต้องการ GitOps
  • ต้องการ Self-Service Developer Platform
  • มีระบบ Microservices จำนวนมาก
  • ต้องการ Enterprise Support

#16. ตัวอย่าง Use Cases

#Modernize Legacy Application

Monolith
   ↓
Containerize
   ↓
Deploy OpenShift
   ↓
Extract Services
   ↓
Microservices

#Microservices Platform

Microservices
     ↓
Containers
     ↓
OpenShift

#DevOps Platform

Git
 ↓
CI/CD
 ↓
Container Registry
 ↓
OpenShift

#GitOps Platform

Git
 ↓
Argo CD
 ↓
OpenShift

#AI / ML Platform

Model
 ↓
Inference Container
 ↓
OpenShift
 ↓
GPU / CPU Infrastructure

#17. Cloud Native Maturity Roadmap

แนวทางเรียนรู้สามารถแบ่งได้เป็นลำดับ

Linux
 ↓
Git
 ↓
Containers
 ↓
Docker / Podman
 ↓
Kubernetes
 ↓
OpenShift
 ↓
CI/CD
 ↓
GitOps
 ↓
Observability
 ↓
DevSecOps
 ↓
Platform Engineering

สำหรับผู้เริ่มต้น ไม่ควรเริ่มจาก OpenShift โดยไม่เข้าใจ Kubernetes เพราะ Resource และแนวคิดสำคัญจำนวนมากของ OpenShift มีพื้นฐานมาจาก Kubernetes


#18. Workshop Roadmap

สามารถแบ่ง Workshop เป็น 8 ขั้นตอน

#Workshop 1 — Container

สร้าง Application และ Container Image

podman build -t demo-app .

#Workshop 2 — Kubernetes Fundamentals

เรียนรู้

Pod
Deployment
Service
ConfigMap
Secret
PVC
Ingress

#Workshop 3 — OpenShift Fundamentals

เรียนรู้

Project
Route
Build
ImageStream
Security
Operator

#Workshop 4 — Deploy Application

oc new-project workshop

oc apply -f deployment.yaml
oc apply -f service.yaml
oc expose service demo-app

#Workshop 5 — CI/CD

GitHub
 ↓
Pipeline
 ↓
Build
 ↓
Image
 ↓
OpenShift

#Workshop 6 — GitOps

Git
 ↓
Argo CD
 ↓
OpenShift

#Workshop 7 — Observability

ศึกษา

Metrics
Logs
Traces
Alerts
Dashboards

#Workshop 8 — DevSecOps

เพิ่ม

SAST
Dependency Scan
Container Scan
Policy
Runtime Security

#19. สรุป

ความสัมพันธ์สามารถสรุปได้ดังนี้

Cloud Native
     │
     ├── Containers
     ├── Microservices
     ├── DevOps
     ├── Automation
     ├── Observability
     └── Declarative Infrastructure
              │
              ▼
         Kubernetes
              │
              ▼
          OpenShift
              │
     ┌────────┼────────┐
     │        │        │
   GitOps  Security  Developer
                    Platform

Cloud Native คือแนวคิดและรูปแบบการสร้างระบบสมัยใหม่

Kubernetes เป็นหนึ่งในเทคโนโลยีหลักของ Cloud Native สำหรับจัดการ Container

OpenShift นำ Kubernetes มาเป็นแกนกลางและต่อยอดเป็น Application Platform ที่รวมเครื่องมือด้าน Development, Operations, Security, GitOps และ Hybrid Cloud

ดังนั้น หากต้องการวางเส้นทางการเรียนรู้ให้เป็นระบบ สามารถใช้ลำดับ

Container
   ↓
Kubernetes
   ↓
OpenShift
   ↓
CI/CD
   ↓
GitOps
   ↓
Observability
   ↓
DevSecOps
   ↓
Platform Engineering

แนวทางนี้จะช่วยให้เข้าใจว่า OpenShift ไม่ใช่เพียง “Kubernetes อีกตัวหนึ่ง” แต่เป็น Platform สำหรับนำแนวคิด Cloud Native Software Delivery ไปใช้งานในระดับองค์กร


#References