Changes

Jump to navigation Jump to search

Tutorials:Mount cifs storage in a pod

2,964 bytes added, 1 year ago
Created page with "== Overview == If you have a Data Management Plan (DMP), or you have access to a custom CIFS (SMB, Samba, Windows Share) storage you want to mount in a pod please follow the..."
== Overview ==

If you have a Data Management Plan (DMP), or you have access to a custom CIFS (SMB, Samba, Windows Share) storage you want to mount in a pod please follow the steps below

== Convert your credentials to base64 encoding ==
In a terminal type:

<syntaxhighlight lang="bash">
echo -n "<Your_CIFS_Username>" | base64
$ PFlvdXJfQ0lGU19Vc2VybmFtZT4=
echo -n "<Your_CIFS_Password" | base64
$ PFlvdXJfQ0lGU19QYXNzd29yZA==
</syntaxhighlight>

Note that the output shown here is literally for the example used

== Create a secret containing your credentials to the storage ==
Having your credentials encoded in base 64, you can create a cifs_secret.yaml like shown below:
<syntaxhighlight lang="bash">
apiVersion: v1
kind: Secret
metadata:
name: cifs-secret
namespace: user-<your-username>
type: fstab/cifs
data:
username: 'PFlvdXJfQ0lGU19Vc2VybmFtZT4='
password: 'PFlvdXJfQ0lGU19QYXNzd29yZA=='
</syntaxhighlight>

You can then type:
<syntaxhighlight lang="bash">
kubectl create secret -f secret.yaml
</syntaxhighlight>

== Adding your mounting option in your pod ==

Reusing our standard example of pod, we have to modify the section volumeMounts and Volumes in our pod creation file:

<syntaxhighlight lang="bash">
apiVersion: v1
kind: Pod
metadata:
name: busybox-test-pod
spec:
containers:
- name: busybox
image: ccu-k8s.inf.uni-konstanz.de:32250/<your.username>/my_busybox # example of when we hosted our own image in the CCU repository
command: ["sleep", "1d"]
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 1
memory: 1Gi
volumeMounts:
- mountPath: /abyss/home
name: cephfs-home
readOnly: false
- mountPath: /abyss/shared
name: cephfs-shared
readOnly: false
- mountPath: /abyss/datasets
name: cephfs-datasets
readOnly: true
- mountPath: "/abyss/home/<your-already-created-mount-location-folder>" ## Add here location of where to mount the storage
name: samba-share
readOnly: false
imagePullSecrets:
- name: <A_Name_For_Your_Secret> ## Secret for accessing the CCU repository
volumes:
- name: cephfs-home
hostPath:
path: "/cephfs/abyss/home/<your-username>"
type: Directory
- name: cephfs-shared
hostPath:
path: "/cephfs/abyss/shared"
type: Directory
- name: cephfs-datasets
hostPath:
path: "/cephfs/abyss/datasets"
type: Directory
- name: samba-share ## Details of the source of the storage to be mounted
flexVolume:
driver: "fstab/cifs"
fsType: "cifs"
secretRef:
name: "cifs-secret"
options:
networkPath: "//timon.cascb.uni-konstanz.de/<Your-Storage-Folder>" # Storage address, here assumed to be part of your DMP
mountOptions: "vers=3.0,dir_mode=0755,file_mode=0644,noperm"
</syntaxhighlight>
ccu
14
edits

Navigation menu