From 25d0e476c4b3dae2214b3c4576f83a9232c9010f Mon Sep 17 00:00:00 2001 From: Jiaxun Song Date: Fri, 13 Nov 2020 20:13:16 +0000 Subject: [PATCH] doc: add install instructions --- README.md | 3 ++ deploy/kubernetes/install-driver.sh | 41 +++++++++++++++++++++++++++ deploy/kubernetes/uninstall-driver.sh | 41 +++++++++++++++++++++++++++ docs/install-csi-driver.md | 37 ++++++++++++++++++++++++ 4 files changed, 122 insertions(+) create mode 100755 deploy/kubernetes/install-driver.sh create mode 100755 deploy/kubernetes/uninstall-driver.sh create mode 100644 docs/install-csi-driver.md diff --git a/README.md b/README.md index c38b616b..d42bfc23 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ preexisting NFS server, whether it is deployed on cluster or provisioned independently. The plugin itself provides only a communication layer between resources in the cluser and the NFS server. +## Install NFS CSI driver on a kubernetes cluster +Please refer to [install NFS CSI driver](https://github.com/kubernetes-csi/csi-driver-nfs/blob/master/docs/install-csi-driver.md). + ## Example There are multiple ways to create a kubernetes cluster, the NFS CSI plugin diff --git a/deploy/kubernetes/install-driver.sh b/deploy/kubernetes/install-driver.sh new file mode 100755 index 00000000..eec69e1d --- /dev/null +++ b/deploy/kubernetes/install-driver.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail + +ver="master" +if [[ "$#" -gt 0 ]]; then + ver="$1" +fi + +repo="https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/$ver/deploy/kubernetes" +if [[ "$#" -gt 1 ]]; then + if [[ "$2" == *"local"* ]]; then + echo "use local deploy" + repo="./deploy/kubernetes" + fi +fi + +if [ $ver != "master" ]; then + repo="$repo/$ver" +fi + +echo "Installing NFS CSI driver, version: $ver ..." +kubectl apply -f $repo/rbac-csi-nfs-controller.yaml +kubectl apply -f $repo/csi-nfs-driverinfo.yaml +kubectl apply -f $repo/csi-nfs-controller.yaml +kubectl apply -f $repo/csi-nfs-node.yaml +echo 'NFS CSI driver installed successfully.' diff --git a/deploy/kubernetes/uninstall-driver.sh b/deploy/kubernetes/uninstall-driver.sh new file mode 100755 index 00000000..6b48ab79 --- /dev/null +++ b/deploy/kubernetes/uninstall-driver.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail + +ver="master" +if [[ "$#" -gt 0 ]]; then + ver="$1" +fi + +repo="https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/$ver/deploy/kubernetes" +if [[ "$#" -gt 1 ]]; then + if [[ "$2" == *"local"* ]]; then + echo "use local deploy" + repo="./deploy/kubernetes" + fi +fi + +if [ $ver != "master" ]; then + repo="$repo/$ver" +fi + +echo "Uninstalling NFS driver, version: $ver ..." +kubectl delete -f $repo/csi-nfs-controller.yaml --ignore-not-found +kubectl delete -f $repo/csi-nfs-node.yaml --ignore-not-found +kubectl delete -f $repo/csi-nfs-driverinfo.yaml --ignore-not-found +kubectl delete -f $repo/rbac-csi-nfs-controller.yaml --ignore-not-found +echo 'Uninstalled NFS driver successfully.' diff --git a/docs/install-csi-driver.md b/docs/install-csi-driver.md new file mode 100644 index 00000000..f06a35be --- /dev/null +++ b/docs/install-csi-driver.md @@ -0,0 +1,37 @@ +# Install NFS CSI driver master version on a kubernetes cluster + +If you have already installed Helm, you can also use it to install NFS CSI driver. Please see [Installation with Helm](../charts/README.md). + +## Install with kubectl + - remote install +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/kubernetes/install-driver.sh | bash -s master -- +``` + + - local install +```console +git clone https://github.com/kubernetes-csi/csi-driver-nfs.git +cd csi-driver-nfs +./deploy/kubernetes/install-driver.sh master local +``` + +- check pods status: +```console +kubectl -n kube-system get pod -o wide -l app=csi-nfs-controller +kubectl -n kube-system get pod -o wide -l app=csi-nfs-node +``` + +example output: + +```console +NAME READY STATUS RESTARTS AGE IP NODE +csi-nfs-controller-56bfddd689-dh5tk 4/4 Running 0 35s 10.240.0.19 k8s-agentpool-22533604-0 +csi-nfs-controller-56bfddd689-8pgr4 4/4 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-nfs-node-cvgbs 3/3 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-nfs-node-dr4s4 3/3 Running 0 35s 10.240.0.4 k8s-agentpool-22533604-0 +``` + +- clean up NFS CSI driver +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/kubernetes/uninstall-driver.sh | bash -s master -- +``` \ No newline at end of file