Background
When setting up my bare-metal Kubernetes cluster I initially used a NFS provisioner with a Windows NFS share for my PV, however Windows NFS shares often cause more issues than they solve. Given this I decided to use CIFS as a work around.
Setup
In order to use CIFS mounts on Kubernetes there are a few things you need to do on each node, including the master.
First install the required packages on each node
sudo apt install cifs-utils jq
On all nodes run the following command
VOLUME_PLUGIN_DIR="/usr/libexec/kubernetes/kubelet-plugins/volume/exec"
mkdir -p "$VOLUME_PLUGIN_DIR/fstab~cifs"
cd "$VOLUME_PLUGIN_DIR/fstab~cifs"
curl -L -O https://raw.githubusercontent.com/fstab/cifs/master/cifs
chmod 755 cifs
Check if the installation was successful with the following command on each node
VOLUME_PLUGIN_DIR="/usr/libexec/kubernetes/kubelet-plugins/volume/exec"
$VOLUME_PLUGIN_DIR/fstab~cifs/cifs init
Kubectl Commands
Create base64 encoded credentials for share
echo -n username | base64
echo -n password | base64
Create a secret.yml file and replace username and password with the aboved hashed output
apiVersion: v1
kind: Secret
metadata:
name: cifs-secret
namespace: default
type: fstab/cifs
data:
username: 'ZXhhbXBsZQ=='
password: 'bXktc2VjcmV0LXBhc3N3b3Jk'
Apply Kubernetes secret
kubectl apply -f secret.yml
Kubernetes Deployment
I have included a sample deployment of Organizr, more information about Organizr can be found here https://github.com/causefx/Organizr.