k8s csi对接群晖synology-csi使用块存储
百度网盘下载地址:链接: https://pan.baidu.com/s/1duY3D4qAizlgLz9o9nrKmg 密码: tlv8
西瓜视频:https://www.ixigua.com/7080176189909762591?logTag=205c805ad3489b4831cc
tar zxvf synology-csi-1.0.0.tar.gz
修改client-info.yml
cat client-info.yml --- clients: - host: 192.168.3.231 port: 5000 https: false username: wangjinxiong password: 21Vianet!@ #host: # ipv4 address or domain of the DSM #port: # port for connecting to the DSM #https: # set this true to use https. you need to specify the port to DSM HTTPS port as well #username: # username #password: # password
cd synology-csi-1.0.0 chmod +x scripts/deploy.sh ./scripts/deploy.sh install --all
把默认安装的sc删掉
kubectl delete sc synology-iscsi-storage
vi storage-class.yaml
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: annotations: storageclass.kubernetes.io/is-default-class: "false" name: synostorage provisioner: csi.san.synology.com parameters: fsType: 'ext4' dsm: '192.168.3.231' location: '/volume1' reclaimPolicy: Delete allowVolumeExpansion: true
重新应用:
kubectl apply -f storage-class.yaml
cat pvc0327.yaml kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pvc0327 spec: accessModes: - ReadWriteMany resources: requests: storage: 2Gi storageClassName: synostorage kubectl apply -f pvc0327.yaml
查看pvc情况:
# kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE pvc0327 Bound pvc-7c6d335c-2f65-40ae-aa56-962ea93ff86e 2Gi RWX synostorage 2s
cat sts0327.yaml apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: serviceName: "nginx-svc" replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html volumeClaimTemplates: - metadata: name: www spec: storageClassName: synostorage accessModes: - ReadWriteOnce resources: requests: storage: 1Gi kubectl apply -f sts0327.yaml
登录容器查看挂载情况:
# kubectl exec -it web-0 -- /bin/bash root@web-0:/# df Filesystem 1K-blocks Used Available Use% Mounted on overlay 204372480 3227900 201144580 2% / tmpfs 65536 0 65536 0% /dev tmpfs 1931788 0 1931788 0% /sys/fs/cgroup /dev/mapper/centos-root 204372480 3227900 201144580 2% /etc/hosts shm 65536 0 65536 0% /dev/shm /dev/sdb 996780 24 980372 1% /usr/share/nginx/html tmpfs 1931788 12 1931776 1% /run/secrets/kubernetes.io/serviceaccount tmpfs 1931788 0 1931788 0% /proc/acpi tmpfs 1931788 0 1931788 0% /proc/scsi tmpfs 1931788 0 1931788 0% /sys/firmware root@web-0:/# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 200G 0 disk |-sda1 8:1 0 1G 0 part `-sda2 8:2 0 198.9G 0 part sdb 8:16 0 1G 0 disk /usr/share/nginx/html
西瓜视频:https://www.ixigua.com/7080176189909762591?logTag=205c805ad3489b4831cc
原文链接:https://blog.csdn.net/cloud_engineer/article/details/123943089?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522d92e35e5ad2482ee8fa97ce18ec8c625%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=d92e35e5ad2482ee8fa97ce18ec8c625&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-12-123943089-null-null.nonecase&utm_term=%E7%BE%A4%E6%99%96%E9%83%A8%E7%BD%B2














