---
title: "更新PV"
method: PUT
path: "/k8s/cluster/{id}/pvs/{pvName}"
tags: ["K8s存储管理-PV"]
---

# 更新PV

`PUT /k8s/cluster/{id}/pvs/{pvName}`

更新指定的PV配置

## Path parameters

- `id` integer, required
- `pvName` string, required

## Headers

- `Authorization` string, required

## Request body

- ModelUpdatePVRequest
  - `labels` object — 标签
  - `mountOptions` string[] — 挂载选项
  - `reclaimPolicy` string — 回收策略

## Response `200`

OK

- object
  - `code` integer — 状态码
  - `data` object — 返回的数据
    - `accessModes` string[] — 访问模式
    - `capacity` string — 总量
    - `claimRef` ModelPVClaimRef
      - `apiVersion` string — API版本
      - `kind` string — 类型
      - `name` string — 名称
      - `namespace` string — 命名空间
      - `uid` string — UID
    - `createdAt` string — 创建时间
    - `labels` object — 标签
    - `mountOptions` string[] — 挂载选项
    - `name` string — PV名称
    - `nodeAffinity` ModelPVNodeAffinity
      - `required` ModelPVNodeSelector
        - `nodeSelectorTerms` ModelPVNodeSelectorTerm[] — 节点选择器条件
          - `matchExpressions` ModelPVNodeSelectorRequirement[] — 匹配表达式
            - `key` string — 键
            - `operator` string — 操作符
            - `values` string[] — 值
          - `matchFields` ModelPVNodeSelectorRequirement[] — 匹配字段
            - `key` string — 键
            - `operator` string — 操作符
            - `values` string[] — 值
    - `persistentVolumeSource` ModelPVSource
      - `awsElasticBlockStore` ModelPVAWSElasticBlockStoreVolumeSource
        - `fsType` string — 文件系统类型
        - `partition` integer — 分区
        - `readOnly` boolean — 只读
        - `volumeID` string — 卷ID
      - `csi` ModelPVCSIVolumeSource
        - `driver` string — 驱动名称
        - `fsType` string — 文件系统类型
        - `readOnly` boolean — 只读
        - `volumeAttributes` object — 卷属性
        - `volumeHandle` string — 卷句柄
      - `hostPath` ModelPVHostPathVolumeSource
        - `path` string — 主机路径
        - `type` string — 类型
      - `iscsi` ModelPVISCSIVolumeSource
        - `fsType` string — 文件系统类型
        - `iqn` string — IQN
        - `iscsiInterface` string — iSCSI接口
        - `lun` integer — LUN
        - `portals` string[] — 门户列表
        - `readOnly` boolean — 只读
        - `targetPortal` string — 目标门户
      - `local` ModelPVLocalVolumeSource
        - `fsType` string — 文件系统类型
        - `path` string — 本地路径
      - `nfs` ModelPVNFSVolumeSource
        - `path` string — NFS路径
        - `readOnly` boolean — 只读
        - `server` string — NFS服务器
    - `reclaimPolicy` string — 回收策略 Retain/Delete/Recycle
    - `status` string — 状态 Available/Bound/Released/Failed
    - `storageClass` string — 存储类型
    - `volumeMode` 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)
