由于某种原因,跨多个命名空间的一堆 pod 显示多个 pod,即使它们的部署规范指定了replicas: 1
。
例子:
NAME READY STATUS RESTARTS AGE
calibre-9569796f5-d5gt8 1/1 Running 1 2d4h
> calibre-web-d4965df64-29t9c 2/2 Running 5 2d4h < this one right here for example
jellyfin-67f58745dc-dbvss 1/1 Running 6 2d4h
但在我deployment.yml
的
spec:
replicas: 1
答案1
当列出 pod 时,该Ready
列并不表示副本,而是ready
pod 内的容器。
例如这里我正在运行带有 sidecar 的 pod,并kubectl proxy
为第二个 pod 打开:
NAME READY STATUS RESTARTS AGE
kubectl-pod 2/2 Running 2 2d19h
您会注意到,它显示我的两个容器都已准备就绪。为了检查副本数量,您必须列出您的部署:
➜ ~ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
nginx-deployment 3/3 1 3 52d
➜ ~ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-deployment-9bf6f7ddf-858hh 1/1 Running 0 52d
nginx-deployment-9bf6f7ddf-rr65g 1/1 Running 0 52d
nginx-deployment-9bf6f7ddf-wsdpb 1/1 Running 0 52d