8.2 Replica Sets控制器

ReplicaSet是下一代Replication Controller。 现在,ReplicaSet和Replication Controller之间的唯一区别是selector支持。 ReplicaSet支持标签用户指南中描述的新的基于集合的选择器要求,而Replication Controller仅支持基于等级的选择器要求。

[root@linux-node1 example]# cat nginx-rs.yaml 
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: nginx-rs
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.13.12
        ports:
        - containerPort: 80
  1. 创建RS
    [root@linux-node1 example]# kubectl create -f nginx-rs.yaml 
    replicaset.apps/nginx-rs created
    

2.查看RS

[root@linux-node1 ~]# kubectl get rs nginx-rs
NAME       DESIRED   CURRENT   READY   AGE
nginx-rs   3         3         3       5m
Copyright © 赵班长@新运维社区 2019 all right reserved,powered by Gitbook该文件修订时间: 2020-03-21 18:23:02

results matching ""

    No results matching ""