Skip to content

Commit

Permalink
Merge pull request #42 from min-zh/dev
Browse files Browse the repository at this point in the history
installation update
  • Loading branch information
zheng1 authored Sep 3, 2020
2 parents 34fba43 + 6676147 commit 49a7064
Show file tree
Hide file tree
Showing 32 changed files with 48 additions and 4,870 deletions.
23 changes: 6 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,22 @@
.PHONY: all disk

IMAGE=csiplugin/csi-neonsan
TAG=v1.2.0-rc2
TAG=canary
IMAGE_UBUNTU=csiplugin/csi-neonsan-ubuntu
TAG_UBUNTU=v1.2.0
RELEASE_VERSION=v1.2.0
TAG_UBUNTU=canary
IMAGE_CENTOS=csiplugin/csi-neonsan-centos
TAG_CENTOS=canary
ROOT_PATH=$(pwd)
PACKAGE_LIST=./cmd/... ./pkg/...

neonsan-plugin:
go build -ldflags "-w -s" -mod=vendor -o deploy/neonsan/plugin/neonsan-plugin ./cmd/neonsan

neonsan-plugin-debug:
go build -gcflags "all=-N -l" -mod=vendor -o deploy/neonsan/plugin/neonsan-plugin-debug ./cmd/neonsan

container:
docker build -t ${IMAGE}:${TAG} -f deploy/neonsan/docker/Dockerfile .

container-ubuntu:
docker build -t ${IMAGE_UBUNTU}:${TAG_UBUNTU} -f deploy/neonsan/docker/ubuntu/Dockerfile .

yaml:
kustomize build deploy/neonsan/kubernetes/base > deploy/neonsan/kubernetes/release/csi-neonsan-${RELEASE_VERSION}.yaml

yaml-ubuntu:
kustomize build deploy/neonsan/kubernetes/base-ubuntu > deploy/neonsan/kubernetes/release/csi-neonsan-${RELEASE_VERSION}-ubuntu.yaml

