---
title: "创建资源配额"
method: POST
path: "/api/v1/k8s/cluster/{id}/namespaces/{namespaceName}/resourcequotas"
tags: ["K8s命名空间管理"]
---

# 创建资源配额

`POST /api/v1/k8s/cluster/{id}/namespaces/{namespaceName}/resourcequotas`

为指定命名空间创建资源配额

## Path parameters

- `id` integer, required
- `namespaceName` string, required

## Request body

- ModelCreateResourceQuotaRequest
  - `hard` object, required — 硬限制
  - `name` string, required — ResourceQuota名称
  - `scopeSelector` object — 作用域选择器
  - `scopes` string[] — 作用域

## Response `200`

创建成功

- object
  - `code` integer — 状态码
  - `data` object — 返回的数据
    - `cpuQuota` ModelQuotaInfo
      - `hard` string — 限制值
      - `used` string — 已使用值
    - `createdAt` string — 创建时间
    - `hard` object — 硬限制
    - `memoryQuota` ModelQuotaInfo
      - `hard` string — 限制值
      - `used` string — 已使用值
    - `name` string — ResourceQuota名称
    - `storageQuota` ModelQuotaInfo
      - `hard` string — 限制值
      - `used` string — 已使用值
    - `used` object — 已使用
  - `message` string — 提示信息

## Other responses

- `400` — 参数错误
- `404` — 命名空间不存在
- `500` — 服务器错误

---

[API](https://skmtc.dev/opsre/apis/devops.md) · [All operations](https://skmtc.dev/opsre/apis/devops/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/opsre/devops/revisions/25cac8835c4c/schema)
