创建账号
进入ceph-tools pod
代码语言:javascript复制kubectl -n rook-ceph exec -it rook-ceph-tools-6ccb958485-j7pvb bash
查看可用的对象存储
代码语言:javascript复制[root@rook-ceph-tools-6ccb958485-j7pvb /]# radosgw-admin realm list
{
"default_info": "11f77019-6723-4932-9bd4-d253077d8bca",
"realms": [
"my-store"
]
}
查看可用的对象存储组
代码语言:javascript复制[root@rook-ceph-tools-6ccb958485-j7pvb /]# radosgw-admin zonegroup list
{
"default_info": "fcdf8b04-bfba-492b-b1db-9f89771c85cc",
"zonegroups": [
"my-store"
]
}
创建账号
代码语言:javascript复制radosgw-admin user create --uid rgw-gitlab --display-name "user for gitlab runner cache" --rgw-realm=my-store --rgw-zonegroup=my-store
得到AK/SK
代码语言:javascript复制{
"user": "rgw-gitlab",
"access_key": "06SHK9ONNRLXB7KSQ4P3",
"secret_key": "AudsraBSwjVm5hjLZ7XoBmA6Pe5Cj7JBYnT4GyTC"
}
查看账号
代码语言:javascript复制[root@rook-ceph-tools-6ccb958485-j7pvb /]# radosgw-admin user list
[
"rgw-gitlab"
]
创建bucket
注:以下操作都是在k8s集群内的node上操作的
安装s5cmd
在集群内安装s5cmd,用它来和ceph交互
代码语言:javascript复制curl https://ghproxy.com/https://github.com/peak/s5cmd/releases/download/v2.0.0-beta.2/s5cmd_2.0.0-beta.2_Linux-64bit.tar.gz -O
tar -zxvf s5cmd_2.0.0-beta.2_Linux-64bit.tar.gz
mv s5cmd /usr/local/bin/
找到ceph对象存储的service
代码语言:javascript复制root@lvs-172-30-3-192:~# kubectl -n rook-ceph get svc|grep rgw
rook-ceph-rgw-my-store ClusterIP x.x.x.x <none> 80/TCP 2d21h
配置s5cmd
代码语言:javascript复制export S3_ENDPOINT_URL="http://x.x.x.x:80"
export AWS_ACCESS_KEY_ID=06SHK9ONNRLXB7KSQ4P3
export AWS_SECRET_ACCESS_KEY=AudsraBSwjVm5hjLZ7XoBmA6Pe5Cj7JBYnT4GyTC
- url来自ceph对象存储的service
- AK/SK来自创建账号得到的AK/SK
创建bucket
代码语言:javascript复制root@node1:~# s5cmd mb s3://gitlab-runner-cache-bucket
mb s3://gitlab-runner-cache-bucket
查看bucket
代码语言:javascript复制root@node1:~# s5cmd ls
2022/05/13 07:54:24 s3://gitlab-runner-cache-bucket