一、replicaSet介绍
二、RS案例
vim rs.yaml ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ apiVersion: extensions/v1beta1 kind: ReplicaSet metadata: name: frontend spec: replicas: 3 selector: matchLabels: tier: frontend #指定RS的绑定的标签。 template: #以下为嵌套pod的字段; metadata: labels: tier: frontend spec: containers: - name: php-redis image: hub.atguigu.com/library/gb-frontend:v4 #gcr.io/google-samples/gb-frontend:v4镜像; env: #注入环境变量; - name: GET_HOSTS_FROM value: dns ports: - containerPort: 80 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kubectl apply -f rs.yaml kubectl delete pod --all #删除所有pod;此时自主式pod不会重建,控制器管理的pod会自动重建; kubectl get pod --show-labels #查看自动重建的pod,并显示pod标签; kubectl label pod frontend-dvnfl tier=frontend1 --overwrite=true #修改pod的label,该pod则不会被RS所管理而成为一个自主式pod;并会重建一个原label的pod;这就说明RS以label进行监控pod;