Sra*_*mar 11 replicaset kubernetes
I have created a replicaset with wrong container image with below configuration.
apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
name: rs-d33393
namespace: default
spec:
replicas: 4
selector:
matchLabels:
name: busybox-pod
template:
metadata:
labels:
name: busybox-pod
spec:
containers:
- command:
- sh
- -c
- echo Hello Kubernetes! && sleep 3600
image: busyboxXXXXXXX
name: busybox-container
Run Code Online (Sandbox Code Playgroud)
Pods Information:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
rs-d33393-5hnfx 0/1 InvalidImageName 0 11m
rs-d33393-5rt5m 0/1 InvalidImageName 0 11m
rs-d33393-ngw78 0/1 InvalidImageName 0 11m
rs-d33393-vnpdh 0/1 InvalidImageName 0 11m
Run Code Online (Sandbox Code Playgroud)
After this, i try to edit the image inside replicaset using kubectl edit replicasets.extensions rs-d33393 and update image as busybox.
Now, i am expecting pods to be recreated with proper image as part of replicaset.
This has not been the exact result.
Can someone please explain, why it is so?
Thanks :)
sur*_*ren 14
您必须ReplicaSets直接杀死旧的 Pod,以便使用正确的映像创建新的 Pod。
如果您要使用Deployment,并且您应该使用 ,则更改图像将强制重新创建 Pod。
Replicaset不支持更新。只要存在与选择器标签匹配的所需数量的 Pod,复制集的工作就完成了。你应该改用Deployment。
https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
来自文档:
要以受控方式将 Pod 更新到新规范,请使用 Deployment,因为 ReplicaSet 不支持直接滚动更新。
| 归档时间: |
|
| 查看次数: |
9433 次 |
| 最近记录: |