{"id":9032,"date":"2024-08-31T06:24:27","date_gmt":"2024-08-31T06:24:27","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=9032"},"modified":"2024-09-04T06:43:51","modified_gmt":"2024-09-04T06:43:51","slug":"pod-is-scheduled-on-a-gpu-how-to-identify-in-kubernetes","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/pod-is-scheduled-on-a-gpu-how-to-identify-in-kubernetes\/","title":{"rendered":"Pod is Scheduled on a GPU: How to Identify in Kubernetes"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 3,395<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p>To find out which pods are scheduled on a GPU in a Kubernetes cluster, you can use the following steps:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>Use <code>kubectl<\/code> to List Pods with GPU Requests<\/strong><\/h3>\n\n\n\n<p>Kubernetes uses resource requests and limits to manage GPU allocation. To identify which pods are scheduled with GPU resources, you can filter pods based on the resource requests for GPUs.<\/p>\n\n\n\n<p>Run the following command to list all pods in a namespace (or across all namespaces) that request GPU resources:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">kubectl get pods --all-namespaces -o jsonpath=\"{range .items&#91;?(@.spec.containers&#91;*].resources.requests&#91;'nvidia.com\/gpu'])]}{.metadata.namespace}{'\\t'}{.metadata.name}{'\\n'}{end}\"<\/mark><\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>Check Pod Descriptions for GPU Requests<\/strong><\/h3>\n\n\n\n<p>Alternatively, you can describe a specific pod to see if it has GPU resources requested. This will show detailed information about the pod&#8217;s resource requests and limits, including GPUs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">kubectl describe pod &lt;pod-name&gt; -n &lt;namespace&gt;<\/mark><\/code><\/code><\/pre>\n\n\n\n<p>Look for the <code>Requests<\/code> and <code>Limits<\/code> sections under each container to see if there is a request for <code>nvidia.com\/gpu<\/code> (or another GPU resource type).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>Use <code>kubectl<\/code> with Label Filtering<\/strong><\/h3>\n\n\n\n<p>If your GPU pods are labeled (e.g., with a label like <code>gpu: true<\/code>), you can filter the pods using that label:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">kubectl get pods -l gpu=true --all-namespaces<\/mark><\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>Check Node Resources for GPU Pods<\/strong><\/h3>\n\n\n\n<p>You can also check the nodes in the cluster to see which pods have consumed GPU resources. Run the following command to list all nodes and the status of their allocated resources:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">kubectl describe nodes | grep -A 10 Allocated<\/mark><\/code><\/code><\/pre>\n\n\n\n<p>This will show the GPU allocation status of each node, which indirectly gives you information about which nodes have GPU-allocated pods.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>Use a Monitoring Tool or Dashboard<\/strong><\/h3>\n\n\n\n<p>If you have monitoring tools like <strong>Prometheus<\/strong>, <strong>Grafana<\/strong>, or the <strong>Kubernetes Dashboard<\/strong> installed, you can visualize GPU utilization and see which pods are using GPUs through those interfaces.<\/p>\n\n\n\n<p>Would you like a more detailed explanation of any of these steps?<\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>To simply discover which types of pods are easily scheduled on the <a href=\"https:\/\/www.infinitivehost.com\/gpu-dedicated-server\"><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\"><strong>best GPU dedicated server<\/strong><\/mark><\/a> in a Kubernetes cluster, simply follow all the above-mentioned steps properly. Kubernetes utilizes requests for resources and restrictions to handle the allocation of GPUs. To find which pods are simply scheduled with crucial GPU resources, you can easily filter pods according to the resource requests for GPU servers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>3,395 Views To find out which pods are scheduled on a GPU in a Kubernetes cluster, you can use the following steps: 1. Use kubectl to List Pods with GPU Requests Kubernetes uses resource requests and limits to manage GPU allocation. To identify which pods are scheduled with GPU resources, you can filter pods based [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[202],"tags":[],"class_list":["post-9032","post","type-post","status-publish","format-standard","hentry","category-gpu-server"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/9032","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=9032"}],"version-history":[{"count":2,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/9032\/revisions"}],"predecessor-version":[{"id":9056,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/9032\/revisions\/9056"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=9032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=9032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=9032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}