// Aula 20 - Deployments https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ # vim kuard-deployment.yaml # kuard-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: kuard labels: app: kuard spec: replicas: 1 selector: matchLabels: run: kuard template: metadata: labels: run: kuard spec: containers: - name: kuard image: gcr.io/kuar-demo/kuard-amd64:blue ports: - containerPort: 80 # kubectl create -f kuard-deployment.yaml # kubectl get deployments kuard -o jsonpath --template {.spec.selector.matchLabels} # kubectl get replicasets --selector=run=kuard # kubectl scale deployments kuard --replicas=2 # kubectl get replicasets --selector=run=kuard # kubectl scale deployments kuard --replicas=1 # kubectl get replicasets --selector=run=kuard # kubectl describe deployment kuard spec: replicas: 4 # kubectl apply -f kuard-deployment.yaml image: gcr.io/kuar-demo/kuard-amd64:green imagePullPolicy: Always # kubectl apply -f kuard-deployment.yaml https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ metadata: ... annotations: kubernetes.io/change-cause: "Alterando de green para kuard" # kubectl apply -f kuard-deployment.yaml # kubectl rollout status deployment kuard # kubectl get replicasets -o wide # kubectl rollout pause deployments kuard # kubectl rollout resume deployments kuard # kubectl rollout history deployments kuard # kubectl rollout history deployment kuard --revision=4 annotations: kubernetes.io/change-cause: "Alterando de blue para kuard" spec: containers: - name: kuard image: gcr.io/kuar-demo/kuard-amd64:blue # kubectl apply -f kuard-deployment.yaml # kubectl rollout history deployments kuard # kubectl rollout undo deployments kuard # kubectl get replicasets -o wide # kubectl rollout history deployments kuard # kubectl rollout undo deployments kuard --to-revision=6 # kubectl delete deployments kuard # kubectl delete -f kuard-deployment.yaml