首页 > 其他分享 >Kubernetes云原生存储解决方案openebs部署实践-3.10.0版本(helm部署)

Kubernetes云原生存储解决方案openebs部署实践-3.10.0版本(helm部署)

时间:2024-07-03 17:13:51浏览次数:13  
标签:k8s Kubernetes 部署 3.10 hostpath master helm openebs local

Kubernetes云原生存储解决方案openebs部署实践-3.10.0版本(helm部署)

记录在k8s 1.19.0集群环境下安装openebs 3.10.0。

环境信息如下:

[root@k8s-master ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
[root@k8s-master ~]# uname -a
Linux k8s-master 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@k8s-master ~]# kubectl get node
NAME         STATUS   ROLES    AGE   VERSION
k8s-master   Ready    master   16d   v1.19.0
k8s-node1    Ready    worker   16d   v1.19.0
k8s-node2    Ready    worker   16d   v1.19.0
[root@k8s-master ~]# helm version
version.BuildInfo{Version:"v3.6.1", GitCommit:"61d8e8c4a6f95540c15c6a65f36a6dd0a45e7a2f", GitTreeState:"clean", GoVersion:"go1.16.5"}

1. 安装openebs

openebs支持kubectl基于yaml安装,也可以使用helm进行安装。本文基于helm方式。

  1. 配置helm仓库
[root@k8s-master ~]# helm repo add openebs https://openebs.github.io/charts

[root@k8s-master ~]# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "grafana" chart repository
...Successfully got an update from the "ingress-nginx" chart repository
...Successfully got an update from the "bitnami" chart repository
...Successfully got an update from the "prometheus-community" chart repository
...Successfully got an update from the "openebs" chart repository
Update Complete. ⎈Happy Helming!⎈
  1. 安装 openebs chart
[root@k8s-master ~]# helm install openebs --namespace openebs openebs/openebs --create-namespace
NAME: openebs
LAST DEPLOYED: Fri Jun 28 15:14:46 2024
NAMESPACE: openebs
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Successfully installed OpenEBS.

Check the status by running: kubectl get pods -n openebs

The default values will install NDM and enable OpenEBS hostpath and device
storage engines along with their default StorageClasses. Use `kubectl get sc`
to see the list of installed OpenEBS StorageClasses.

**Note**: If you are upgrading from the older helm chart that was using cStor
and Jiva (non-csi) volumes, you will have to run the following command to include
the older provisioners:

helm upgrade openebs openebs/openebs \
        --namespace openebs \
        --set legacy.enabled=true \
        --reuse-values

For other engines, you will need to perform a few more additional steps to
enable the engine, configure the engines (e.g. creating pools) and create
StorageClasses.

For example, cStor can be enabled using commands like:

helm upgrade openebs openebs/openebs \
        --namespace openebs \
        --set cstor.enabled=true \
        --reuse-values

For more information,
- view the online documentation at https://openebs.io/docs or
- connect with an active community on Kubernetes slack #openebs channel.
  1. 检查部署的资源:
# 部署的chart
[root@k8s-master ~]# helm ls -n openebs
NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
openebs openebs         1               2024-06-28 15:14:46.982427602 +0800 CST deployed        openebs-3.10.0  3.10.0

# pods
[root@k8s-master ~]# kubectl get pod -n openebs -o wide
NAME                                           READY   STATUS    RESTARTS   AGE     IP             NODE         NOMINATED NODE   READINESS GATES
openebs-localpv-provisioner-685b678c88-lq57l   1/1     Running   0          9m49s   10.244.0.232   k8s-master   <none>           <none>
openebs-ndm-bxzwv                              1/1     Running   0          9m49s   192.168.0.51   k8s-master   <none>           <none>
openebs-ndm-d54bt                              1/1     Running   1          9m49s   192.168.0.53   k8s-node2    <none>           <none>
openebs-ndm-hjnpx                              1/1     Running   2          9m49s   192.168.0.52   k8s-node1    <none>           <none>
openebs-ndm-operator-c959d9d77-dscd2           1/1     Running   0          9m49s   10.244.0.233   k8s-master   <none>           <none>

# 存储类
[root@k8s-master ~]# kubectl get sc
NAME               PROVISIONER        RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
openebs-device     openebs.io/local   Delete          WaitForFirstConsumer   false                  16d
openebs-hostpath   openebs.io/local   Delete          WaitForFirstConsumer   false                  16d

本文安装的openebs版本较低,3.10.0版本,较新版本的chart仓库已经变更,详情参考官方文档:

官方文档:https://openebs.netlify.app/docs/quickstart-guide/installation

官方仓库:https://github.com/openebs/openebs

2. demo测试

openebs部署完成后会自动创建存储类,我们使用openebs-hostpath这个StorageClass来创建PVC

创建一个示例应用挂载openebs提供的存储进行测试。资源清单文件openebs-test.yaml,包括pvc和pod:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: local-hostpath-pvc
spec:
  storageClassName: openebs-hostpath
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: hello-local-hostpath-pod
spec:
  volumes:
  - name: local-storage
    persistentVolumeClaim:
      claimName: local-hostpath-pvc
  containers:
  - name: hello-container
    image: busybox
    command:
       - sh
       - -c
       - 'while true; do echo "`date` [`hostname`] Hello from OpenEBS Local PV." >> /mnt/store/greet.txt; sleep $(($RANDOM % 5 + 300)); done'
    volumeMounts:
    - mountPath: /mnt/store
      name: local-storage

