From 5d5c7619a1f00fad310f0ff03baefdada50c27a5 Mon Sep 17 00:00:00 2001 From: chenrui Date: Tue, 11 Dec 2018 13:05:46 -0500 Subject: [PATCH] zh-trans: add docs/getting-started-guides/ubuntu/storage.md (#11651) * zh-trans: add docs/getting-started-guides/ubuntu/storage.md * zh-trans: updates per comments --- .../getting-started-guides/ubuntu/storage.md | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 content/zh/docs/getting-started-guides/ubuntu/storage.md diff --git a/content/zh/docs/getting-started-guides/ubuntu/storage.md b/content/zh/docs/getting-started-guides/ubuntu/storage.md new file mode 100644 index 0000000000..04aa262d9b --- /dev/null +++ b/content/zh/docs/getting-started-guides/ubuntu/storage.md @@ -0,0 +1,138 @@ +--- +title: 存储 +content_template: templates/task +--- + + + +{{% capture overview %}} + + +本文解释了如何在集群中安装和配置持久化存储。 + +{{% /capture %}} + +{{% capture prerequisites %}} + + +本文假设您已经有一个用 Juju 部署、正在运行的集群。 + +{{% /capture %}} + +{{% capture steps %}} + + +## Ceph 持久卷 + + + +Canonical 的 Kubernetes 发行版允许添加持久化存储设备,例如 [Ceph](http://ceph.com)。 +配合 [Juju Storage](https://jujucharms.com/docs/2.0/charms-storage)功能, +可以跨云平台,添加持久化存储。 + + + +部署一个至少有三个 ceph-mon 和三个 ceph-osd 单元的存储池。 + +``` +juju deploy cs:ceph-mon -n 3 +juju deploy cs:ceph-osd -n 3 +``` + + +关联这些单元: + +``` +juju add-relation ceph-mon ceph-osd +``` + + +列出云上 Juju 可用的存储池: + + juju storage-pools + + +输出: + +``` +Name Provider Attrs +ebs ebs +ebs-ssd ebs volume-type=ssd +loop loop +rootfs rootfs +tmpfs tmpfs +``` + +{{< note >}} + + + +注意列表使用的是 AWS,不同的云有不同的存储池名称。 + +{{< /note >}} + + + +以 “名字,大小,数量”的格式往 ceph-osd charm 中添加存储池: + +``` +juju add-storage ceph-osd/0 osd-devices=ebs,10G,1 +juju add-storage ceph-osd/1 osd-devices=ebs,10G,1 +juju add-storage ceph-osd/2 osd-devices=ebs,10G,1 +``` + + +接下来将 Kubernetes 和存储集群相关联: + +``` +juju add-relation kubernetes-master ceph-mon +``` + + + + +现在我们可以在 Kubernetes 中列举可用的[持久卷](/docs/concepts/storage/persistent-volumes/), +集群中的负载可以通过 PVC 申领来使用这些持久卷。 + +``` +juju run-action kubernetes-master/0 create-rbd-pv name=test size=50 +``` + + + +本例中创建了 50 MB 大小的 “test” Rados 块设备 (rbd)。 + +在 Kubernetes 集群上使用如下所示的 watch 命令,可以看到 PV 加入列表,并被标记可用的过程: + + watch kubectl get pv + + +输出: + +``` +NAME CAPACITY ACCESSMODES STATUS CLAIM REASON AGE + +test 50M RWO Available 10s +``` + + + +要使用这些持久卷,pods 需要关联一个持久卷申领,这超出了本文档的讨论范围。 +参见[持久卷](/docs/concepts/storage/persistent-volumes/)获取更多信息。 + +{{% /capture %}}