Pod
一句话解释
Pod 是 smallest 单元 in Kubernetes 那个能 是创建 and deployed, 包含 one or 更多容器.
用大白话说
A Pod is the basic building block of Kubernetes. It is the smallest unit that Kubernetes can manage. A Pod contains one or more containers that share the same network and storage.
Most commonly, a Pod contains just a single container. But sometimes you might have a Pod with multiple containers that work closely together — for example, a web server container and a sidecar container that logs its output.
Think of a Pod as a single "实例" of your application. When you scale up, Kubernetes creates more Pods. When a Pod dies, Kubernetes creates a new one to replace it. Pods are ephemeral — they are created and destroyed, not updated in place.
示例
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80这个定义单个 Pod 运行 nginx 容器 listening on port 80.
工作原理
- You define a Pod (usually via a Deployment) in YAML.
- Kubernetes schedules the Pod onto a node with available resources.
- The Pod's containers start and share the same network namespace.
- If the Pod's main container exits, the Pod is considered failed.
常见混淆
容易混淆的对象: 容器
关键区别: 容器是 Docker 概念; Pod 是 Kubernetes wrapper 那个能 持有 one or 更多容器 sharing network and storage.
相关术语
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。