Last active
January 25, 2023 12:32
Revisions
-
ilyes-elajroud revised this gist
Jan 25, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ spec: secretRef: name: sc-secret volumeAttributes: clusterID: CLUSTER_ID # get infos from onecloud portal fsName: cephFS monitors: MON1:6789,MON2:6789,MON3:6789,MON4:6789,MON5:6789 # get infos from onecloud portal rootPath: /volumes/TENANT_NAME/VOLUME_NAME/VOLUME_ID # get infos from onecloud portal -
ilyes-elajroud created this gist
Jan 25, 2023 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ --- apiVersion: apps/v1 kind: Deployment metadata: name: pv-mounter spec: selector: matchLabels: app: pv-mounter template: metadata: labels: app: pv-mounter spec: imagePullSecrets: - name: harbor-bot terminationGracePeriodSeconds: 5 securityContext: fsGroup: 1000 runAsGroup: 1000 runAsNonRoot: true runAsUser: 1000 containers: - name: sandbox securityContext: allowPrivilegeEscalation: false capabilities: drop: - all privileged: false readOnlyRootFilesystem: true command: [ "/bin/sh", "-c", "--" ] args: [ "while true; do sleep 30; done;" ] image: registry-euc1.r-local.net/dockerhub/library/busybox:latest volumeMounts: - name: data mountPath: /data resources: requests: cpu: 200m memory: 180Mi limits: cpu: 300m memory: 300Mi volumes: - name: data persistentVolumeClaim: claimName: pv-mount This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ This Yamls files will help you mount a PV volume in Caas and copy a file from local machine to the PV. > Note that this type of manipulation is helpful for mac users how can't moun directly the volume due to incompatibility . ## pre-requesties - you already have a tenant - you already have a namespace - you already have a file storage created . ## Run all manifests 1. copy all the above manifests and change all the required infos 2. create all the resources within your namespaces. ``` kubectl create -f . ``` ## Copy your files You can now copy your files from local machine to the persistent volume ``` export POD_NAME=$(kubectl get pod -l app=pv-mounter -o jsonpath="{.items[0].metadata.name}") kubectl cp YOUR_FILE_OR_FOLDER $POD_NAME:/data This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ --- apiVersion: v1 data: userID: XXX # tenant name | base64 userKey: XXX # keyID | base64 kind: Secret metadata: name: sc-secret type: Opaque This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ apiVersion: storage.cpd.rakuten.com/v1 kind: StorageClaim --- metadata: name: pv-mount spec: volumeType: cephFS createdBy: ilyes.elajroud@rakuten.com # e.g. xxx.yyy@rakuten.com provisioningMode: static accessModes: - ReadWriteMany capacity: storage: 10Gi secretRef: name: sc-secret volumeAttributes: clusterID: CLUSTER_ID fsName: cephFS monitors: MON1:6789,MON2:6789,MON3:6789,MON4:6789,MON5:6789 rootPath: /volumes/TENANT_NAME/VOLUME_NAME/VOLUME_ID