<p>Is there a way to silence warning messages from kubectl, such as what is shown below for deprecation notices?</p>
<pre><code>Warning: rbac.authorization.k8s.io/v1beta1 ClusterRoleBinding is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 ClusterRoleBinding
Warning: rbac.authorization.k8s.io/v1beta1 RoleBinding is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 RoleBinding
Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
Warning: admissionregistration.k8s.io/v1beta1 ValidatingWebhookConfiguration is deprecated in v1.16+, unavailable in v1.22+; use admissionregistration.k8s.io/v1 ValidatingWebhookConfiguration
Warning: admissionregistration.k8s.io/v1beta1 MutatingWebhookConfiguration is deprecated in v1.16+, unavailable in v1.22+; use admissionregistration.k8s.io/v1 MutatingWebhookConfiguration
</code></pre>
<p>It appears these warnings are occurring with Kubernetes 1.19.</p>

dhelfand
<p>To add on top of the previous answer you may also want to redirect stderr output into <code>null device</code>. Its not ideal though since it will dispose all the stderr, not only warnings.</p>
<pre><code>kubectl get pod 2&gt; /dev/null
</code></pre>
<p><code>null device</code> is an device file that discards all written data. The null device is typically used for disposing of unwanted output streams of a process, or as a convenient empty file for input streams.</p>
<p>The best here would be to redirect <code>stderr</code> into <code>stdout</code> and then filter it with grep.</p>
<pre><code>kubectl get pod 2&gt;&amp;1 | grep -i -v &quot;Warn&quot; | grep -i -v &quot;Deprecat&quot; 
</code></pre>
