ReplicaSet
维护一组Pod
并使Pod
数量和状态达到预期的状态。Deployment
就是基于ReplicaSet
的一层封装,官方并不建议直接使用ReplicaSet
,而是使用Deployment
。
使用下面的yaml创建对应的RS.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
replicas: 3
selector:
matchLabels:
tier: frontend
template:
metadata:
labels:
tier: frontend
spec:
containers:
- name: php-redis
image: hysyeah/my-curl:v1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
1 | type ReplicaSetController struct { |
REF:
1.pkg/controller/replicaset/replica_set.go
2.pkg/controller/controller_ref_manager.go