核心概念

  • Pod:最小部署单元,包含一个或多个容器
  • Deployment:管理 Pod 副本数量,支持滚动更新
  • Service:为 Pod 提供稳定的网络访问入口
  • Ingress:HTTP 路由,将外部流量分发到不同 Service

部署示例

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myapp
  template:
    spec:
      containers:
      - name: myapp
        image: myapp:latest
        ports:
        - containerPort: 3000