release:
cp deploy/neonsan/plugin/* deploy/neonsan/kubernetes/release && cd deploy/neonsan/kubernetes/ && tar -zcvf csi-neonsan-${RELEASE_VERSION}.tar.gz release/*
container-centos:
docker build -t ${IMAGE_CENTOS}:${TAG_CENTOS} -f deploy/neonsan/docker/centos/Dockerfile .

mod:
go build ./...
Expand Down
135 changes: 2 additions & 133 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,139 +10,8 @@ QingStor CSI plugin implements an interface between Container Storage Interface
## Notes
- On Kubernetes v1.16, QingStor CSI v1.2.0 not supports volume snapshot management.

## Installation
This guide will install CSI plugin in the *kube-system* namespace of Kubernetes v1.14+. You can also deploy the plugin in other namespace.

- Set Kubernetes Parameters
- Enable `--allow-privileged=true` on kube-apiserver, kube-controller-manager, kube-scheduler, kubelet
- Enable (Default enabled) [Mount Propagation](https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation) feature gate。
- Enable `--feature-gates=CSINodeInfo=true,CSIDriverRegistry=true,KubeletPluginsWatcher=true` option on kube-apiserver, kube-controller-manager, kube-scheduler, kubelet

- Install Snapshot CRD and Controller

Snapshot management supported on 1.17+, and CRD and controller should be installed.
```bash
kubectl apply -f deploy/neonsan/kubernetes/snapshot/snapshot-crd.yaml
kubectl apply -f deploy/neonsan/kubernetes/snapshot/snapshot-controller.yaml
```

- Download **qbd** and install **qbd** on nodes of kubernetes
As long as **qbd**'s version consistent with neonsan server, the CSI works.

* Download

As **qbd** is not open source, the install package is provided by **Neonsan Team**

* Install

| OS | Required lib | Command |
| :------------ | :---------------------- | :--------------------------------- |
| Redhat/Centos | libcurl libicu | rpm -ivh pitrix-dep-qbd-xxx.rpm |
| SUSE | libcurl4 libicu | rpm -ivh pitrix-dep-qbd-xxx.rpm |
| Ubuntu/Debian | libcurl4-openssl libicu | apt install pitrix-dep-qbd-xxx.deb |

* Check installed

```bash
qbd -v
Package Version: 2.0.4-cb3daa5-190821224030-centos75
Loaded Module Version: 2.0.4-cb3daa5-190821224030-centos75
NeonSAN Static Library Version: 2.1.14-83d762a
```

- Deploy CSI plugin
- Helm
- Install
```bash
helm install ./helm/csi-neonsan --name-template csi-neonsan --namespace kube-system
```
- Check
```bash
helm ls --namespace kube-system
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
csi-neonsan kube-system 1 2020-05-15 16:15:32.866234841 +0800 CST deployed csi-neonsan-1.2.0-canary 1.2.0
kubectl get pods -n kube-system --selector=app=csi-neonsan
NAME READY STATUS RESTARTS AGE
csi-neonsan-controller-594448465-sq57l 4/4 Running 0 6m41s
csi-neonsan-node-9w2zp 1/1 Running 0 6m41s
csi-neonsan-node-bzqcj 1/1 Running 0 6m41s
csi-neonsan-node-vjmvb 1/1 Running 0 6m41s
```

- Kubectl
- For kubernetes 1.16
```bash
kubectl apply -f deploy/neonsan/kubernetes/release/csi-neonsan-v1.2.0-k8s16.yaml
```
- For kubernetes 1.17
```bash
kubectl apply -f deploy/neonsan/kubernetes/release/csi-neonsan-v1.2.0.yaml
```
- Check CSI plugin
```bash
kubectl get pods -n kube-system --selector=app=csi-neonsan
NAME READY STATUS RESTARTS AGE
csi-neonsan-controller-594448465-sq57l 4/4 Running 0 6m41s
csi-neonsan-node-9w2zp 1/1 Running 0 6m41s
csi-neonsan-node-bzqcj 1/1 Running 0 6m41s
csi-neonsan-node-vjmvb 1/1 Running 0 6m41s
```

- Install neonsan-plugin

As the current version of **qbd** can't run in container, **node part** of the CSI driver run as **systemd service** on the Kubernetes nodes as an alternative we call **neonsan-plugin**. **Neonsan-plugin** will ben installed by **ansible**.
If you have installed kubesphere by ks-installer, ansible has been installed on the master. The path of ansible config is **/root/kubesphere-all-v2.1.0/k8s/inventory/my_cluster/host.ini**. You could copy it to **/etc/ansible/hosts**, or run ansible like **ansible -i /root/kubesphere-all-v2.1.0/k8s/inventory/my_cluster/host.ini**.
```bash
make neonsan-plugin
ansible-playbook deploy/neonsan/plugin/neonsan-plugin-install.yaml
```
- Check neonsan-plugin
```
ansible all -m shell -a "systemctl status neonsan-plugin.service" | grep active
Active: active (running) since Tue 2020-02-25 10:42:25 CST; 40s ago
Active: active (running) since Tue 2020-02-25 10:42:25 CST; 40s ago
Active: active (running) since Tue 2020-02-25 10:42:25 CST; 40s ago
```
### Uninstall
```bash
ansible-playbook deploy/neonsan/plugin/neonsan-plugin-uninstall.yaml
```
- Helm
```bash
helm delete csi-neonsan --namespace kube-system
```
- Kubectl for kubernetes 1.16
```bash
kubectl delete -f deploy/neonsan/kubernetes/release/csi-neonsan-v1.2.0-k8s16.yaml
```
- Kubectl for kubernetes 1.17
```bash
kubectl delete -f deploy/neonsan/kubernetes/release/csi-neonsan-v1.2.0.yaml
```
### StorageClass Parameters
StorageClass definition [file](deploy/neonsan/example/volume/sc.yaml) shown below is used to create StorageClass object.
```
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-neonsan
provisioner: neonsan.csi.qingstor.com
parameters:
fsType: "ext4"
rep_count: "2"
pool_name: "kube"
reclaimPolicy: Delete
```
- `fsType`: `ext3`, `ext4`, `xfs`. Default `ext4`.
- `rep_count`: count of replicas (`1-3`). Default` 1`.
- `pool_name`: pool name of Neonsan, should not be empty.
## Installation
From v1.2.0, QingStor-CSI will be installed by helm. See [Helm Charts](https://github.com/kubesphere/helm-charts/tree/master/src/test/csi-neonsan) for details.

## Document
- [User Guide](docs/user-guide.md)
Expand Down
2 changes: 1 addition & 1 deletion deploy/neonsan/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -mod=vendor -ldflags "-s -w" -o _outp
FROM gcr.azk8s.cn/google_containers/debian-base:v1.0.0
LABEL maintainers="Yunify"
LABEL description="NeonSAN CSI plugin"
RUN clean-install util-linux e2fsprogs xfsprogs mount ca-certificates udev
RUN clean-install util-linux e2fsprogs xfsprogs mount ca-certificates udev
COPY --from=builder /qingstor-csi/_output/neonsan-csi-driver /neonsan-csi-driver
RUN chmod +x /neonsan-csi-driver && \
mkdir -p /var/log/neonsan-csi-driver
Expand Down
31 changes: 31 additions & 0 deletions deploy/neonsan/docker/centos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# +-------------------------------------------------------------------------
# | Copyright (C) 2018 Yunify, Inc.
# +-------------------------------------------------------------------------
# | Licensed under the Apache License, Version 2.0 (the "License");
# | you may not use this work except in compliance with the License.
# | You may obtain a copy of the License in the LICENSE file, or 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.
# +-------------------------------------------------------------------------

FROM golang:1.12.7-alpine as builder
WORKDIR /qingstor-csi
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -mod=vendor -ldflags "-s -w" -o _output/neonsan-csi-driver ./cmd/neonsan

FROM centos:7
LABEL maintainers="Yunify"
LABEL description="NeonSAN CSI plugin"
# libcurl3 and libicu55 for qbd
RUN yum -y install libcurl libicu
RUN yum -y install e2fsprogs xfsprogs mount ca-certificates udev
COPY --from=builder /qingstor-csi/_output/neonsan-csi-driver /neonsan-csi-driver
RUN chmod +x /neonsan-csi-driver && \
mkdir -p /var/log/neonsan-csi-driver
ENTRYPOINT ["/neonsan-csi-driver"]
3 changes: 2 additions & 1 deletion deploy/neonsan/docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ LABEL maintainers="Yunify"
LABEL description="NeonSAN CSI plugin"
# libcurl3 and libicu55 for qbd
RUN apt-get update -y && \
apt-get install -y libcurl3 libicu55
apt-get install -y libcurl3 libicu55 && \
apt-get install -y e2fsprogs xfsprogs mount ca-certificates udev
COPY --from=builder /qingstor-csi/_output/neonsan-csi-driver /neonsan-csi-driver
RUN chmod +x /neonsan-csi-driver && \
mkdir -p /var/log/neonsan-csi-driver
Expand Down
2 changes: 1 addition & 1 deletion deploy/neonsan/example/volume/sc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ metadata:
provisioner: neonsan.csi.qingstor.com
parameters:
fsType: "ext4"
replica: "1"
rep_count: "1"
pool_name: "kube"
reclaimPolicy: Delete
allowVolumeExpansion: true
Loading

0 comments on commit 49a7064

Please sign in to comment.