<p>Not sure how but I've got numerous pods running that seem to be due to multiple repliacasets for each deployment. </p>

<p>This occurred after I did some heavy editing of multiple deployments.</p>

<p>Is there some easy way of deleting orphaned replica sets? As opposed to manually inspecting each, and determining if it matches with a deployment, and then delete it?</p>

<p><code>revisionHistoryLimit</code> is an optional field that specifies the number of old ReplicaSets to retain to allow rollback</p>

<p>By <code>default, 10 old ReplicaSets</code> will be kept, change it to one so you dont have more than one old replicaset.</p>

<p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#revision-history-limit" rel="noreferrer">Offical Link</a></p>

<p><strong>Tested the field as below</strong> </p>

<p>Created NGINX deployment updated multiple times and generate few replicaset as listed below</p>

<pre><code>$ kubectl get all
NAME                         READY   STATUS    RESTARTS   AGE
pod/nginx-854998f596-6jtth   1/1     Running   0          18s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    &lt;none&gt;        443/TCP   9d

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/nginx   1/1     1            1           6m20s

NAME                               DESIRED   CURRENT   READY   AGE
replicaset.apps/nginx-59d5958c9f   0         0         0       4m5s
replicaset.apps/nginx-669cf47c4f   0         0         0       94s
replicaset.apps/nginx-6ff549666b   0         0         0       2m21s
replicaset.apps/nginx-854998f596   1         1         1       2m7s
replicaset.apps/nginx-966c7f84     0         0         0       108s
</code></pre>

<p><strong>Edit the running deployment and update revisionHistoryLimit field and set to zero</strong> as <code>revisionHistoryLimit: 0</code></p>

<pre><code>$ kubectl edit deployments.apps nginx
deployment.apps/nginx edited
</code></pre>

<p><strong>Old Replica set are removed.</strong></p>

<pre><code>$ kubectl get all
NAME                         READY   STATUS    RESTARTS   AGE
pod/nginx-854998f596-6jtth   1/1     Running   0          52s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    &lt;none&gt;        443/TCP   9d

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/nginx   1/1     1            1           6m54s

NAME                               DESIRED   CURRENT   READY   AGE
replicaset.apps/nginx-854998f596   1         1         1       2m41s
</code></pre>
