Programme background and purpose
It has been 2 years since KubeSphere was released, from version 2.1.0 to the current latest version 3.3. The compilation and construction of developers are based on the DevOps function of the environment platform (the bottom layer is jenkins). If there are many DevOps projects, there will be more pipeline record data. The recorded data storage method is based on Openebs by default, and the storage medium depends on The risk of the local disk of the ECS host is relatively large. Considering the unreliability of the host's hard disk, downtime will occur at any time, resulting in the loss of pipeline record data, which will have a serious impact. This tutorial has been tested on the local R&D platform and passed the test of using the open source project juiceFS-CSI and relying on OSS as the backend storage to realize data migration.
Preconditions:
- The KubeSphere platform has been installed (this tutorial uses KubeSphere 3.2.1, K8s version 1.21.5). Please refer to the official website for the installation method: https://kubesphere.com.cn/docs/v3.3/
- The juiceFS-CSI plug-in has been installed and the OSS backend has been mounted. Confirm that the PV will be automatically created and bound through the SC when the PVC is created.
Please refer to the official website for the installation method: https://www.juicefs.com/docs/zh/community/introduction/
(both of the above are indispensable)
program implementation process
1. Find the PV used by Jenkins on the KubeSphere platform
2. Confirm the current Jenkins path saved on the Local disk (on the node1 node)
/var/openebs/local/pvc-2143c5a8-9593-4e2a-8eb5-2f3a0c98219a
3. Download the JuiceFS client
Get the latest version number.
$ JFS_LATEST_TAG=$(curl -s https://api.github.com/repos/juicedata/juicefs/releases/latest | grep 'tag_name' | cut -d '"' -f 4 | tr -d 'v')
Download the client to the current directory.
$ wget "https://github.com/juicedata/juicefs/releases/download/v${JFS_LATEST_TAG}/juicefs-${JFS_LATEST_TAG}-linux-amd64.tar.gz"
Unzip the installation package.
$ tar -zxf "juicefs-${JFS_LATEST_TAG}-linux-amd64.tar.gz"
Install the client.
$ install juicefs /usr/local/bin
Mount JuiceFS.
$ juicefs mount -d redis://10.233.106.62:6379/1 /mnt/jfs
-
redis://
followed by the intranet address of the Redis service; -
/mnt/jfs
is a custom directory.
4. Create a new PVC
Open the management background - find [storage]--[storage volume]--[kubesphere-devops-system] open [create]
View the creation result on the host by the name of the PVC
5. Stop the DevOps service (critical step)
The service that found devops-jenkins dropped the replica count to 0.
Copy the data of devops-jenkins corresponding to Local to the newly created PVC (the waiting time is long).
Note: It is recommended to write the absolute path of the directory when copying.
$ cp -r /var/openebs/local/pvc-a2e60bcb-440e-4820-9330-921584bbabf3/* /mnt/jfs/pvc-bf8f2f7c-cfd1-45fd-94c8-39726aa364a5/
After confirming that the data has reached the destination data PVC, replace the devops-jenkins data parameter to unbind the original PVC and bind the new PVC.
Find the original storage volume and modify the binding.
Confirm that the service has started normally.
Confirm that the data is correct.
$ df- h
$ ls /挂载点
verify
Create a new pipeline.
friendly reminder
- At present, this tutorial has not been verified in the production environment. If you use it in production, please make a backup and try to roll back in time.
- The migrated data cannot be viewed directly from the back-end media (for example, the back-end is OSS), because the data is broken up and saved in JuiceFS format. To view it, you need to install the JuiceFS client or directly enter the PVC binding. in the container.
- kubesphere-GitHub address: https://github.com/kubesphere/kubesphere .
JuiceFS-GitHub address: https://github.com/juicedata/juicefs .
This article is published by OpenWrite , a multi-post blog platform!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。