---
title: "更新Deployment"
method: PUT
path: "/k8s/cluster/{id}/namespaces/{namespaceName}/deployments/{deploymentName}"
tags: ["Deployment管理"]
---

# 更新Deployment

`PUT /k8s/cluster/{id}/namespaces/{namespaceName}/deployments/{deploymentName}`

更新指定的Deployment配置

## Path parameters

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

## Headers

- `Authorization` string, required

## Request body

- ModelUpdateWorkloadRequest
  - `labels` object — 标签
  - `strategy` unknown
  - `template` ModelPodTemplateSpec
    - `containers` ModelContainerSpec[], required — 容器规格
      - `args` string[] — 启动参数
      - `command` string[] — 启动命令
      - `env` ModelEnvVar[] — 环境变量
        - `name` string — 变量名
        - `value` string — 变量值
      - `image` string, required — 镜像
      - `name` string, required — 容器名称
      - `ports` ModelContainerPort[] — 端口配置
        - `containerPort` integer — 容器端口
        - `name` string — 端口名称
        - `protocol` string — 协议
      - `resources` ModelWorkloadResources
        - `limits` ModelResourceSpec
          - `cpu` string — CPU
          - `memory` string — 内存
        - `requests` ModelResourceSpec
          - `cpu` string — CPU
          - `memory` string — 内存
      - `volumeMounts` ModelVolumeMount[] — 存储卷挂载
        - `mountPath` string, required — 挂载路径
        - `name` string, required — 卷名称
        - `readOnly` boolean — 只读模式
    - `labels` object — Pod标签
    - `nodeSelector` object — 节点选择器
    - `tolerations` ModelToleration[] — 容忍度
      - `effect` string — 效果
      - `key` string — 键
      - `operator` string — 操作符
      - `value` string — 值
    - `volumes` ModelVolumeSpec[] — 存储卷规格
      - `config` object — 卷配置
      - `name` string, required — 卷名称
      - `type` string, required — 卷类型

## Response `200`

OK

- object
  - `code` integer — 状态码
  - `data` object — 返回的数据
    - `createdAt` string — 创建时间
    - `images` string[] — 镜像列表
    - `labels` object — 标签
    - `name` string — 名称
    - `namespace` string — 命名空间
    - `readyReplicas` integer — 就绪副本数
    - `replicas` integer — 副本数
    - `resources` ModelWorkloadResources
      - `limits` ModelResourceSpec
        - `cpu` string — CPU
        - `memory` string — 内存
      - `requests` ModelResourceSpec
        - `cpu` string — CPU
        - `memory` string — 内存
    - `status` string — 状态
    - `type` 'Deployment' | 'StatefulSet' | 'DaemonSet' | 'Job' | 'CronJob' | 'Pod'
    - `updatedAt` string — 更新时间
  - `message` string — 提示信息

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — Not Found
- `500` — Internal Server Error

---

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