当前位置:网站首页>多个kubernetes集群如何实现共享同一个存储
多个kubernetes集群如何实现共享同一个存储
2022-07-07 17:03:00 【傻啦猫@[email protected]】
引言
今天工作的时候想了一个问题:项目上使用的是双集群部署应用,但是使用的存储却只有一个,还起来一个怪有趣的名字,叫“多中心共享存储”。这样做的优点很明显,一个存储实现了多集群的数据共享,这个也很好理解,虽然是多个集群,但是应用却是相同的,数据理应可以共享。那么是如何做的呢?思考许久,想到了破解方法。
环境准备
服务器准备
准备了7台服务器,这些服务器在同一个网络之内,可以互相访问。6台服务器可以建两个kubernetes集群(一主两从),还有一台作为NFS文件系统的主节点。

资源分配
| k8s集群1 | k8s集群2 | NFS |
|---|---|---|
| 192.168.0.135 | 192.168.0.163 | 192.168.0.185 |
| 192.168.0.198 | 192.168.0.247 | |
| 192.168.0.12 | 192.168.0.167 |
说明:NFS是网络文件系统,单独给一台服务器作为server,其他服务器都是client。
安装NFS
所有节点执行
yum install -y nfs-utils
nfs主节点(192.168.0.185)执行
echo "/nfs/data/ *(insecure,rw,sync,no_root_squash)" > /etc/exports # 暴露了目录/nfs/data/,`*`表示所有节点都可以访问。
mkdir -p /nfs/data
systemctl enable rpcbind --now
systemctl enable nfs-server --now
# 配置生效
exportfs -r
# 检查验证
[[email protected] ~]# exportfs
/nfs/data <world>
[[email protected] ~]#
nfs从节点执行
# 展示192.168.0.185有哪些目录可以挂载
showmount -e 192.168.0.185 # ip改成自己的主节点ip
mkdir -p /nfs/data
# 将本地目录和远程目录进行挂载
mount -t nfs 192.168.0.185:/nfs/data /nfs/data
验证
# 在任意节点写入一个测试文件
echo "hello nfs server" > /nfs/data/test.txt

通过在任意节点写入一个文件,在其他节点都可以看到文件内容。这样便实现了kubernetes多个集群的文件共享。将NFS主节点单独维护,不会对kubernetes集群造成影响。“多中心共享存储”由此诞生了。
本文由 mdnice 多平台发布
版权声明
本文为[傻啦猫@[email protected]]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45842494/article/details/125650136
边栏推荐
- Creative changes brought about by the yuan universe
- SD_ DATA_ RECEIVE_ SHIFT_ REGISTER
- Redis集群与扩展
- 前首富,沉迷种田
- [tpm2.0 principle and Application guide] Chapter 16, 17 and 18
- In 2021, the national average salary was released. Have you reached the standard?
- Multimodal point cloud fusion and visual location based on image and laser
- 如何给“不卖笔”的晨光估值?
- 2022.07.02
- Charles+Postern的APP抓包
猜你喜欢

In the first half of 2022, I found 10 books that have been passed around by my circle of friends
![[tpm2.0 principle and Application guide] Chapter 9, 10 and 11](/img/7f/0d4d91142bc3d79ea445a8f64afba7.png)
[tpm2.0 principle and Application guide] Chapter 9, 10 and 11
![Interview vipshop internship testing post, Tiktok internship testing post [true submission]](/img/69/b27255c303150430df467ff3b5cd08.gif)
Interview vipshop internship testing post, Tiktok internship testing post [true submission]

The top of slashdata developer tool is up to you!!!

6. About JWT

Three forms of multimedia technology commonly used in enterprise exhibition hall design

數據驗證框架 Apache BVal 再使用

App capture of charles+postern

静态路由配置

Simple configuration of single arm routing and layer 3 switching
随机推荐
博睿数据入选《2022爱分析 · IT运维厂商全景报告》
[paper sharing] where's crypto?
Borui data was selected in the 2022 love analysis - Panoramic report of it operation and maintenance manufacturers
线程池中的线程工厂
伺服力矩控制模式下的力矩目标值(fTorque)计算
高温火烧浑不怕,钟薛高想留清白在人间
The performance and efficiency of the model that can do three segmentation tasks at the same time is better than maskformer! Meta & UIUC proposes a general segmentation model with better performance t
ip netns 命令(备忘)
How many times is PTA 1101 B than a
【塔望方法论】塔望3W消费战略 - U&A研究法
[C language] string function
【Unity Shader】插入Pass实现模型遮挡X光透视效果
静态路由配置
Scientists have observed for the first time that the "electron vortex" helps to design more efficient electronic products
LeetCode 497(C#)
能同时做三个分割任务的模型,性能和效率优于MaskFormer!Meta&UIUC提出通用分割模型,性能优于任务特定模型!开源!...
Short selling, overprinting and stock keeping, Oriental selection actually sold 2.66 million books in Tiktok in one month
Draw squares with Obama (Lua)
咋吃都不胖的朋友,Nature告诉你原因:是基因突变了
国内的软件测试会受到偏见吗