0Pricing
MLOps Academy · 课时

申请 CPU、内存和 GPU

设置资源限制,让 Pod 正确调度

申请 CPU、内存和 GPU 是 CoddyKit 上的免费 MLOps Academy 课时。 这是第 2 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 MLOps Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 MLOps Academy 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

The Scheduler Needs Numbers

Kubernetes places Pods onto nodes that have room. To decide, the scheduler needs you to declare how much CPU and memory each model Pod will use.

Requests vs Limits

A request is the amount guaranteed and used for scheduling. A limit is the ceiling a container may not cross. You almost always set both.

CPU Is Measured in Millicores

CPU is counted in millicores: 1000m equals one full core. Asking for 500m means your model Pod is promised half of one CPU core.

resources:
  requests:
    cpu: "500m"
    memory: "512Mi"
  limits:
    cpu: "1"
    memory: "1Gi"

Memory Uses Mi and Gi

Memory is set in mebibytes or gibibytes, like 512Mi or 2Gi. Size it to your model plus its runtime, with a little headroom on top.

Too Low and the Pod Stays Pending

If no node can satisfy your requests, the Pod sits in Pending forever. Big GPU models often wait simply because nothing free is large enough.

OOMKilled When You Exceed Memory

Cross your memory limit and the kernel kills the container with an OOMKilled status. Right-sizing limits keeps your model server from being reaped mid-request. 💥

CPU Limits Throttle, Not Kill

Unlike memory, breaching a CPU limit does not kill the Pod. The container is just throttled, so latency climbs instead of the process dying.

GPUs Are Requested as Limits

GPUs are an extended resource. You ask for them only under limits with nvidia.com/gpu, and the value must be a whole number, never a fraction.

resources:
  limits:
    nvidia.com/gpu: 1

A GPU Is Not Time-Shared

One GPU request grabs the entire device for that Pod by default. Two Pods cannot casually share a card without special MIG or time-slicing setup.

The Device Plugin Makes GPUs Visible

Nodes only advertise GPUs after the NVIDIA device plugin runs on them. No plugin, no nvidia.com/gpu resource, and your GPU Pod stays Pending.

Right-Sizing Saves Money

Over-requesting wastes whole nodes; under-requesting risks evictions. Watching real usage and tuning requests is how you keep serving both stable and cheap.

Quick Check

What happens when a container exceeds its memory limit?

Recap

Declare requests and limits for CPU and memory, ask for whole GPUs under limits, and right-size from real usage to keep model Pods healthy. ✅

常见问题解答

「申请 CPU、内存和 GPU」课时是免费的吗?

是的 — 「申请 CPU、内存和 GPU」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 MLOps Academy 课程的其余内容,请升级到 CoddyKit PRO。 MLOps Academy 课程共包含 4 节课。

「申请 CPU、内存和 GPU」这节课中我会学到什么?

设置资源限制,让 Pod 正确调度 你通过在浏览器中直接运行的动手代码来练习 MLOps Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 MLOps Academy 需要有经验吗?

无需任何先前经验。CoddyKit 上的 MLOps Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 2 节课,共 4 节。

「申请 CPU、内存和 GPU」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 MLOps Academy 课中编写并运行代码吗?

能。每节 MLOps Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 用于模型的 Pod、部署和服务
  2. 申请 CPU、内存和 GPU
  3. 使用 ConfigMaps 和 Secrets 进行配置
  4. 将训练作为 Kubernetes 任务运行
← 返回 MLOps Academy