CCE Container Storage (Everest) supports custom access keys. In this way, IAM users can use their own custom access keys to mount an OBS volume. You can use IAM to control the OBS access permissions of IAM users.
When creating an OBS volume on the console of the old edition, you need to upload the AK/SK, which are global access keys used for mounting OBS volumes. As a result, all IAM users in your account will use the same keys to mount OBS buckets as volumes, and they will have identical permissions on the buckets. However, this setting does not allow you to set different permissions for individual IAM users.
If you have uploaded the AK/SK (specifically, if paas.longaksk exists in the kube-system namespace of the cluster), you should disable the global access secret to prevent IAM users from performing unauthorized operations. This ensures that the uploaded global access secret in the console will not be used when OBS volumes are used. If you have not uploaded any AK/SK, skip this section.
To disable the global access secret, do as follows:
echo -n xxx|base64echo -n yyy|base64
Record the encoded AK and SK.
apiVersion: v1data:access.key: WE5WWVhVNU*****secret.key: Nnk4emJyZ0*****kind: Secretmetadata:name: test-usernamespace: defaultlabels:secret.kubernetes.io/used-by: csitype: cfe/secure-opaque
Specifically:
Parameter | Description |
|---|---|
access.key | A Base64-encoded AK |
secret.key | A Base64-encoded SK |
name | Secret name |
namespace | Namespace of the secret |
secret.kubernetes.io/used-by: csi | Add this label if you want to make it available on the CCE console when you create an OBS PV/PVC. |
type | Secret type. The value must be cfe/secure-opaque. When this type is used, the data entered by users is automatically encrypted. |
kubectl create -f test-user.yaml
After a secret is created using the AK/SK, you can associate the secret with the PV to be created and then use the AK/SK in the secret to mount an OBS volume.
apiVersion: v1kind: PersistentVolumemetadata:name: pv-obs-exampleannotations:pv.kubernetes.io/provisioned-by: everest-csi-provisionerspec:accessModes:- ReadWriteManycapacity:storage: 1Gicsi:nodePublishSecretRef:name: test-usernamespace: defaultdriver: obs.csi.everest.iofsType: obsfsvolumeAttributes:everest.io/obs-volume-type: STANDARDeverest.io/region: ru-moscow-1storage.kubernetes.io/csiProvisionerIdentity: everest-csi-provisionervolumeHandle: obs-normal-static-pvpersistentVolumeReclaimPolicy: DeletestorageClassName: csi-obs
Parameter | Description |
|---|---|
nodePublishSecretRef | Secret specified during the mounting.
|
fsType | File type, which can be s3fs or obsfs. If the value is s3fs, an OBS bucket is created. If the value is obsfs, an OBS parallel file system is created. |
volumeHandle | OBS volume name. |
kubectl create -f pv-example.yaml
After a PV is created, you can create a PVC and associate it with the PV.
Example YAML file for the PVC:
apiVersion: v1kind: PersistentVolumeClaimmetadata:annotations:csi.storage.k8s.io/node-publish-secret-name: test-usercsi.storage.k8s.io/node-publish-secret-namespace: defaultvolume.beta.kubernetes.io/storage-provisioner: everest-csi-provisionereverest.io/obs-volume-type: STANDARDcsi.storage.k8s.io/fstype: obsfsname: obs-secretnamespace: defaultspec:accessModes:- ReadWriteManyresources:requests:storage: 1GistorageClassName: csi-obsvolumeName: pv-obs-example
Parameter | Description |
|---|---|
csi.storage.k8s.io/node-publish-secret-name | Secret name |
csi.storage.k8s.io/node-publish-secret-namespace | Namespace of the secret |
kubectl create -f pvc-example.yaml
After the PVC is created, you can create a workload and associate it with the PVC to create volumes.
When dynamically creating an OBS volume, you can use the following method to specify a secret:
apiVersion: v1kind: PersistentVolumeClaimmetadata:annotations:csi.storage.k8s.io/node-publish-secret-name: test-usercsi.storage.k8s.io/node-publish-secret-namespace: defaulteverest.io/obs-volume-type: STANDARDcsi.storage.k8s.io/fstype: obsfsname: obs-secretnamespace: defaultspec:accessModes:- ReadWriteManyresources:requests:storage: 1GistorageClassName: csi-obs
Parameter | Description |
|---|---|
csi.storage.k8s.io/node-publish-secret-name | Secret name |
csi.storage.k8s.io/node-publish-secret-namespace | Namespace of the secret |
kubectl create -f pvc-example.yaml
After the PVC is created, you can create a workload and associate it with the PVC to create volumes.
You can use a secret of an IAM user to mount an OBS volume. Assume that a workload named obs-secret is created, the mount path in the container is /temp, and the IAM user has the CCE ReadOnlyAccess and Tenant Guest permissions. Expected outputs: Expected outputs: Expected outputs: