<p>In the book <a href="https://www.goodreads.com/book/show/26759355-kubernetes" rel="nofollow noreferrer">Kubernetes: Up &amp; Running</a>, on the section "Creating Deployments", it has a yaml file that is being used for deployments that starts like this:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations: 
    deployment.kubernetes.io/revision: "1"
</code></pre>

<p>What's the point of setting up <code>deployment.kubernetes.io/revision: "1"</code>?</p>

<p>This is a file that is going to be applied, not the result of querying the server.</p>

<p>This annotation is set by Kubernetes. It is required for deployment to identify it's respective Replicaset.</p>

<p>Ok, let me explain. A Deployment creates Replicaset. This Replicaset is responsible for creating Pod's.</p>

<p>Whenever, you made some changes in deployment's podTemplate, it creates a new replicaset. But it don't delete old replicaset as it is necessary if you want to rollback to a previous version.</p>

<p>Now, how deployment will know which replicaset is currently being used? Here comes the <code>deployment.kubernetes.io/revision:</code> annotation. Replicaset also contains this annotation. So, deployment know which replicaset is being used by matching revision number of it's annotation with the revision number of replicaset's annotation.</p>

<p>You can read this nice article to understand more: <a href="https://thenewstack.io/kubernetes-deployments-work/" rel="noreferrer">How Kubernetes Deployments Work</a>.</p>

<p>To know how to rollback deploymment to a previous version, see <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-back-to-a-previous-revision" rel="noreferrer">here</a>.</p>
