k get all
we can see the resources created by deployment.apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd-frontend
labels:
name: frontend
spec:
replicas: 3
selector:
matchLabels:
name: frontend
template:
metadata:
labels:
name: frontend
spec:
containers:
- name: httpd
image: httpd:2.4-alpine
<aside>
⛔ Update the kind
from Replicaset
to Deployment
in a Replicaset
config file.
</aside>
There are two deployment strategies:
When you first create a deployment, it triggers a rollout which creates the first revision of the deployment. Every subsequent update to the deployment triggers a rollout which creates a new revision of the deployment. This keeps a track of the deployment and helps us rollback to a previous version of the deployment if required.
When we upgrade the version of a deployment, a new replica set is created under the hood where the new pods are spawned while bringing down pods from the old replica set one at a time, following a rolling update strategy. We can see the new and old replica sets by running k get replicasets
k rollout status deployment <deployment-name>
- view the status of rollout for a deployment
k rollout history deployment <deployment-name>
- view the history of rollouts for a deployment
k rollout history deployment <deployment-name> --revision=1
- view the status of rollouts for a deployment revision