组件安装

基础依赖安装

  • 安装 docker-compose

    1
    
    yum install -y docker-compose
    

minio 对象存储的安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

mkdir -p /data/docker-compose/minio
&& cd /data/docker-compose/minio  # 创建工作目录

cat > docker-compose.yaml << EOF
version: "2.0"
services:
  minio:
    image: minio/minio:RELEASE.2021-03-17T02-33-02Z  # 这里使用最新稳定版本镜像,可以在 wiki 中 搜索 minio 查看到
    container_name: minio
    hostname: minio
    restart: always
    tty: true
    ports:
      - "9000:9000" 
    volumes:
      - /application/minio/data:/data
      - /application/minio/config:/root/.minio 
    environment:
      - "MINIO_ACCESS_KEY=admin" 
      - "MINIO_SECRET_KEY=12345678"
    command: "server /data"
EOF

docker-compose up -d  # 启动容器

docker-compose logs -f  # 启动后观察容器启动情况

environment 变量更多配置,请参考对应 文档 说明

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
https://www.chenshaowen.com/blog/backup-kubernetes-cluster-using-velero.html  # 参考博客


mkdir -p  /data/velero/ \
&& cd /data/velero/

cat > credentials-velero << EOF
[default]
aws_access_key_id = admin
aws_secret_access_key = 12345678
EOF


wget https://github.com/vmware-tanzu/velero/releases/download/v1.6.0/velero-v1.6.0-linux-amd64.tar.gz


tar xf velero-v1.6.0-linux-amd64.tar.gz

cp -a velero-v1.6.0-linux-amd64/velero /usr/local/bin/


velero version  # 打印版本
Client:
        Version: v1.6.0
        Git commit: 5bd70fd8eef316d220317245e46dc6016c348dce
<error getting server version: no matches for kind "ServerStatusRequest" in version "velero.io/v1">



kubectl create ns velero

velero install \
    --image velero/velero:v1.2.0 \
    --provider aws \
    --bucket velero \
    --namespace velero \
    --secret-file ./credentials-velero \
    --velero-pod-cpu-request 200m \
    --velero-pod-mem-request 200Mi \
    --velero-pod-cpu-limit 1000m \
    --velero-pod-mem-limit 1000Mi \
    --use-volume-snapshots=false \
    --use-restic \
    --restic-pod-cpu-request 200m \
    --restic-pod-mem-request 200Mi \
    --restic-pod-cpu-limit 1000m \
    --restic-pod-mem-limit 1000Mi \
    --plugins velero/velero-plugin-for-aws:v1.2.0 \
    --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://nps.treesir.pub:1181





velero backup create all-tidy --exclude-namespaces kube-system,ingress-nginx,cattle-system,velero  # 创建备份,排除不想要的命名空间