Configuring file storage on IBM Cloud
Configure file storage with a daemon set on IBM Cloud with classic infrastructure.
Procedure
- Set the
DOMAIN_NAME
environment toslnfsv4.com
:export DOMAIN_NAME=slnfsv4.com
- Create a service account called
norootsquash
by running this command:cat <<EOF | oc create -f - apiVersion: v1 kind: ServiceAccount metadata: name: norootsquash namespace: kube-system EOF
- Give the service account privileged security context constraints (SCC) by running this
command:
oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:norootsquash
- Create the daemon set by running this command:
cat <<EOF | oc create -f - apiVersion: apps/v1 kind: DaemonSet metadata: name: norootsquash namespace: kube-system labels: tier: management app: norootsquash spec: selector: matchLabels: name: norootsquash template: metadata: labels: name: norootsquash spec: serviceAccountName: norootsquash initContainers: - resources: requests: cpu: 0.1 securityContext: privileged: true image: alpine:3.6 name: unrootsquash command: ["chroot", "/host", "sh", "-c"] args: - > grep "^Domain = ${DOMAIN_NAME}" /etc/idmapd.conf; if [ "\$?" -ne "0" ] ; then sed -i 's/.*Domain =.*/Domain = ${DOMAIN_NAME}/g' /etc/idmapd.conf; nfsidmap -c; rpc.idmapd fi; volumeMounts: - name: host mountPath: /host containers: - resources: requests: cpu: 0.1 image: alpine:3.6 name: sleep command: ["/bin/sh", "-c"] args: - > while true; do sleep 100000; done volumes: - hostPath: path: / type: Directory name: host EOF