<p>I am replacing a Kubernetes secret and I want to make sure I am catching all places in the cluster which use it.</p>
<p>Is there a way to tell without reading all deployment YAMLs using K8s or helm?</p>
<p>We have multiple services deployed on the same cluster and sharing secrets. Some using Helm, some don't.</p>

<p>You can use secrets in several different ways, it's not always bound as volume. So the most convenient way is to check the secret's namespace for all objects that could use secret in their specs.</p>
<p>For manual check here are two commands, one for checking for the certain secret name references among k8s objects, the second one helps to find the object that contains the secret reference.</p>
<pre><code>kubectl get deployments,statefulsets,daemonsets,cronjobs,jobs,pods -n namespace-name -o yaml | grep  secret_name

kubectl get deployments,statefulsets,daemonsets,cronjobs,jobs,pods -n namespace-name -o yaml | grep -i -e &quot;^ name:&quot;  -e &quot;^  kind&quot; -e secret_name
</code></pre>
<p>Annotation can be removed by <code>grep -v annotation -v last-applied</code> or probably even easier <code>grep -v &quot;\&quot;kind&quot;</code>.</p>
