# 資源限制

## Resource limit

### 資源種類

* CPU
* Memory<br>

### 基本單位

* 1 個 cpu (Hyperthread)
  * 100m(millicpu) = 0.1 unit of cpu
* 1 bytes&#x20;
  * 500 Mi&#x20;
  * 10 Gi

### 限制型態以 container 為單位作限制

* spec.containers\[].resources.limits.cpu
* spec.containers\[].resources.limits.memory
* spec.containers\[].resources.requests.cpu
* spec.containers\[].resources.requests.memory

#### limits: 限制最高, requests: 保證最低

### 規則

`0 <= request <= Node Allocatable`

&#x20;`request` <= `limit` <= Infinity

## 在 Rancher 上設定

任一個 Application 底下，找到 Security & Host Config 下半部有 CPU, Memory Reservation 可以限制使用資源

![](/files/-LJv_7i-Gs_t-CLUIJDx)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zi-shane.gitbook.io/rancher-admin/yuan-xian-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
