
上QQ阅读APP看书,第一时间看更新
Replica sets
As discussed earlier, replica sets are the new and improved version of replication controllers. They take advantage of set-based label selection, but they are still considered beta at time of this writing.
Here is an example of a ReplicaSet based on and similar to the ReplicationController in listing 2-4:
apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
name: node-js-rs
spec:
replicas: 3
selector:
matchLabels:
app: node-js-express
deployment: test
matchExpressions:
- {key: name, operator: In, values: [node-js-rs]}
template:
metadata:
labels:
name: node-js-rs
app: node-js-express
deployment: test
spec:
containers:
- name: node-js-rs
image: jonbaier/node-express-info:latest
ports:
- containerPort: 80
Listing 2-6: nodejs-labels-replicaset.yaml