- Ubuntu 18.04
rootuser access
- Install dependencies:
apt update
apt install -y rpcbind nfs-common cifs-utils- Install microk8s:
snap install microk8s --classic --channel=1.12/edge- Create directory for kubelet mounts:
mkdir -p /var/lib/kubelet/pods- Add
--allow-privileged=trueto:
# kubelet config
# - add `--allow-privileged=true`
# - add `--feature-gates=VolumeSnapshotDataSource=true,KubeletPluginsWatcher=true,CSINodeInfo=true,CSIDriverRegistry=true`
vim /var/snap/microk8s/current/args/kubelet
systemctl restart snap.microk8s.daemon-kubelet.service
#kube-apiserver config
# - add `--allow-privileged=true`
# - add `--feature-gates=VolumeSnapshotDataSource=true,KubeletPluginsWatcher=true,CSINodeInfo=true,CSIDriverRegistry=true`
vim /var/snap/microk8s/current/args/kube-apiserver
systemctl restart snap.microk8s.daemon-apiserver.serviceTODO: use function
- Allow Docker to use local registry [only if needed]:
vim /var/snap/microk8s/current/args/docker-daemon.json # add `{"insecure-registries":["10.3.199.92:5000"]}`
systemctl restart snap.microk8s.daemon-docker.service- Enable microk8s dns:
microk8s.enable dns- Allow pods to reach internet:
iptables -P FORWARD ACCEPT- Create CSI driver k8s types:
microk8s.kubectl create -f https://raw.githubusercontent.com/kubernetes/csi-api/ce972859c46136a1f4a9fe119d05482a739c6311/pkg/crd/manifests/csidriver.yaml
microk8s.kubectl create -f https://raw.githubusercontent.com/kubernetes/csi-api/ce972859c46136a1f4a9fe119d05482a739c6311/pkg/crd/manifests/csinodeinfo.yaml- Clone the repository:
git clone https://github.com/Nexenta/nexentastor-csi-driver.git
cd nexentastor-csi-drive- Create secret:
# secret for local registry
microk8s.kubectl create secret generic nexentastor-csi-driver-config-manual --from-file=./tests/deploy/driver-config-manual.yaml
# OR
# secret for hub.docker.com
microk8s.kubectl create secret generic nexentastor-csi-driver-config --from-file=./tests/deploy/driver-config-manual.yaml-
Replace all
/var/lib/kubelet/*paths by microk8s ones:/var/snap/microk8s/common/var/lib/kubelet/*(kubelet's--root-dirargument) in any config files. -
Deploy CSI driver:
# master for local registry
microk8s.kubectl apply -f ./tests/deploy/microk8s/driver-local-manual.yaml
# OR
# master for hub.docker.com (NEED PATH FIX, SEE #11)
microk8s.kubectl apply -f ./deploy/kubernetes/master/nexentastor-csi-driver-master.yaml- Validate if it works:
watch -n1 --diff microk8s.kubectl get all- Deploy Nginx example
kubectl apply -f ./deploy/kubernetes/examples/nginx-storage-class.yaml
Thanks very much for this.