<p>I am trying to install my rancher(RKE) kubernetes cluster bitnami/mongodb-shared . But I couldn't create a valid PV for this helm chart.</p>
<p>The error that I am getting:
no persistent volumes available for this claim and no storage class is set</p>
<p>This is the helm chart documentation section about PersistenceVolume: <a href="https://github.com/bitnami/charts/tree/master/bitnami/mongodb-sharded/#persistence" rel="nofollow noreferrer">https://github.com/bitnami/charts/tree/master/bitnami/mongodb-sharded/#persistence</a></p>
<p>This is the StorageClass and PersistentVolume yamls that I created for this helm chart PVCs':</p>
<pre><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ssd-nfs-storage
provisioner: nope
parameters:
  archiveOnDelete: &quot;false&quot;
----------
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-pv
  labels:
    name: db-nfs
spec:
  storageClassName: ssd-nfs-storage # same storage class as pvc
  capacity:
    storage: 100Gi
  accessModes:
    - ReadWriteOnce
  nfs:
    server: 142.251.33.78 # ip addres of nfs server
    path: &quot;/bitnami/mongodb&quot; # path to directory
</code></pre>
<p>This is the PVC yaml that created by the helm chart:</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: &quot;2021-06-06T17:50:40Z&quot;
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    app.kubernetes.io/component: shardsvr
    app.kubernetes.io/instance: sam-db
    app.kubernetes.io/name: mongodb-sharded
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:labels:
          .: {}
          f:app.kubernetes.io/component: {}
          f:app.kubernetes.io/instance: {}
          f:app.kubernetes.io/name: {}
      f:spec:
        f:accessModes: {}
        f:resources:
          f:requests:
            .: {}
            f:storage: {}
        f:volumeMode: {}
      f:status:
        f:phase: {}
    manager: kube-controller-manager
    operation: Update
    time: &quot;2021-06-06T17:50:40Z&quot;
  name: datadir-sam-db-mongodb-sharded-shard1-data-0
  namespace: default
  resourceVersion: &quot;960381&quot;
  uid: c4313ed9-cc99-42e9-a64f-82bea8196629
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 8Gi
  volumeMode: Filesystem
status:
  phase: Pending
</code></pre>
<p>Can you tell me what I am missing?</p>

