k8s volume

we use Cloud Provider Storage to provide Volume to k8s

create PersistentVolume,PersistentVolumeClaim,Pod(to use PVC)

demo:

1.Create PV and PVC.
define the Volume path and kind in PersistentVolume
define the request of Volume (kind and size) in PersistVolumeClaim

2.Deploy MySQL.
define Service
define Deployment which includes mysql version,volumeMounts which local directory use Volume,volumes which calls PVC (The PVC mysql-pv of PVC mysql-pvc Bound will be mounted to the MySQL data directory var/lib/mysql.)

3.Add data to MySQL.
use mysql
create * table
insert *
select *

4.The simulated node crashes and Kubernetes automatically migrates
shutdown one node

5.MySQL to other nodes.
kubectl get pod -o wide shows that pod is migrated to another node

6.Verify data consistency.

use mysql
select * to check the data is consistent.

We demonstrated how to implement data persistence using PersistentVolume in MySQL.

PV and PVC separate the responsibilities of administrators and general users, making them more suitable for production environments.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值