基于华为云NAS存储和容器集群部署redis

1 概述

华为云SFS Turbo是一种NAS存储,可以作为华为云容器集群CCE的远程存储,文本介绍使用helm部署一主两从的redis服务。

2 部署

2.1 购买SFS Turbo实例

在这里插入图片描述

2.2 购买华为云容器集群CCE实例

在这里插入图片描述

2.3 在k8s中创建storageclass对象

参数everest.io/share-access-to是VPC的ID。
参数everest.io/share-export-location是sfs turbo实例的共享路径:自定义子目录,sfs turbo实例的共享路径是在sfs实例的详细页查询,自定义子目录可以是任意路径。
参数everest.io/volume-id是sfs turbo实例的ID。
只需要修改以上三个参数。

在本文,storageclass的名称叫做sfsturbo-subpath-sc。

apiVersion: storage.k8s.io/v1
allowVolumeExpansion: true
kind: StorageClass
metadata:
  name: sfsturbo-subpath-sc
mountOptions:
- lock
parameters:
  csi.storage.k8s.io/csi-driver-name: sfsturbo.csi.everest.io
  csi.storage.k8s.io/fstype: nfs
  everest.io/archive-on-delete: "true"
  everest.io/share-access-to: xxxxxxxxxxxxxxxxxx   # VPC ID
  everest.io/share-expand-type: bandwidth
  everest.io/share-export-location: xxxxx.sfsturbo.internal:/mydir   # sfs turbo实例的共享路径:自定义子目录
  everest.io/share-source: sfs-turbo
  everest.io/share-volume-type: STANDARD
  everest.io/volume-as: subpath
  everest.io/volume-id: xxxxxxxxxxxxx   # sfs turbo实例的ID
provisioner: everest-csi-provisioner
reclaimPolicy: Delete
volumeBindingMode: Immediate

在这里插入图片描述


2.4 安装helm

2.4.1 下载helm

cd /tmp
wget https://get.helm.sh/helm-v3.16.2-linux-amd64.tar.gz
tar xf helm-v3.16.2-linux-amd64.tar.gz
cd linux-amd64
/bin/cp -f helm /usr/bin/
helm env

2.4.2 添加helm仓库

helm repo add stable http://mirror.azure.cn/kubernetes/charts
helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

2.4.3 选择目标k8s集群

export KUBECONFIG=/root/.kube/config

2.5 部署redis

通过helm命令部署,helm实例名称为myredis,放在default这个namespace下。

cd /tmp
helm pull --untar stable/redis-ha
helm install myredis -n default \
--set persistentVolume.storageClass=sfsturbo-subpath-sc \
--set hardAntiAffinity=false \
./redis-ha

在这里插入图片描述
在这里插入图片描述

3 小结

本文以部署redis服务作为一个典型例子,介绍在华为云容器集群中使用NAS存储作为PV的底层存储。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值