k8s ReplicaSet
副本集合(ReplicaSet)的作用是,在任何时刻,都维护一个Pod对象数目固定的副本集合,这些Pod对象都相同,通常用于保证可用性。
不过,k8s官方推荐使用更高层级的概念Deployment,而不是直接用ReplicaSet。
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
# modify replicas according to your case
replicas: 3
selector:
matchLabels:
tier: frontend
template:
metadata:
labels:
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
在旧版本中,叫ReplicationController
ReplicaSet支持集合式selector

浙公网安备 33010602011771号