Demo:一起检查 Deployment 和 Service
Kubernetes YAML 按 namespace、label、selector 和端口组织后更容易 review。预览能在 kubectl apply 前发现 label 不匹配。
- 对比 Service selector 和 Pod template labels。
- 发布 review 时检查 image tag 和 pull policy。
- 把 resource requests/limits 和 replica 数放在一起看。
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
selector:
matchLabels: {app: api}
template:
metadata:
labels: {app: api}