title: Filter Kubernetes events by deployment name or label selector
body: <p>When running <code>kubectl get events</code>, is there a way to filter by events without knowing the name of the pod?</p>
  
  <p>I am trying to do this with <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/kubernetes?view=azure-devops" rel="nofollow noreferrer">Azure Pipeline's <strong>Kubectl</strong> task</a>, which is limited to passing arguments to <code>kubectl get events</code>, but does not allow subshells and pipes, so <code>grep</code> and <code>awk</code> are not available.</p>
  
  <p>I tried using <code>kubectl get events --field-selector involvedObject.name=my-microservice-name</code>, which works to an extent (i.e., for the deployment resource), but not for the pods.</p>
  
  <p>Using <code>kubectl get events --field-selector app.kubernetes.io/name=my-microservice-name</code> returns no results, despite having that label configured as seen in <code>kubectl describe pod &lt;my-microservice-name&gt;-pod-name</code>.</p>
  
  <p>Ideally if there is a way to use wildcards, such as <code>kubectl get events --field-selector involvedObject.name=*my-microservice-name*</code>, would be the best case scenario.</p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Thanks!</p>