Configuring file storage on IBM Cloud

Configure file storage with a daemon set on IBM Cloud with classic infrastructure.

Procedure

  1. Set the DOMAIN_NAME environment to slnfsv4.com:
    export DOMAIN_NAME=slnfsv4.com
  2. 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
  3. 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
  4. 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

What to do next

Download the Guardium® Insights CASE file and set up your environment for dependencies.