rook 安装ceph

2019-11-15  本文已影响0人  shangyaqi

//参考文档
https://rook.io/docs/rook/v1.0/ceph-examples.html

下载rook 项目
https://github.com/rook/rook

部署
cd cluster/examples/kubernetes/ceph
kubectl create -f common.yaml
kubectl create -f operator.yaml
kubectl create -f cluster-test.yaml

连接验证
kubectl create -f toolbox.yaml

kubectl -n rook-ceph get pod -l "app=rook-ceph-tools"

保证状态running进入容器:
kubectl -n rook-ceph exec -it $(kubectl -n rook-ceph get pod -l "app=rook-ceph-tools" -o jsonpath='{.items[0].metadata.name}') bash

验证命令
ceph status
ceph osd status
ceph df
rados df

删除连接工具
kubectl -n rook-ceph delete deployment rook-ceph-tools

Block Storage 部署测试
部署pool 和storageclass
.rook-release-1.0/cluster/examples/kubernetes/ceph/storageclass-test.yaml
mysql wordpress 项目验证
.rook-release-1.0/cluster/examples/kubernetes/mysql.yaml
.rook-release-1.0/cluster/examples/kubernetes/wordpress.yaml

Object Storage 部署测试
创建对象存储
.rook-release-1.0/cluster/examples/kubernetes/ceph/object-test.yaml
确保rgw pod 运行正常
kubectl -n rook-ceph get pod -l app=rook-ceph-rgw

创建对象存储用户
kubectl create -f object-user.yaml
获取 AccessKey and SecretKey
kubectl -n rook-ceph get secret rook-ceph-object-user-my-store-my-user -o yaml | grep AccessKey | awk '{print 2}' | base64 --decode kubectl -n rook-ceph get secret rook-ceph-object-user-my-store-my-user -o yaml | grep SecretKey | awk '{print2}' | base64 --decode
验证对象存储:
进入toolbox 容器 kubectl -n rook-ceph exec -it $(kubectl -n rook-ceph get pod -l "app=rook-ceph-tools" -o jsonpath='{.items[0].metadata.name}') bash
参考: https://rook.io/docs/rook/v1.0/ceph-toolbox.html
install s3cmd:
yum --assumeyes install s3cmd

export AWS_HOST=<host> //rook-ceph-rgw-my-store.rook-ceph
export AWS_ENDPOINT=<endpoint> //kubectl -n rook-ceph get svc rook-ceph-rgw-my-store
export AWS_ACCESS_KEY_ID=<accessKey>
export AWS_SECRET_ACCESS_KEY=<secretKey>

创建桶
s3cmd mb --no-ssl --host={AWS_HOST} --host-bucket= s3://rookbucket 列出桶 s3cmd ls --no-ssl --host={AWS_HOST}

上传对象:
echo "Hello Rook" > /tmp/rookObj
s3cmd put /tmp/rookObj --no-ssl --host={AWS_HOST} --host-bucket= s3://rookbucket 下载对象: s3cmd get s3://rookbucket/rookObj /tmp/rookObj-download --no-ssl --host={AWS_HOST} --host-bucket=
cat /tmp/rookObj-download

部署测试Shared File System (共享文件存储)
创建文件存储对象
.rook-release-1.0/cluster/examples/kubernetes/ceph/filesystem-test.yaml

验证mds 启动pod正常
kubectl -n rook-ceph get pod -l app=rook-ceph-mds
connect to the Rook toolbox, $ ceph status

Create the directory

mkdir /tmp/registry

Detect the mon endpoints and the user secret for the connection

mon_endpoints=(grep mon_host /etc/ceph/ceph.conf | awk '{print3}')
my_secret=(grep key /etc/ceph/keyring | awk '{print3}')

Mount the file system

mount -t ceph -o mds_namespace=myfs,name=admin,secret=my_secretmon_endpoints:/ /tmp/registry

See your mounted file system

df -h

上一篇 下一篇

猜你喜欢

热点阅读