title: What is the recommended way to get the pods of a Kubernetes deployment?
body: <p>Especially considering all the asynchronous procedures involved with creating and updating a deployment, I find it difficult to reliably find the current pods associated with the current version of a given deployment.</p>
  
  <p>Currently, I do:</p>
  
  <ol>
  <li>Add unique labels to the deployment's template.</li>
  <li>Get the revision number of the deployment.</li>
  <li>Get all replica sets with the labels.</li>
  <li>Filter them further to find the one with the correct revision number.</li>
  <li>Extract the pod template hash from the replica set.</li>
  <li>Get all pods with the labels plus the pod template hash.</li>
  </ol>
  
  <p>This is awkward and complex.  Besides, I am not sure that (4) and (6) are guaranteed to yield only the wanted objects.  But I cannot filter by ownerReferences, can I?</p>
  
  <p>Is there a more robust and simpler way?</p>