Kubernetes---资源控制器之ReplicationController、ReplicaSet和Deployment

1.ReplicationController和ReplicaSet介绍

  RC(ReplicationController)主要的作用就是用来确保容器应用的副本数始终保持在用户定义的副本数。即如果有容器异常退出,会自动创建新的Pod来替代;而如果异常多出来的容器也会自动回收Kubernetes 
  官方建议使用RS(Replicaset)替代RC(ReplicationController)进行部署,RS跟RC没有本质的不同,只是名字不一样,并且RS支持集合式的 selector
⒉ReplicaSet资源文件示例
apiVersion: extensions/v1beta1
kind: ReplicaSet 
metadata:
  name: frontend 
spec:
  replicas: 3 #有3个副本
  selector: #标签选择器
    matchLabels:
      tier: frontend 
  template: #模板
    metadata:
      1abels:
        tier: frontend 
    spec:
      containers:
      - name: php-redis 
        image: gcr.io/google_samples/gb-frontend:v3 
        env:
        - name: GET_HOSTS_FROM 
          value:dns 
        ports:
        - containerPort: 80

⒊Deployment介绍

猜你喜欢

转载自www.cnblogs.com/fanqisoft/p/11573598.html