/costest。如下图所示:

cos-secret 为例。kube-system 命名空间下。SecretId 和 SecretKey 及其分别所对应的变量值。请参考 创建访问密钥 完成创建,并前往 API 密钥管理 页面获取访问密钥。
cos-pv 为例。cos-secret 为例(请确保 Secret 创建在 kube-system 命名空间下)。/costest 为例。若填写的子目录不存在,则系统将为您自动创建。-oensure_diskfree=20480 表示当缓存文件所在磁盘剩余空间不足 20480MB 时,COSFS 将启动失败。
cos-pvc 为例。kube-system。cos-pv 为例。
cos-vol 为例。cos-pvc 为例。/cache 为例。./data 或 data。apiVersion: v1kind: Secrettype: Opaquemetadata:name: cos-secret# Replaced by your secret namespace.namespace: kube-systemdata:# Replaced by your temporary secret file content. You can generate a temporary secret key with these docs:# Note: The value must be encoded by base64.SecretId: VWVEJxRk5Fb0JGbDA4M...(base64 encode)SecretKey: Qa3p4ZTVCMFlQek...(base64 encode)
apiVersion: v1kind: PersistentVolumemetadata:name: cos-pvspec:accessModes:- ReadWriteManycapacity:storage: 10Gicsi:driver: com.tencent.cloud.csi.cosfsnodePublishSecretRef:name: cos-secretnamespace: kube-systemvolumeAttributes:# Replaced by the url of your region.url: http://cos.ap-XXX.myqcloud.com# Replaced by the bucket name you want to use.bucket: XXX-1251707795# You can specify sub-directory of bucket in cosfs command in here.path: /costest# You can specify any other options used by the cosfs command in here.# additional_args: "-oallow_other"# Specify a unique volumeHandle like bucket name.(this value must different from other pv's volumeHandle)volumeHandle: XXXpersistentVolumeReclaimPolicy: RetainvolumeMode: Filesystem
apiVersion: v1kind: PersistentVolumeClaimmetadata:name: cos-pvcspec:accessModes:- ReadWriteManyresources:requests:storage: 1Gi# You can specify the pv name manually or just let kubernetes to bind the pv and pvc.# volumeName: cos-pv# Currently cos only supports static provisioning, the StorageClass name should be empty.storageClassName: ""
apiVersion: v1kind: Podmetadata:name: pod-cosspec:containers:- name: pod-coscommand: ["tail", "-f", "/etc/hosts"]image: "centos:latest"volumeMounts:- mountPath: /dataname: cosresources:requests:memory: "128Mi"cpu: "0.1"volumes:- name: cospersistentVolumeClaim:# Replaced by your pvc name.claimName: cos-pvc
文档反馈