Advertisement

Kubernetes 基础 Replica Set 选择器

阅读量:

前文已对RC选择器selector的使用方式进行说明,本文将进一步探讨RS(Replica Set)选择器的具体应用方式。

RS的选择器使用示例:matchLabels

RS的selector具备两种适配机制,即matchLabels与matchExpressions。在使用matchLabels的方式时,其操作方法与RC存在相似之处,例如以下RS的YAML配置示例所示:

复制代码
    [root@host131 ReplicaSet]# cat selecotr-busybox-rs.yaml 
    ---
    apiVersion: apps/v1
    kind: ReplicaSet
    metadata:
      name: test-rs
    spec:
      replicas: 1
      selector:
    matchLabels:
      app: busybox-prod
      template:
    metadata:
      name: busybox
      labels:
        app: busybox-prod
    spec:
      containers:
      - name: busybox-host
        image: busybox:

全部评论 (0)

还没有任何评论哟~