一、磁盘空间划分
# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xae71dee0.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-419430399, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399):
Using default value 419430399
Partition 1 of type Linux and of size 200 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): ps^H
Disk /dev/vdb: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xae71dee0
Device Boot Start End Blocks Id System
/dev/vdb1 2048 419430399 209714176 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
2、创建逻辑卷组
vgcreate myvg /dev/vdb1
Physical volume "/dev/vdb1" successfully created.
Volume group "myvg" successfully created
3、创建逻辑卷
lvcreate -l +100%FREE -n lv1 myvg
Logical volume "lv1" created
4、格式lv1
mkfs.xfs /dev/myvg/lv1
meta-data=/dev/myvg/lv1 isize=512 agcount=4, agsize=13106944 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=52427776, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=25599, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
5、把lv1挂载到/data目录下
echo /dev/myvg/lv1 /data/ xfs defaults 0 0 >>/etc/fstab
6、挂载所有的卷
mount -a
二、修改docker目录
[root@k8s-master ~]# cat /etc/docker/daemon.json
{ "registry-mirrors": ["https://gp8745ui.mirror.aliyuncs.com"],
"insecure-registries": ["172.16.4.169"],
"data-root": "/data/docker" ###修改自定义的目录
}
2、重启docker服务
systemctl restart docker
3、查看自定义目录
docker info|grep Root
三、修改kubelet的目录
[root@k8s-node1 /]# vim /etc/sysconfig/kubelet
###修改自定义的数据目录
KUBELET_EXTRA_ARGS="--root-dir=/data/k8s/kubelet"
2、重启kubelet
systemctl restart kubelet
3、查看kubelet数据目录
ps -aux|grep kubelet|grep root-dir