kubernetes

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Kubernetes (K8s)

Kubernetes (K8s)

Kubernetes is the standard for orchestrating containerized applications. In 2025, the Gateway API has replaced Ingress as the standard for traffic routing, and Sidecars are native.
Kubernetes是编排容器化应用的行业标准。在2025年,Gateway API已取代Ingress成为流量路由的标准,且Sidecars已成为原生功能。

When to Use

使用场景

  • Scale: You have hundreds of microservices.
  • Resilience: You need self-healing, auto-restart, and multi-zone availability.
  • Platform Building: You are building an internal platform (IDP) for developers.
  • 规模扩展:您拥有数百个微服务。
  • 弹性需求:您需要自愈、自动重启和多区域高可用能力。
  • 平台构建:您正在为开发者搭建内部开发平台(IDP)。

Quick Start (Gateway API)

快速入门(Gateway API)

yaml
undefined
yaml
undefined

Gateway (The Load Balancer)

Gateway (The Load Balancer)

apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: my-gateway spec: gatewayClassName: nginx listeners: - name: http protocol: HTTP port: 80

apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: my-gateway spec: gatewayClassName: nginx listeners: - name: http protocol: HTTP port: 80

HTTPRoute (The Routing Rule)

HTTPRoute (The Routing Rule)

apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: my-app spec: parentRefs: - name: my-gateway rules: - matches: - path: type: PathPrefix value: /api backendRefs: - name: my-service port: 8080
undefined
apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: my-app spec: parentRefs: - name: my-gateway rules: - matches: - path: type: PathPrefix value: /api backendRefs: - name: my-service port: 8080
undefined

Core Concepts

核心概念

Control Plane

控制平面

API Server, etcd, Scheduler. The brain of the cluster.
API Server、etcd、Scheduler,是集群的“大脑”。

Gateway API

Gateway API

The successor to Ingress. Split roles between Infrastructure Provider (GatewayClass), Cluster Operator (Gateway), and Developer (HTTPRoute/GRPCRoute).
Ingress的继任者。将角色拆分为基础设施提供商(GatewayClass)、集群运维人员(Gateway)和开发者(HTTPRoute/GRPCRoute)。

Custom Resource Definitions (CRDs)

自定义资源定义(CRDs)

Extend K8s API. Used by Operators (e.g., Prometheus Operator, Postgres Operator) to manage complex stateful apps.
扩展K8s API。被Operator(如Prometheus Operator、Postgres Operator)用于管理复杂的有状态应用。

Best Practices (2025)

2025年最佳实践

Do:
  • Use Gateway API: Stop writing new
    Ingress
    resources.
  • Use GitOps: ArgoCD or Flux to manage cluster state.
  • Set Requests/Limits: The scheduler needs them to bin-pack nodes efficiently.
  • Use Native Sidecars: K8s 1.29+ supports
    restartPolicy: Always
    for init containers, making sidecars first-class.
Don't:
  • Don't use
    latest
    tag
    : Always pin image versions (SHA or specific tag) for reproducibility.
推荐做法
  • 使用Gateway API:停止创建新的
    Ingress
    资源。
  • 采用GitOps:使用ArgoCD或Flux管理集群状态。
  • 设置资源请求/限制:调度器需要这些参数来高效地进行节点装箱调度。
  • 使用原生Sidecar:K8s 1.29+版本支持初始化容器的
    restartPolicy: Always
    ,使Sidecar成为一等公民。
不推荐做法
  • 不要使用
    latest
    标签
    :始终固定镜像版本(SHA或特定标签)以确保可复现性。

References

参考资料