<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>kubectl &amp;mdash; LinuxPizza</title>
    <link>https://blogs.linux.pizza/tag:kubectl</link>
    <description>Personal notes and occasional posts - 100% human, 0% AI generated</description>
    <pubDate>Tue, 14 Apr 2026 12:04:09 +0000</pubDate>
    <item>
      <title>Kubectl cheat-sheet</title>
      <link>https://blogs.linux.pizza/kubectl-cheat-sheet</link>
      <description>&lt;![CDATA[## Just some random #kubectl commands for myself. I have tested these on 1.20  1.25&#xA;&#xA;Get all ingress logs (if your ingress is nginx)&#xA;kubectl logs -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx&#xA;Get all logs from Deployment&#xA;kubectl logs deployment/deployment -n namespace --watch&#xA;Why is the pod stuck in &#34;ContainerCreating&#34;?&#xA;kubectl get events --sort-by=.metadata.creationTimestamp --watch&#xA;Restart your deployment, nice and clean&#xA;kubectl rollout restart deployment/deployment -n namespace&#xA;Check which namespaces are using the most disk space&#xA;kubectl get namespace --no-headers | xargs -I {} sh -c &#39;echo {}; kubectl get pods -n {} --no-headers | xargs -I {} sh -c &#34;kubectl logs {} -n {} | wc -c&#34;&#39; | awk &#39;{print $1&#34; &#34;($2/1024/1024)&#34; MB&#34;}&#39; | sort -k2 -n -r | head&#xA;Check if any pods are using a lot of disk space&#xA;kubectl get pods --all-namespaces -o json | jq &#39;.items[].spec.containers[].resources.requests.storage&#39; | grep -v null&#xA;Check the Kubernetes event logs for any disk-related errors&#xA;&#xA;kubectl get events --field-selector involvedObject.kind=Node,reason=OutOfDisk&#xA;&#xA;I&#39;ll add more when I find more usefull stuff&#xA;&#xA;#linux #k8s #kubernetes #kubectl #ingress #nginx #deployment #logs]]&gt;</description>
      <content:encoded><![CDATA[<h2 id="just-some-random-kubectl-commands-for-myself-i-have-tested-these-on-1-20-1-25" id="just-some-random-kubectl-commands-for-myself-i-have-tested-these-on-1-20-1-25">Just some random <a href="https://blogs.linux.pizza/tag:kubectl" class="hashtag"><span>#</span><span class="p-category">kubectl</span></a> commands for myself. I have tested these on 1.20 &lt;&gt; 1.25</h2>

<h4 id="get-all-ingress-logs-if-your-ingress-is-nginx" id="get-all-ingress-logs-if-your-ingress-is-nginx">Get all ingress logs (if your ingress is nginx)</h4>

<pre><code>kubectl logs -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx
</code></pre>

<h4 id="get-all-logs-from-deployment" id="get-all-logs-from-deployment">Get all logs from Deployment</h4>

<pre><code>kubectl logs deployment/&lt;deployment&gt; -n &lt;namespace&gt; --watch
</code></pre>

<h4 id="why-is-the-pod-stuck-in-containercreating" id="why-is-the-pod-stuck-in-containercreating">Why is the pod stuck in “ContainerCreating”?</h4>

<pre><code>kubectl get events --sort-by=.metadata.creationTimestamp --watch
</code></pre>

<h4 id="restart-your-deployment-nice-and-clean" id="restart-your-deployment-nice-and-clean">Restart your deployment, nice and clean</h4>

<pre><code>kubectl rollout restart deployment/&lt;deployment&gt; -n &lt;namespace&gt;
</code></pre>

<h4 id="check-which-namespaces-are-using-the-most-disk-space" id="check-which-namespaces-are-using-the-most-disk-space">Check which namespaces are using the most disk space</h4>

<pre><code>kubectl get namespace --no-headers | xargs -I {} sh -c &#39;echo {}; kubectl get pods -n {} --no-headers | xargs -I {} sh -c &#34;kubectl logs {} -n {} | wc -c&#34;&#39; | awk &#39;{print $1&#34; &#34;($2/1024/1024)&#34; MB&#34;}&#39; | sort -k2 -n -r | head
</code></pre>

<h4 id="check-if-any-pods-are-using-a-lot-of-disk-space" id="check-if-any-pods-are-using-a-lot-of-disk-space">Check if any pods are using a lot of disk space</h4>

<pre><code>kubectl get pods --all-namespaces -o json | jq &#39;.items[].spec.containers[].resources.requests.storage&#39; | grep -v null
</code></pre>

<h4 id="check-the-kubernetes-event-logs-for-any-disk-related-errors" id="check-the-kubernetes-event-logs-for-any-disk-related-errors">Check the Kubernetes event logs for any disk-related errors</h4>

<pre><code>kubectl get events --field-selector involvedObject.kind=Node,reason=OutOfDisk
</code></pre>

<p>I&#39;ll add more when I find more usefull stuff</p>

<p><a href="https://blogs.linux.pizza/tag:linux" class="hashtag"><span>#</span><span class="p-category">linux</span></a> <a href="https://blogs.linux.pizza/tag:k8s" class="hashtag"><span>#</span><span class="p-category">k8s</span></a> <a href="https://blogs.linux.pizza/tag:kubernetes" class="hashtag"><span>#</span><span class="p-category">kubernetes</span></a> <a href="https://blogs.linux.pizza/tag:kubectl" class="hashtag"><span>#</span><span class="p-category">kubectl</span></a> <a href="https://blogs.linux.pizza/tag:ingress" class="hashtag"><span>#</span><span class="p-category">ingress</span></a> <a href="https://blogs.linux.pizza/tag:nginx" class="hashtag"><span>#</span><span class="p-category">nginx</span></a> <a href="https://blogs.linux.pizza/tag:deployment" class="hashtag"><span>#</span><span class="p-category">deployment</span></a> <a href="https://blogs.linux.pizza/tag:logs" class="hashtag"><span>#</span><span class="p-category">logs</span></a></p>
]]></content:encoded>
      <guid>https://blogs.linux.pizza/kubectl-cheat-sheet</guid>
      <pubDate>Tue, 28 Feb 2023 08:04:47 +0000</pubDate>
    </item>
  </channel>
</rss>