前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用 MicroK8s 和 OpenEBS 扩展 Kubernetes 存储

使用 MicroK8s 和 OpenEBS 扩展 Kubernetes 存储

作者头像
张善友
发布2022-05-14 09:51:53
4780
发布2022-05-14 09:51:53
举报
文章被收录于专栏:张善友的专栏张善友的专栏

OpenEBS 由 CloudByte 研发,这是一家专业做容器化存储的公司,OpenEBS 是其一款开源产品,CloudByte 将其在企业级容器存储的经验付诸到该项目中。这个项目的愿景也很简单,就是让需要持久化存储的工作负载中的存储服务能够直接集成在环境中,存储服务可以自动管理,将存储的细节隐藏起来,就像存储系统是另一套基础架构一样。

在 MicroK8s 上,通过启用OpenEBS 附加组件,以支持集群存储。OpenEBS 使用 iSCSI 进行集群,这在单个主机上不是必需的,但必须先启用该服务,然后才能启用 OpenEBS: sudo systemctl enable iscsid.service

现在您可以启用 OpenEBS:

microk8s enable openebs

最新的1.24 还有 https://ubuntu.com/blog/kubernetes-storage-microk8s-mayastor

--------------------------------------------------------------------------------------------------------------------------------

ubuntu@VM-1-2-ubuntu:~$ sudo systemctl enable iscsid.service

Synchronizing state of iscsid.service with SysV service script with /lib/systemd/systemd-sysv-install.

Executing: /lib/systemd/systemd-sysv-install enable iscsid

ubuntu@VM-1-2-ubuntu:~$ helm repo update

W0513 09:51:37.708144   62648 loader.go:221] Config not found: /etc/kubernetes/admin.conf

Hang tight while we grab the latest from your chart repositories...

...Successfully got an update from the "openebs" chart repository

Update Complete. ?Happy Helming!?

ubuntu@VM-1-2-ubuntu:~$ microk8s enable openebs

Addon dns is already enabled.

Addon helm3 is already enabled.

WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /var/snap/microk8s/3052/credentials/client.config

"openebs" already exists with the same configuration, skipping

WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /var/snap/microk8s/3052/credentials/client.config

Hang tight while we grab the latest from your chart repositories...

...Successfully got an update from the "openebs" chart repository

Update Complete. ?Happy Helming!?

WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /var/snap/microk8s/3052/credentials/client.config

NAME: openebs

LAST DEPLOYED: Fri May 13 09:51:58 2022

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/ or

- connect with an active community on Kubernetes slack #openebs channel.

OpenEBS is installed

-----------------------

When using OpenEBS with a single node MicroK8s, it is recommended to use the openebs-hostpath StorageClass

An example of creating a PersistentVolumeClaim utilizing the openebs-hostpath StorageClass

kind: PersistentVolumeClaim

apiVersion: v1

metadata:

  name: local-hostpath-pvc

spec:

  storageClassName: openebs-hostpath

  accessModes:

    - ReadWriteOnce

  resources:

    requests:

      storage: 5G

-----------------------

If you are planning to use OpenEBS with multi nodes, you can use the openebs-jiva-csi-default StorageClass.

An example of creating a PersistentVolumeClaim utilizing the openebs-jiva-csi-default StorageClass

kind: PersistentVolumeClaim

apiVersion: v1

metadata:

  name: jiva-volume-claim

spec:

  storageClassName: openebs-jiva-csi-default

  accessModes:

    - ReadWriteOnce

  resources:

    requests:

      storage: 5G

ubuntu@VM-1-2-ubuntu:~$ sudo microk8s kubectl get sc

NAME                       PROVISIONER           RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE

openebs-jiva-csi-default   jiva.csi.openebs.io   Delete          Immediate              true                   15m

openebs-device             openebs.io/local      Delete          WaitForFirstConsumer   false                  15m

openebs-hostpath           openebs.io/local      Delete          WaitForFirstConsumer   false                  15m

默认的OpenEBS回收策略与K8所使用的相同。“删除”是动态配置的PersistentVolume的默认回收策略。它们在某种意义上是相关的,如果一个人删除了相应的PersistentVolumeClaim,则动态配置的卷将被自动删除。对于cStor卷,则数据随之删除。对于jiva(0.8.0版及更高版本),清理作业将执行数据删除工作。

参考文章:

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2022-05-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
容器服务
腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档