创建资源:kubectl create -f openebs-test.yaml,等待创建完成。

[root@k8s-master openebs]# kubectl get pod -o wide
NAME                       READY   STATUS    RESTARTS   AGE   IP            NODE        NOMINATED NODE   READINESS GATES
hello-local-hostpath-pod   1/1     Running   0          15m   10.244.1.65   k8s-node1   <none>           <none>

[root@k8s-master openebs]# kubectl get pvc
NAME                 STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS       AGE
local-hostpath-pvc   Bound    pvc-b240b152-718e-44e2-938f-0255e457ec8f   5Gi        RWO            openebs-hostpath   11m

[root@k8s-master openebs]# kubectl get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                        STORAGECLASS       REASON   AGE
pvc-b240b152-718e-44e2-938f-0255e457ec8f   5Gi        RWO            Delete           Bound    default/local-hostpath-pvc   openebs-hostpath            8m49s

# 检查node1节点的本地路径
[root@k8s-node1 ~]# cat /var/openebs/local/pvc-b240b152-718e-44e2-938f-0255e457ec8f/greet.txt
Fri Jun 28 08:11:00 UTC 2024 [hello-local-hostpath-pod] Hello from OpenEBS Local PV.
Fri Jun 28 08:16:04 UTC 2024 [hello-local-hostpath-pod] Hello from OpenEBS Local PV.
Fri Jun 28 08:21:08 UTC 2024 [hello-local-hostpath-pod] Hello from OpenEBS Local PV.

标签:k8s,Kubernetes,部署,3.10,hostpath,master,helm,openebs,local
From: https://www.cnblogs.com/lldhsds/p/18282157

相关文章

  • Kubernetes基于helm安装 harbor
    Kubernetes基于helm安装harbor之前harbor的安装都是借助docker完成一键安装部署,安装完成之后harbor组件均运行到一台机器上面,本文实践harbor在k8s环境中的部署。准备工作根据harbor官方要求:Kubernetescluster1.20+Helmv3.2.0+结合ingress-nginx版本要求,建议K8S版本大......
  • VMware vSphere Tanzu部署_08_配置tanzu为单节点
    1.配置tanzu控制节点为单节点1.1.修改控制节点数量参数需要通过ssh登录vcenter,并进入bashshell查看/etc/vmware/wcp/wcpsvc.yaml中控制节点数量root@localhost[~]#sed-n'18,20p'/etc/vmware/wcp/wcpsvc.yamlclusterconfig:minmasters:3maxmasters:3ro......
  • VMware vSphere Tanzu部署_09_配置tanzu内容库
    配置Tanzu内容库Tanzu内容库订阅地址为:https://wp-content.vmware.com/v2/latest/lib.json如下为配置步骤在vcenter中配置内容库即可......
  • VMware vSphere Tanzu部署_07_tanzu存储策略配置
    tanzu存储策略配置tanzu存储类别配置tanzutag标签配置tanzutag标签分配tanzu存储策略配置......
  • VMware vSphere Tanzu部署_05_vyos虚拟路由器部署
    1.VYOS虚拟路由器部署1.1.VYOS虚拟路由器镜像下载在此处可以下载VYOS虚拟路由器镜像:https://vyos.net/get/nightly-builds/1.2.VYOS虚拟路由器部署创建虚拟机时,选择debian10vyos默认用户名和密码均为vyos1.3.VYOS虚拟路由器接口配置setinterfacesethernet......
  • VMware vSphere Tanzu部署_04_vCenter管理esxi并迁移网卡到DSwitch
    本次操作采用powershell来进行操作1.安装powershell和VM插件1.1.安装powershell在如下位置下载powershell进行:https://github.com/PowerShell/PowerShell/releases1.2.安装vm组件在cmd内输入pwsh后,输入:Install-Module-NameVMware.PowerCLI-ScopeCurrentUser......
  • 最新AI大模型系统源码,ChatGPT商业运营版系统源(详细图文搭建部署教程)+AI绘画系统,DALL-E
    一、前言人工智能语言模型和AI绘画在多个领域都有广泛的应用.....SparkAi创作系统是一款基于ChatGPT和Midjourney开发的智能问答和绘画系统,提供一站式AIB/C端解决方案,涵盖AI大模型提问、AI绘画、文档分析、图像识别和理解、TTS&语音识别、AI换脸等多项功能。支持GPTs应......
  • VMware vSphere Tanzu部署_03_vCenter部署
    vCenter部署部署vCenter通过安装ISO内的webui工具进行vCenter虚机部署配置部署位置为ESXI机器配置部署规格为tiny模式配置vcsa部署的磁盘类型为精简模式配置vcsa的网络初始化vCenter配置vcsa开启ntp同步和开启SSH登录配置vsphere登录账号和登录......
  • VMware vSphere Tanzu部署_02_ESXI系统安装
    ESX系统安装设置虚拟闪存占用为8G安装ESXI7.0时,默认会占用128G的VMFSL虚拟闪存大小,侵占磁盘空间。可以在安装过程中按shift+字母o键,添加使用参数:autoPartitionOSDataSize=8192安装系统配置网络......
  • VMware vSphere Tanzu部署_01_Tanzu架构设计
    想写关于vspherewithtanzu系列的文章,想了很久,墨迹到现在才才想好整体的文章架构和实验的资源信息在这里感谢williamlam,因为它的文章,我才得以用32GB的机器来搭建Tanzu集群参考文档:https://williamlam.com/2020/11/complete-vsphere-with-tanzu-homelab-with-just-32gb-of-me......