Deployment副本控制器

Deployment:比rs更高级的控制器,除了有rs的功能之外,还有很多高级的功能,比如最重要的滚动升级、回滚等

[root@haproxy1 case3-controller]# cat deployment.yml 
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3
  selector:
    #app: ng-deploy-80 #rc
    matchLabels: #rs or deployment
      app: ng-deploy-80
    
    #matchExpressions:
    #  - {key: app, operator: In, values: [ng-deploy-80,ng-rs-81]}
  template:
    metadata:
      labels:
        app: ng-deploy-80
    spec:
      containers:
      - name: ng-deploy-80
        image: nginx:1.16.0
        ports:
        - containerPort: 80
#回滚
[root@haproxy1 case3-controller]# kubectl rollout undo deployment nginx-deployment
deployment.apps/nginx-deployment rolled back