<p>I am giving the <code>bitnami/mongodb-sharded</code> installation instruction with NFS server on Rancher(v2.5.8).</p>
<p>I have three Centos 8 VM. One NFS server(lets we say 1.1.1.1), two k8s nodes(lets we say 8.8.8.8 and 9.9.9.9) on k8s-cluster, i am using RKE(aka Rancher K8S Engine)</p>
<ol>
<li>We will create a NFS server</li>
<li>We will bind the nodes to the NFS server</li>
<li>We will add <code>nfs-subdir-external-provisioner</code> HELM repository to the Rancher Chart Repositories</li>
<li>We will install <code>nfs-subdir-external-provisioner</code> via rancher charts</li>
<li>We will add <code>bitnami</code> HELM repo  to the Rancher Chart Repositories</li>
<li>We will install <code>mongodb-sharded</code> via Rancher charts</li>
</ol>
<hr />
<ol>
<li>Create a NFS server</li>
</ol>
<pre><code># nfs server install
dnf install nfs-utils -y
systemctl start nfs-server.service
systemctl enable nfs-server.service
systemctl status nfs-server.service
# you can verify the version
rpcinfo -p | grep nfs
# nfs deamon config: /etc/nfs.conf
# nfs mount config: /etc/nfsmount.conf
mkdir /mnt/storage
# allows creation from client
# for mongodb-sharded: /mnt/storage
chown -R nobody: /mnt/storage
chmod -R 777 /mnt/storage
# restart service again
systemctl restart nfs-utils.service
# grant access to the client 
vi /etc/exports
/mnt/storage    8.8.8.8(rw,sync,no_all_squash,root_squash)
/mnt/storage    9.9.9.9(rw,sync,no_all_squash,root_squash)
# check exporting
exportfs -arv
exportfs -s
# exporting 8.8.8.8:/mnt/storage
# exporting 9.9.9.9:/mnt/storage
</code></pre>
<hr />
<ol start="2">
<li>Bind the k8s nodes to the NFS server</li>
</ol>
<pre><code># nfs client install
dnf install nfs-utils nfs4-acl-tools -y
# see from the client shared folder
showmount -e 1.1.1.1
# create mounting folder for client
mkdir /mnt/cstorage
# mount server folder to the client folder
mount -t nfs 1.1.1.1:/mnt/storage /mnt/cstorage
# check mounted folder vis nfs
mount | grep -i nfs
# mount persistent upon a reboot
vi /etc/fstab
# add following codes
1.1.1.1:/mnt/storage /mnt/cstorage  nfs  defaults  0  0
# all done
</code></pre>
<p><strong>Bonus:</strong> Unbind nodes.</p>
<pre><code># un mount and delete from client
umount -f -l /mnt/cstorage
rm -rf /mnt/cstorage
# delete added volume from fstab
vi /etc/fstab
</code></pre>
<hr />
<ol start="3">
<li>Add nfs-subdir-external-provisioner helm repository</li>
</ol>
<p><strong>Helm Repository URL:</strong> <code>https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/</code></p>
<ul>
<li>Rancher --&gt;</li>
<li>Cluster Explorer --&gt;</li>
<li>Apps &amp; Marketplace</li>
<li>Chart Repositories --&gt;</li>
<li>Create --&gt;</li>
<li>Add url like below <a href="https://i.stack.imgur.com/WQFAa.png" rel="nofollow noreferrer">this ccreenshot</a> --&gt;</li>
<li>Save --&gt;</li>
</ul>
<hr />
<ol start="4">
<li>Install <code>nfs-subdir-external-provisioner</code> via Charts</li>
</ol>
<ul>
<li>Rancher --&gt;</li>
<li>Cluster Explorer --&gt;</li>
<li>Apps &amp; Marketplace</li>
<li>Charts --&gt;</li>
<li><a href="https://i.stack.imgur.com/5gNLH.png" rel="nofollow noreferrer">find nfs-subdir-external-provisioner chart</a> --&gt;</li>
<li>Select --&gt;</li>
<li>Give a name(like nfs-pr) --&gt;</li>
<li>Select Values YAML --&gt;</li>
<li><a href="https://i.stack.imgur.com/zKOvQ.png" rel="nofollow noreferrer">set path, server ip and StorageClass name(we will use this class name later)</a>  --&gt;</li>
<li>Install --&gt;</li>
</ul>
<hr />
<ol start="5">
<li>Add <code>bitnami</code> HELM repo to the Rancher Chart Repositories</li>
</ol>
<p>Bitnami HELM URL: <code>https://charts.bitnami.com/bitnami</code></p>
<ul>
<li>Rancher --&gt;</li>
<li>Cluster Explorer --&gt;</li>
<li>Apps &amp; Marketplace</li>
<li>Chart Repositories --&gt;</li>
<li>Create --&gt;</li>
<li>Add url like step 3's screenshot --&gt;</li>
<li>Save --&gt;</li>
</ul>
<hr />
<ol start="6">
<li>Install <code>mongodb-sharded</code> via Rancher Charts</li>
</ol>
<ul>
<li><p>Rancher --&gt;</p>
</li>
<li><p>Cluster Explorer --&gt;</p>
</li>
<li><p>Apps &amp; Marketplace</p>
</li>
<li><p>Charts --&gt;</p>
</li>
<li><p>Find <code>mongodb-sharded</code> --&gt;</p>
</li>
<li><p>Select --&gt;</p>
</li>
<li><p>Give a name(my-db) --&gt;</p>
</li>
<li><p>Select Values YAML --&gt;</p>
</li>
<li><p><a href="https://i.stack.imgur.com/IpCKF.png" rel="nofollow noreferrer">Add global.storageClassname: nfs-client</a>(we set this value step 5) --&gt;</p>
</li>
<li><p>Install</p>
</li>
</ul>
