{"id":73775,"date":"2026-02-08T11:44:04","date_gmt":"2026-02-08T03:44:04","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/73775.html"},"modified":"2026-02-08T11:44:04","modified_gmt":"2026-02-08T03:44:04","slug":"openebs-%e4%ba%91%e5%8e%9f%e7%94%9f-cns-%e9%ab%98%e6%80%a7%e8%83%bd%e5%ad%98%e5%82%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/73775.html","title":{"rendered":"OpenEBS \u2014 \u4e91\u539f\u751f CNS \u9ad8\u6027\u80fd\u5b58\u50a8"},"content":{"rendered":"<h2>\u4e00\u3001OpenEBS\u6982\u8ff0<\/h2>\n<h3>1.1 OpenEBS\u7684\u6838\u5fc3\u6982\u5ff5<\/h3>\n<p>OpenEBS \u662f\u4e00\u4e2a\u5b8c\u5168 Kubernetes \u539f\u751f&#xff08;Cloud Native Storage&#xff09; \u7684\u5f00\u6e90\u5b58\u50a8\u89e3\u51b3\u65b9\u6848&#xff0c;\u5b83\u80fd\u5c06 Kubernetes \u8282\u70b9\u4e0a\u7684\u53ef\u7528\u5b58\u50a8\u8d44\u6e90\u8f6c\u5316\u6210 Persistent Volumes&#xff08;\u6301\u4e45\u5377&#xff09; \u4f9b\u5bb9\u5668\u5316\u5e94\u7528\u4f7f\u7528\u3002\u5b83\u901a\u8fc7 Container Attached Storage (CAS) \u67b6\u6784\u76f4\u63a5\u628a\u5b58\u50a8\u5f15\u64ce\u4ee5\u5bb9\u5668\u65b9\u5f0f\u90e8\u7f72\u5728 Kubernetes \u96c6\u7fa4\u4e2d&#xff0c;\u7531 Kubernetes \u81ea\u5df1\u6765\u8c03\u5ea6\u4e0e\u7ba1\u7406\u3002<\/p>\n<p>\u7b80\u800c\u8a00\u4e4b&#xff1a;<\/p>\n<ul>\n<li>\n<p>OpenEBS \u628a\u6bcf\u4e2a Kubernetes \u8282\u70b9\u53d8\u6210\u4e00\u4e2a\u5b58\u50a8\u670d\u52a1\u5668&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u901a\u8fc7 Kubernetes API \u8fdb\u884c\u5b58\u50a8\u7684\u751f\u547d\u5468\u671f\u7ba1\u7406&#xff08;\u521b\u5efa\u3001\u7ed1\u5b9a\u3001\u6269\u5bb9\u3001\u5220\u9664\u7b49&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b8c\u5168\u4e0d\u7528\u989d\u5916\u7684\u5b58\u50a8\u96c6\u7fa4\u6216\u8005\u4f20\u7edf\u5916\u90e8 SAN\/NAS\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>1.2.\u00a0OpenEBS\u6838\u5fc3\u67b6\u6784\u4e0e\u7ec4\u4ef6<\/h3>\n<p>OpenEBS \u67b6\u6784\u5927\u81f4\u5206\u6210\u4e24\u4e2a\u4e3b\u8981\u90e8\u5206&#xff1a;<\/p>\n<h4>&#x1f539; 1) Data Engines&#xff08;\u6570\u636e\u5f15\u64ce&#xff09;<\/h4>\n<p>\u8fd9\u662f\u5904\u7406\u5b9e\u9645 \u8bfb\u5199 I\/O \u7684\u6838\u5fc3\u7ec4\u4ef6&#xff0c;\u8d1f\u8d23&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5c06\u8282\u70b9\u4e0a\u63d0\u4f9b\u7684\u5b58\u50a8\u8d44\u6e90&#xff08;\u672c\u5730\u78c1\u76d8\u3001\u5206\u533a\u3001\u6587\u4ef6\u7cfb\u7edf&#xff09;\u805a\u5408\u6210\u53ef\u7528\u5bb9\u91cf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5916\u63d0\u4f9b\u5377\u670d\u52a1&#xff08;\u901a\u8fc7 CSI \u9a71\u52a8\u66b4\u9732\u5377\u7ed9 Pod&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7ba1\u7406\u6570\u636e\u3001\u590d\u5236\u3001\u5bb9\u9519\u3001\u6545\u969c\u91cd\u5efa\u7b49\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>&#x1f539; 2) Control Plane&#xff08;\u63a7\u5236\u5e73\u9762&#xff09;<\/h4>\n<p>\u8fd9\u662f\u63a7\u5236 OpenEBS \u8fd0\u8f6c\u7684\u201c\u5927\u8111\u201d&#xff0c;\u8d1f\u8d23&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7ba1\u7406 Kubernetes \u8282\u70b9\u4e0a\u7684\u5b58\u50a8\u8d44\u6e90&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e0e CSI&#xff08;Container Storage Interface&#xff09;\u96c6\u6210&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u54cd\u5e94 PVC \u8bf7\u6c42\u5e76\u6839\u636e StorageClass \u52a8\u6001\u751f\u6210 PV&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5904\u7406\u5377\u7684\u6269\u5bb9\u3001\u5feb\u7167\u3001\u5907\u4efd\u6062\u590d\u7b49\u63a7\u5236\u529f\u80fd&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6240\u6709\u914d\u7f6e\u90fd\u901a\u8fc7 Kubernetes Custom Resource Definitions (CRDs) \u6258\u7ba1\u3002<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4cc; \u6240\u6709 OpenEBS \u63a7\u5236\u7ec4\u4ef6\u548c\u6570\u636e\u5f15\u64ce\u672c\u8eab\u5c31\u662f Kubernetes Pod&#xff0c;\u7531 Kubernetes \u8c03\u5ea6\u548c\u7ba1\u7406\u3002<\/p>\n<table>\n<tr>\u7ec4\u522bPod \u540d\u79f0\u793a\u4f8b\u5bb9\u5668\u6570\u4f5c\u7528\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>CSI \u901a\u7528\u7ec4\u4ef6<\/td>\n<td>openebs-csi-controller-* openebs-csi-node-*<\/td>\n<td>6\/6 2\/2<\/td>\n<td>CSI \u63a7\u5236\u5668&#xff08;\u96c6\u7fa4\u7ea7&#xff0c;\u5904\u7406\u5377 provision\u3001snapshot \u7b49&#xff09;\u548c\u8282\u70b9\u63d2\u4ef6&#xff08;\u5904\u7406 attach\/detach\/mount&#xff09;\u3002\u6240\u6709 OpenEBS \u5f15\u64ce\u5171\u7528&#xff0c;\u662f\u4e0e Kubernetes \u96c6\u6210\u7684\u6865\u6881\u3002<\/td>\n<\/tr>\n<tr>\n<td>LocalPV \u5f15\u64ce<\/td>\n<td>openebs-localpv-provisioner-* openebs-lvm-localpv-controller-* openebs-lvm-localpv-node-* openebs-zfs-localpv-controller-* openebs-zfs-localpv-node-*<\/td>\n<td>1\/1 5\/5 2\/2 5\/5 2\/2<\/td>\n<td>Dynamic LocalPV \u901a\u7528 provisioner\u3002 LVM\/ZFS \u4e13\u7528\u63a7\u5236\u5668&#xff08;\u96c6\u7fa4\u7ea7&#xff09;\u548c\u8282\u70b9\u63d2\u4ef6&#xff08;\u5904\u7406\u672c\u5730\u5377\u521b\u5efa\u3001\u683c\u5f0f\u5316&#xff09;\u3002\u63d0\u4f9b\u8282\u70b9\u672c\u5730\u6301\u4e45\u5377&#xff08;\u4f4e\u5ef6\u8fdf\u3001\u65e0\u590d\u5236&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>Replicated PV Mayastor&#xff08;\u590d\u5236\u9ad8\u53ef\u7528\u5f15\u64ce&#xff09;<\/td>\n<td>openebs-io-engine-node-* openebs-agent-core-* openebs-agent-ha-node-* openebs-operator-diskpool-*<\/td>\n<td>2\/2 2\/2 1\/1 1\/1<\/td>\n<td>Mayastor \u6570\u636e\u5e73\u9762\u6838\u5fc3 DaemonSet&#xff0c;\u8d1f\u8d23\u5b9e\u9645 IO \u5904\u7406\u3001\u540c\u6b65\u590d\u5236\u3001NVMe-oF \u66b4\u9732\u5377&#xff08;\u9ad8\u6027\u80fd&#xff09;\u3002\u4f60\u770b\u5230 3 \u4e2a\u90fd\u5728 node2 \u4e0a&#xff0c;\u8bf4\u660e\u53ea\u6709\u8be5\u8282\u70b9\u88ab\u6807\u8bb0\u4e3a\u53ef\u7528\u78c1\u76d8\u8282\u70b9\u3002 Mayastor \u6838\u5fc3 agent \u548c HA agent&#xff0c;\u8d1f\u8d23\u8282\u70b9\u6ce8\u518c\u3001\u6545\u969c\u68c0\u6d4b\u3002 \u78c1\u76d8\u6c60&#xff08;DiskPool&#xff09;Operator&#xff0c;\u7ba1\u7406\u5e95\u5c42\u78c1\u76d8\u8d44\u6e90\u3002<\/td>\n<\/tr>\n<tr>\n<td>Mayastor \u57fa\u7840\u8bbe\u65bd<\/td>\n<td>openebs-nats-* openebs-etcd-*<\/td>\n<td>3\/3 1\/1<\/td>\n<td>NATS \u96c6\u7fa4&#xff08;\u6d88\u606f\u603b\u7ebf&#xff09;&#xff0c;Mayastor \u63a7\u5236\u5e73\u9762\u7528\u4e8e\u4e8b\u4ef6\u53d1\u5e03\/\u8ba2\u9605\u3001\u5206\u5e03\u5f0f\u534f\u8c03\u3002 etcd \u96c6\u7fa4&#xff0c;\u6301\u4e45\u5316 Mayastor \u63a7\u5236\u5e73\u9762\u72b6\u6001&#xff08;\u5377\u5143\u6570\u636e\u3001\u6c60\u914d\u7f6e\u7b49&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u53ef\u89c2\u6d4b\u6027&#xff08;Observability&#xff09;\u6808<\/td>\n<td>openebs-alloy-* openebs-loki-* openebs-minio-*<\/td>\n<td>2\/2 2\/2 1\/1<\/td>\n<td>Grafana Alloy&#xff08;OpenTelemetry Collector&#xff09;&#xff0c;\u6536\u96c6\u6307\u6807\u3001\u75d5\u8ff9&#xff0c;\u53d1\u9001\u5230 Prometheus\/Grafana\u3002 Loki \u5206\u5e03\u5f0f\u65e5\u5fd7\u7cfb\u7edf&#xff0c;\u96c6\u4e2d\u6536\u96c6\u6240\u6709 OpenEBS \u7ec4\u4ef6\u65e5\u5fd7\u3002 MinIO \u5206\u5e03\u5f0f\u5bf9\u8c61\u5b58\u50a8&#xff0c;\u4f5c\u4e3a Loki \u7684\u540e\u7aef\u5b58\u50a8&#xff08;\u4e5f\u53ef\u80fd\u7528\u4e8e\u5feb\u7167\/\u5907\u4efd&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5176\u4ed6\u8f85\u52a9\u7ec4\u4ef6<\/td>\n<td>openebs-api-rest-* openebs-obs-callhome-*<\/td>\n<td>1\/1 2\/2<\/td>\n<td>REST API \u670d\u52a1&#xff0c;\u63d0\u4f9b\u7ba1\u7406\u63a5\u53e3&#xff08;\u53ef\u80fd\u7528\u4e8e Mayastor \u6216\u6574\u4f53\u63a7\u5236\u5e73\u9762&#xff09;\u3002 \u9065\u6d4b\/\u547c\u53eb\u56de\u5bb6\u7ec4\u4ef6&#xff0c;\u533f\u540d\u4e0a\u62a5\u4f7f\u7528\u7edf\u8ba1&#xff08;\u53ef\u7981\u7528&#xff09;\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>&#x1f539; 3) OpenEBS\u67b6\u6784\u56fe<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1403\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208034401-6988068193c0d.png\" width=\"2549\" \/><\/p>\n<h4>&#x1f539; 4) \u7b80\u5355\u7684\u5de5\u4f5c\u6d41\u7a0b\u6982\u8ff0<\/h4>\n<p>\u4f60\u5728 YAML \u91cc\u5199\u4e00\u4e2a PVC&#xff08;\u8bf4\u201c\u6211\u8981 10G \u5b58\u50a8\u201d&#xff09;\u3002<\/p>\n<p>CSI \u7ec4\u4ef6\u6536\u5230\u8bf7\u6c42&#xff0c;\u53bb\u95ee\u63a7\u5236\u5e73\u9762\u3002<\/p>\n<p>\u63a7\u5236\u5e73\u9762&#xff08;Operators&#xff09;\u51b3\u5b9a\u7528\u54ea\u4e2a\u5f15\u64ce&#xff08;LocalPV \u8fd8\u662f Mayastor&#xff09;&#xff0c;\u7136\u540e\u5728\u6709\u78c1\u76d8\u7684\u8282\u70b9\u4e0a\u521b\u5efa\u5377\u3002<\/p>\n<p>\u6570\u636e\u5e73\u9762&#xff08;io-engine \u6216 LocalPV node \u63d2\u4ef6&#xff09;\u771f\u6b63\u628a\u6570\u636e\u5199\u5230\u78c1\u76d8\u4e0a\u3002<\/p>\n<p>\u5377\u6302\u8f7d\u5230\u4f60\u7684\u5e94\u7528 Pod&#xff0c;\u4f60\u5c31\u6b63\u5e38\u8bfb\u5199\u6570\u636e\u4e86\u3002<\/p>\n<p>\u5982\u679c\u7528 Mayastor&#xff0c;\u5b83\u8fd8\u4f1a\u81ea\u52a8\u628a\u6570\u636e\u590d\u5236\u5230\u5176\u4ed6\u8282\u70b9&#xff0c;\u786e\u4fdd\u5b89\u5168\u3002<\/p>\n<p>\u603b\u4f53\u4ea4\u4e92\u6d41\u7a0b&#xff1a;Kubernetes \u901a\u8fc7 PVC\/StorageClass \u53d1\u8d77\u5377\u8bf7\u6c42 \u2192 \u63a7\u5236\u5e73\u9762&#xff08;CSI &#043; Operators&#xff09;provision \u5377\u5e76\u90e8\u7f72\u526f\u672c\/\u76ee\u6807 Pod \u2192 \u6570\u636e\u5f15\u64ce\u7684\u5206\u5c42\u7ed3\u6784\u5904\u7406\u5b9e\u9645\u5b58\u50a8\u548c\u8bbf\u95ee \u2192 \u5e94\u7528\u901a\u8fc7\u6807\u51c6\u65b9\u5f0f\u8bfb\u5199\u6570\u636e\u3002<\/p>\n<p>\u4f60\u7684\u96c6\u7fa4 Pod \u8fd9\u4e48\u591a&#xff0c;\u662f\u56e0\u4e3a\u9ed8\u8ba4\u5b89\u88c5\u628a\u201c\u5168\u5bb6\u6876\u201d\u90fd\u5f00\u4e86&#xff08;LocalPV &#043; Mayastor &#043; \u76d1\u63a7\u5168\u4e0a&#xff09;\u3002<\/p>\n<p>\u5b9e\u9645\u7528\u65f6\u53ef\u4ee5\u53ea\u5f00\u4e00\u79cd\u5f15\u64ce&#xff0c;\u6bd4\u5982\u53ea\u60f3\u9ad8\u53ef\u7528\u5c31\u7559 Mayastor&#xff08;io-engine \u90a3\u5806&#xff09;&#xff0c;\u5176\u4ed6\u53ef\u4ee5\u5378\u8f7d&#xff0c;\u7701\u8d44\u6e90\u3002<\/p>\n<h3>1.3. OpenEBS\u7684\u4e3b\u8981\u5b58\u50a8\u7c7b\u578b<\/h3>\n<h4>1) Local Volumes&#xff08;\u672c\u5730\u5377&#xff09;<\/h4>\n<ul>\n<li>\n<p>\u6570\u636e\u4ec5\u9a7b\u7559\u5728\u521b\u5efa\u8be5\u5377\u7684\u5355\u4e2a\u8282\u70b9\u4e0a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Pod \u5fc5\u987b\u8c03\u5ea6\u5230\u8be5\u8282\u70b9\u624d\u80fd\u8bbf\u95ee\u5377&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6027\u80fd\u4f4e\u5ef6\u8fdf\u3001\u9ad8\u541e\u5410&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5e38\u7528\u4e8e\u5206\u5e03\u5f0f\u6570\u636e\u5e93\u6216\u6709\u81ea\u8eab\u9ad8\u53ef\u7528\u673a\u5236\u7684\u5e94\u7528\u3002<\/p>\n<\/li>\n<\/ul>\n<p>Local \u7c7b\u578b\u6709\u591a\u4e2a\u5b9e\u73b0&#xff0c;\u6bd4\u5982 HostPath\u3001LVM\u3001ZFS \u7b49&#xff0c;\u9009\u62e9\u4e0d\u540c\u5f15\u64ce\u4f1a\u5f71\u54cd\u6027\u80fd\u548c\u7279\u6027\u3002<\/p>\n<hr \/>\n<h4>2) Replicated Volumes&#xff08;\u526f\u672c\u5377\/\u590d\u5236\u5377&#xff09;<\/h4>\n<ul>\n<li>\n<p>\u6570\u636e\u5728\u591a\u4e2a\u8282\u70b9\u4e0a\u540c\u6b65\u590d\u5236&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u652f\u6301\u8de8\u8282\u70b9\u5bb9\u9519\u3001\u8282\u70b9\u6545\u969c\u81ea\u52a8\u6062\u590d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u901a\u5e38\u5177\u5907\u66f4\u5f3a\u7684\u6570\u636e\u53ef\u9760\u6027\u4e0e\u53ef\u7528\u6027&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9002\u7528\u4e8e\u9700\u8981\u9ad8\u8010\u4e45\u6027\u548c\u8de8\u53ef\u7528\u533a\u652f\u6301\u7684\u573a\u666f\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u526f\u672c\u5377\u53ef\u4ee5\u63d0\u4f9b\u5feb\u7167\u3001\u514b\u9686\u3001\u6269\u5bb9\u7b49\u4f01\u4e1a\u7ea7\u5b58\u50a8\u7279\u6027\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u672c\u5730\u5b58\u50a8\u66f4\u9002\u5408\u5206\u5e03\u5f0f\u5de5\u4f5c\u8d1f\u8f7d&#xff1f;<br \/>\n\u00a0\u00a0 \u00a0\u8fd9\u4e9b\u5206\u5e03\u5f0f\u6570\u636e\u5e93&#xff08;\u670d\u52a1&#xff09;\u81ea\u8eab\u5df2\u7ecf\u5b9e\u73b0\u4e86\u6570\u636e\u5206\u7247\u3001\u590d\u5236\u548c\u5bb9\u9519\u673a\u5236<br \/>\n\u00a0\u00a0 \u00a0\u672c\u5730\u5b58\u50a8\u65e0\u989d\u5916\u6570\u636e\u8def\u5f84\u5f00\u9500&#xff0c;\u5ef6\u8fdf\u66f4\u4f4e<br \/>\n\u590d\u5236\u5b58\u50a8&#xff08;\u5982OpenEBS\u7684Replicated Volumes&#xff09;\u66f4\u9002\u5408&#xff1a;<br \/>\n\u00a0\u00a0 \u00a0\u975e\u5206\u5e03\u5f0f\u5e94\u7528&#xff08;\u5982MySQL\u5355\u673a\u7248&#xff09;<br \/>\n\u00a0\u00a0 \u00a0\u8fd9\u4e9b\u5e94\u7528\u672c\u8eab\u4e0d\u5177\u5907\u5206\u5e03\u5f0f\u5bb9\u9519\u80fd\u529b<\/p>\n<h3>1.4 CNS\u63d2\u66f2<\/h3>\n<h4>1) \u00a0\u4ec0\u4e48\u662f Container Native Storage (CNS)?<\/h4>\n<p>CNS \u662f\u4e00\u79cd\u5c06\u5b58\u50a8\u8f6f\u4ef6\u5b8c\u5168\u5bb9\u5668\u5316\u5e76\u7531 Kubernetes \u7f16\u6392\u7684\u5b58\u50a8\u67b6\u6784\u6a21\u5f0f&#xff0c;\u5b83\u4f7f\u5b58\u50a8\u6210\u4e3a Kubernetes \u539f\u751f\u5e94\u7528\u7684\u4e00\u90e8\u5206&#xff0c;\u800c\u975e\u4f20\u7edf\u5916\u90e8\u5171\u4eab\u5b58\u50a8\u7cfb\u7edf\u3002<\/p>\n<p>\u5b58\u50a8\u8f6f\u4ef6\u5b8c\u5168\u5bb9\u5668\u5316 &#043; \u7531 Kubernetes \u539f\u751f\u7f16\u6392 &#043; \u6bcf\u4e2a\u5b58\u50a8\u5377\u62e5\u6709\u4e13\u5c5e\u5bb9\u5668\u5316\u63a7\u5236\u5668<\/p>\n<p>CNS&#xff08;Container Native Storage&#xff09;\u7684\u6838\u5fc3\u4f18\u52bf\u5728\u4e8e&#xff1a;\u5c06\u5b58\u50a8\u5b8c\u5168\u8f6c\u5316\u4e3aKubernetes\u539f\u751f\u5de5\u4f5c\u8d1f\u8f7d&#xff0c;\u901a\u8fc7\u4e3a\u6bcf\u4e2a\u6301\u4e45\u5377\u914d\u5907\u4e13\u5c5e\u7684\u5bb9\u5668\u5316\u63a7\u5236\u5668&#xff0c;\u5b9e\u73b0\u7ec6\u7c92\u5ea6\u7b56\u7565\u7ba1\u63a7\u3001\u6545\u969c\u5f71\u54cd\u57df\u6700\u5c0f\u5316\u3001\u8de8\u96c6\u7fa4\u65e0\u5382\u5546\u9501\u5b9a\u8fc1\u79fb\u7684\u80fd\u529b&#xff0c;\u4f7f\u5b58\u50a8\u8fd0\u7ef4\u83b7\u5f97\u4e0e\u65e0\u72b6\u6001\u5e94\u7528\u540c\u7b49\u7684\u654f\u6377\u6027\u3001\u53ef\u79fb\u690d\u6027\u4e0e\u53ef\u9760\u6027&#xff0c;\u5f7b\u5e95\u6446\u8131\u4f20\u7edf\u5b58\u50a8\u7684\u590d\u6742\u67b6\u6784\u4e0e\u4f9b\u5e94\u5546\u4f9d\u8d56\u3002<\/p>\n<p>\u6bcf\u4e2a Persistent Volume&#xff08;PV&#xff09;\u5728 Kubernetes \u4e2d\u90fd\u62e5\u6709\u4e00\u4e2a\u201c\u4e13\u5c5e\u7ba1\u5bb6 Pod\u201d \u2014\u2014 \u8fd9\u4e2a Pod \u5c31\u662f\u5bb9\u5668\u5316\u7684\u5b58\u50a8\u63a7\u5236\u5668\u3002\u5b83\u4e13\u5c5e\u4e8e\u8be5\u5377&#xff0c;\u53ea\u5904\u7406\u8fd9\u4e2a\u5377\u7684\u8bfb\u5199\u8bf7\u6c42\u3001\u5feb\u7167\u3001\u590d\u5236\u7b49\u903b\u8f91&#xff0c;\u4e0e\u5176\u4ed6\u5377\u5b8c\u5168\u9694\u79bb\u3002<\/p>\n<p>OpenEBS \u662f CNS \u6982\u5ff5\u7684\u5b9e\u73b0&#xff0c;\u5b83\u901a\u8fc7\u5bb9\u5668\u5316\u5b58\u50a8\u63a7\u5236\u5668\u548c Kubernetes \u539f\u751f API&#xff0c;\u4f7f Kubernetes \u6709\u72b6\u6001\u5de5\u4f5c\u8d1f\u8f7d\u7684\u5b58\u50a8\u7ba1\u7406\u53d8\u5f97\u7b80\u5355\u3001\u9ad8\u6548\u4e14\u53ef\u6269\u5c55\u3002<\/p>\n<h2>\u4e8c\u3001\u5b89\u88c5\u4e0e\u8fd0\u884cOpenEBS<\/h2>\n<p>OpenEBS \u652f\u6301&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4efb\u4f55 Kubernetes \u96c6\u7fa4&#xff08;\u4e91\u4e0a\u3001\u88f8\u91d1\u5c5e\u3001\u5f00\u53d1\u73af\u5883\u5982 Minikube\/MicroK8s&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528 Helm \u6216 kubectl \u76f4\u63a5\u90e8\u7f72&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u652f\u6301\u4e3b\u6d41\u76d1\u63a7&#xff08;Prometheus\u3001Grafana&#xff09;\u4e0e\u5de5\u5177\u96c6\u6210\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u91cc\u4f7f\u7528Helm\u4e00\u952e\u90e8\u7f72\u4e0e\u5b89\u88c5<\/p>\n<h3>2.1\u00a0\u5b89\u88c5\u524d\u7f6e\u51c6\u5907<\/h3>\n<p>\u8bf7\u5b89\u88c5\u524d\u4e00\u5b9a\u8981\u4ed4\u7ec6\u9605\u8bfb&#xff0c;\u5e76\u4e0d\u662f\u8981\u6c42\u6240\u6709\u7684\u73af\u5883\u90fd\u8981\u51c6\u5907&#xff0c;\u8fd9\u53d6\u51b3\u4e8e\u4f60\u8981\u4f7f\u7528\u54ea\u79cd\u5b58\u50a8\u6a21\u5f0f&#xff01;<\/p>\n<p>1.K8S\u7ba1\u7406\u6743\u9650<\/p>\n<p>\u4f60\u5fc5\u987b\u6709 cluster-admin&#xff08;\u96c6\u7fa4\u7ba1\u7406\u5458\u6743\u9650&#xff09; \u4e0a\u4e0b\u6587&#xff08;admin context&#xff09;\u624d\u80fd\u5b89\u88c5 OpenEBS\u3002<\/p>\n<p>[root&#064;k8s-master ~\/openEBS]# cat \/root\/.kube\/config<br \/>\n&#8230;<br \/>\nkind: Config<br \/>\npreferences: {}<br \/>\nusers:<br \/>\n&#8211; name: kubernetes-admin ##<\/p>\n<p>2.\u8282\u70b9\u9700\u8981\u80fd\u8bbf\u95ee\u7269\u7406\u8bbe\u5907\u6216\u76ee\u5f55<\/p>\n<p>OpenEBS \u4f1a\u5728 Kubernetes \u8282\u70b9\u4e0a\u4f7f\u7528\u7269\u7406\u78c1\u76d8\u3001\u6587\u4ef6\u7cfb\u7edf\u76ee\u5f55\u3001LVM\u3001ZFS \u6c60\u7b49\u505a\u6301\u4e45\u5b58\u50a8\u3002\u56e0\u6b64\u4f60\u9700\u8981&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u51b3\u5b9a\u54ea\u4e9b\u78c1\u76d8\u6216\u76ee\u5f55\u5c06\u88ab OpenEBS \u4f7f\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5982\u679c\u9700\u8981 LVM \u6216 ZFS&#xff0c;\u9700\u8981\u63d0\u524d \u521b\u5efa Volume Group \u6216 ZFS \u6c60&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5728\u4e00\u4e9b\u6258\u7ba1 Kubernetes \u5e73\u53f0&#xff08;\u5982 Rancher\/RKE\u3001MicroK8s&#xff09;\u4e0a&#xff0c;\u8fd8\u8981\u6b63\u786e\u914d\u7f6e bind mounts&#xff08;\u7ed1\u5b9a\u6302\u8f7d&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<p>3.\u5404\u79cd\u5b58\u50a8\u5f15\u64ce\u7684\u51c6\u5907\u5de5\u4f5c<\/p>\n<p>OpenEBS \u63d0\u4f9b\u591a\u79cd\u6570\u636e\u5f15\u64ce&#xff0c;\u4e0d\u540c\u5f15\u64ce\u5bf9\u8282\u70b9\u73af\u5883\u6709\u4e0d\u540c\u7684\u524d\u7f6e\u6761\u4ef6\u3002\u4ee5\u4e0b\u662f\u5b98\u65b9\u8bf4\u660e\u7684\u4e3b\u8981\u5f15\u64ce\u53ca\u51c6\u5907\u8981\u70b9&#xff1a;<\/p>\n<p>A. Local PV Hostpath<\/p>\n<p>\u672c\u5730 Hostpath \u5f15\u64ce\u7528\u4e8e\u6700\u7b80\u5355\u7684\u672c\u5730\u5377&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u9700\u8981\u5728\u6bcf\u4e2a\u8282\u70b9\u521b\u5efa\u4e00\u4e2a\u76ee\u5f55\u4f5c\u4e3a\u5b58\u50a8\u57fa\u7840\u8def\u5f84&#xff08;BasePath&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u9ed8\u8ba4 BasePath \u662f&#xff1a;\/var\/openebs\/local\u3002\u5982\u679c\u91c7\u7528HostPath\u7684\u65b9\u5f0f&#xff0c;\u8fd9\u4e2a\u9ed8\u8ba4\u76ee\u5f55\u5fc5\u987b\u5b58\u5728\u3002<\/p>\n<\/li>\n<li>\n<p>BasePath \u4e5f\u53ef\u4ee5\u662f\u5176\u4ed6\u6302\u8f7d\u70b9&#xff0c;\u5982 SSD \u6302\u8f7d\u76ee\u5f55\u6216\u4e91\u76d8\u6302\u8f7d\u76ee\u5f55\u3002<\/p>\n<\/li>\n<\/ul>\n<p>B. Local PV LVM<\/p>\n<p>\u4f7f\u7528 LVM \u505a\u672c\u5730\u5757\u8bbe\u5907\u5377\u65f6&#xff0c;\u8282\u70b9\u5fc5\u987b\u6ee1\u8db3&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6240\u6709\u8282\u70b9\u5b89\u88c5 lvm2 \u5de5\u5177\u5305&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8282\u70b9\u5185\u6838\u52a0\u8f7d dm-snapshot module&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5728\u6240\u6709\u8282\u70b9\u4e0a\u521b\u5efa\u4e00\u4e2a Volume Group&#xff08;VG&#xff09;&#xff0c;\u4f9b OpenEBS LVM \u5f15\u64ce\u4f7f\u7528\u3002<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4a1; \u6307\u4ee4\u793a\u4f8b&#xff08;\u5b98\u65b9&#xff09;&#xff1a; \u521b\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u7528 Volume Group&#xff1a;<\/p>\n<p>truncate -s 1024G \/tmp\/disk.img<br \/>\nlosetup -f \/tmp\/disk.img &#8211;show<br \/>\npvcreate \/dev\/loop0<br \/>\nvgcreate lvmvg \/dev\/loop0<\/p>\n<p>lvmvg \u662f\u521b\u5efa\u7684\u5377\u7ec4\u540d\u5b57\u3002<\/p>\n<p>C. Local PV ZFS<\/p>\n<p>\u4f7f\u7528 ZFS \u505a\u672c\u5730\u5b58\u50a8\u65f6&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6240\u6709\u8282\u70b9\u5fc5\u987b\u5b89\u88c5 zfsutils-linux&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6240\u6709\u8282\u70b9\u4e0a\u9700\u8981\u5148\u521b\u5efa\u4e00\u4e2a ZFS zpool \u4f5c\u4e3a\u5b58\u50a8\u6c60&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd9\u4e2a\u6c60\u53ef\u4ee5\u662f\u5404\u79cd\u7c7b\u578b&#xff08;striped\u3001mirror\u3001raidz&#xff09;\u6309\u9700\u6c42\u9009\u62e9\u3002<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4a1; \u793a\u4f8b\u6d41\u7a0b&#xff1a;<\/p>\n<p>apt-get install zfsutils-linux<br \/>\nzpool create zfspv-pool \/dev\/sdb<br \/>\nzpool status<\/p>\n<p>zfspv-pool \u662f\u521b\u5efa\u7684 ZFS \u6c60\u540d\u79f0\u3002<\/p>\n<p>D. Replicated PV Mayastor&#xff08;\u590d\u5236\u5377&#xff0c;\u9ad8\u7ea7\u5f15\u64ce&#xff09;<\/p>\n<p>\u8fd9\u4e2a\u662f OpenEBS \u7528\u4e8e\u9ad8\u53ef\u9760\u6027\u548c\u9ad8\u6027\u80fd\u7684\u5f15\u64ce&#xff0c;\u5bf9\u73af\u5883\u8981\u6c42\u66f4\u4e25\u683c&#xff1a;<\/p>\n<li>\n<p>\u901a\u7528\u8981\u6c42<\/p>\n<ul>\n<li>\n<p>x86-64 CPU&#xff0c;\u652f\u6301 SSE4.2 \u6307\u4ee4\u96c6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u63a8\u8350 Linux kernel \u2265 5.15&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8282\u70b9\u5fc5\u987b\u6ee1\u8db3 SPI-NVMe\u3001ext4\/xfs \u7b49\u6a21\u5757\u52a0\u8f7d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Helm \u7248\u672c \u2265 v3.7&#xff08;\u5b89\u88c5 Mayastor \u7ec4\u4ef6\u7528&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8d44\u6e90\u8981\u6c42<\/p>\n<ul>\n<li>\n<p>Io-engine pod \u6bcf\u4e2a\u8282\u70b9\u81f3\u5c11&#xff1a;<\/p>\n<ul>\n<li>\n<p>2 \u4e2a CPU \u6838\u5fc3<\/p>\n<\/li>\n<li>\n<p>1GiB RAM<\/p>\n<\/li>\n<li>\n<p>\u652f\u6301 HugePages&#xff08;\u5927\u9875&#xff09;&#xff08;\u81f3\u5c11 2GiB 2MiB \u9875\u9762&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u7f51\u7edc\u8981\u6c42<\/p>\n<ul>\n<li>\n<p>\u786e\u4fdd\u67d0\u4e9b\u7aef\u53e3\u4e0d\u88ab\u5360\u7528&#xff0c;\u5982 gRPC \u670d\u52a1\u7aef\u53e3 10124&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5982\u679c\u7528 NVMe-oF TCP \u534f\u8bae&#xff0c;\u5fc5\u987b\u542f\u7528\u5e76\u4fdd\u8bc1\u8fde\u63a5\u65e0\u9632\u706b\u5899\u963b\u65ad\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u96c6\u7fa4\u89c4\u6a21<\/p>\n<ul>\n<li>\n<p>\u81f3\u5c11 3 \u4e2a worker \u8282\u70b9&#xff08;\u5c24\u5176\u4f7f\u7528\u590d\u5236\/\u955c\u50cf\u5377\u65f6&#xff09;(\u5982\u679c\u6ca1\u67093worker\u6d4b\u8bd5\u73af\u5883\u53ef\u4ee5\u7528master\u4f5c\u4e3a\u7b2c3\u4e2a\u5b58\u50a8\u8282\u70b9)\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u534f\u8bae\u9650\u5236<\/p>\n<ul>\n<li>\n<p>Replicated PV Mayastor \u53ea\u652f\u6301 NVMe-oF over TCP \u65b9\u5f0f\u6302\u8f7d\u5377\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<p>OpenEBS \u5b98\u65b9\u8bf4\u660e\u7684\u57fa\u7840\u517c\u5bb9\u6761\u4ef6&#xff1a;<\/p>\n<table>\n<tr>\u8981\u7d20\u8981\u6c42<\/tr>\n<tbody>\n<tr>\n<td>Kubernetes<\/td>\n<td>1.23 \u6216\u66f4\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>Linux Kernel<\/td>\n<td>5.15 \u6216\u66f4\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u652f\u6301\u64cd\u4f5c\u7cfb\u7edf<\/td>\n<td>Ubuntu \/ RHEL 8.8<\/td>\n<\/tr>\n<tr>\n<td>LVM \u7248\u672c<\/td>\n<td>LVM2<\/td>\n<\/tr>\n<tr>\n<td>ZFS \u7248\u672c<\/td>\n<td>ZFS 0.8&#043;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u672c\u6b21\u5b89\u88c5\u91c7\u7528\u7684LocalVolumes\u662fHostPath\u548cLVM-Volumes<\/p>\n<h4>2.1.1 HostPath\u73af\u5883\u51c6\u5907<\/h4>\n<p>3\u4e2a\u4ece\u8282\u70b9\u914d\u7f6e\u9ed8\u8ba4\u76ee\u5f55&#xff08;\u5982\u679c\u662f\u4e00\u4e3b\u4e24\u4ece\u53ef\u4ee5\u5148\u53bb\u9664master\u7684\u6c61\u70b9\u3002\u7136\u540e\u4e3b\u8282\u70b9\u4e5f\u521b\u5efa\u76ee\u5f55\u3002&#xff09;<\/p>\n<p>[root&#064;k8s-master ~]# kubectl describe nodes |grep -A 5 &#039;Tai&#039;<br \/>\nTaints:             node-role.kubernetes.io\/control-plane:NoSchedule<br \/>\nUnschedulable:      false<br \/>\nLease:<br \/>\n  HolderIdentity:  k8s-master<br \/>\n  AcquireTime:     &lt;unset&gt;<br \/>\n  RenewTime:       Mon, 02 Feb 2026 16:33:06 &#043;0800<br \/>\n&#8212;<br \/>\nTaints:             &lt;none&gt;<br \/>\nUnschedulable:      false<br \/>\nLease:<br \/>\n  HolderIdentity:  k8s-node1<br \/>\n  AcquireTime:     &lt;unset&gt;<br \/>\n  RenewTime:       Mon, 02 Feb 2026 16:33:06 &#043;0800<br \/>\n&#8212;<br \/>\nTaints:             &lt;none&gt;<br \/>\nUnschedulable:      false<br \/>\nLease:<br \/>\n  HolderIdentity:  k8s-node2<br \/>\n  AcquireTime:     &lt;unset&gt;<br \/>\n  RenewTime:       Mon, 02 Feb 2026 16:33:05 &#043;0800<br \/>\n[root&#064;k8s-master ~]# kubectl taint node k8s-master node-role.kubernetes.io\/control-plane:NoSchedule-<br \/>\nnode\/k8s-master untainted<\/p>\n<p>\u4e0a\u8ff0\u6587\u4e2d&#xff0c;\u5df2\u7ecf\u63d0\u5230&#xff0c;\u9488\u5bf9\u4e8eLocal-Volumes\u7684\u5b58\u50a8\u6a21\u5f0f&#xff0c;\u6211\u4eec\u4f7f\u7528HostPath\u548cLVM-Volumes\u7684\u65b9\u5f0f&#xff0c;\u6240\u4ee5\u8fd9\u91cc\u6211\u4eec\u8981\u63d0\u524d\u51c6\u5907\u597d\u73af\u5883\u3002<\/p>\n<p>\u521b\u5efaHostPath\u7684\u9ed8\u8ba4\u5b58\u50a8\u76ee\u5f55<\/p>\n<p>mkdir -p \/var\/openebs\/local<br \/>\nchown root:root \/var\/openebs\/local<br \/>\nchmod 777 \/var\/openebs\/local<\/p>\n<p>Local PV HostPath \u7684 basePath \u5fc5\u987b\u5177\u5907 x \u6743\u9650&#xff0c;\u81f3\u5c11 755&#xff0c;\u5426\u5219 provisioner \u65e0\u6cd5\u521b\u5efa PV \u76ee\u5f55\u3002<\/p>\n<h4>2.1.2\u00a0LVM-Volumes\u73af\u5883\u51c6\u5907<\/h4>\n<ul>\n<li>\u53ef\u4ee5\u4f7f\u7528loopback \u865a\u62df\u78c1\u76d8&#xff08;\u5b98\u65b9\u63a8\u8350\u7684\u6d4b\u8bd5\u65b9\u5f0f&#xff0c;\u4e0d\u4f1a\u5360\u7528\u771f\u5b9e\u5b58\u50a8&#xff09;\u3002<\/li>\n<li>\u4e5f\u53ef\u4ee5\u7ed9\u670d\u52a1\u5668\u52a0\u4e00\u5757\u5168\u65b0\u672a\u4f7f\u7528\u7684\u78c1\u76d8&#xff0c;\u5982\u679c\u4f60\u662fVM\u865a\u62df\u73af\u5883\u53ef\u4ee5\u76f4\u63a5&#xff0c;\u7136\u540e\u5f00\u673a<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1216\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208034403-698806834f858.png\" width=\"1053\" \/><\/p>\n<p>\u5b89\u88c5 lvm2 \u5de5\u5177\u5305 \u6240\u6709\u8282\u70b9&#xff08;k8s-master\u3001k8s-node1\u3001k8s-node2&#xff09;\u5fc5\u987b\u5b89\u88c5 lvm2 \u5305\u3002 \u6267\u884c\u547d\u4ee4&#xff08;\u63a8\u8350\u7528 apt&#xff0c;\u56e0\u4e3a\u6211\u662f Ubuntu&#xff09;&#xff1a;<\/p>\n<p>[root&#064;k8s-master ~\/openEBS]# apt update<br \/>\n[root&#064;k8s-master ~\/openEBS]# apt install lvm2 -y<br \/>\n[root&#064;k8s-master ~\/openEBS]# lvm version<br \/>\n  LVM version:     2.03.31(2) (2025-02-27)<br \/>\n  Library version: 1.02.205 (2025-02-27)<br \/>\n  Driver version:  4.50.0<\/p>\n<p>\u52a0\u8f7d\u5185\u6838\u6a21\u5757&#xff1a;\u6240\u6709\u8282\u70b9\u5fc5\u987b\u52a0\u8f7d dm-snapshot \u5185\u6838\u6a21\u5757&#xff08;LVM snapshot \u652f\u6301\u6240\u9700&#xff09;\u3002<\/p>\n<p># 1. \u68c0\u67e5\u6a21\u5757\u662f\u5426\u5df2\u52a0\u8f7d&#xff08;\u6ce8\u610f&#xff1a;\u6a21\u5757\u540d\u5728\u7cfb\u7edf\u4e2d\u663e\u793a\u4e3a\u4e0b\u5212\u7ebf\u5f62\u5f0f&#xff09;<br \/>\nlsmod | grep dm_snapshot<br \/>\n# 2. \u82e5\u672a\u52a0\u8f7d&#xff0c;\u6267\u884c<br \/>\nmodprobe dm_snapshot<br \/>\n# 3. \u9a8c\u8bc1\u52a0\u8f7d\u6210\u529f<br \/>\nlsmod | grep dm_snapshot  # \u5e94\u6709\u8f93\u51fa<br \/>\n# 4. \u8bbe\u7f6e\u5f00\u673a\u81ea\u542f&#xff08;\u8ffd\u52a0\u5230 \/etc\/modules&#xff09;<br \/>\necho &#034;dm_snapshot&#034; | sudo tee -a \/etc\/modules<\/p>\n<p>\u521b\u5efa Volume Group (VG) \u8fd9\u662f\u6700\u5173\u952e\u7684\u4e00\u6b65&#xff1a;\u6240\u6709\u5e0c\u671b\u4f7f\u7528 LVM LocalPV \u7684\u8282\u70b9\u4e0a&#xff0c;\u5fc5\u987b\u63d0\u524d\u521b\u5efa\u4e00\u4e2a Volume Group&#xff08;VG&#xff09;&#xff0c;OpenEBS \u624d\u4f1a\u4ece\u4e2d\u52a8\u6001 provision PV\u3002<\/p>\n<ul>\n<li>\n<p>\u751f\u4ea7\u73af\u5883&#xff1a;\u63a8\u8350\u4f7f\u7528\u72ec\u7acb\u7684\u7269\u7406\u78c1\u76d8\u6216\u5206\u533a&#xff08;\u907f\u514d\u4e0e\u7cfb\u7edf\u76d8\u6df7\u7528&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u6d4b\u8bd5\u73af\u5883&#xff1a;\u53ef\u4ee5\u7528loopback\u865a\u62df\u78c1\u76d8&#xff08;\u5b98\u65b9\u63a8\u8350\u7684\u6d4b\u8bd5\u65b9\u5f0f&#xff0c;\u4e0d\u4f1a\u5360\u7528\u771f\u5b9e\u5b58\u50a8&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e09\u53f0\u8282\u70b9&#xff08;master\u3001node1\u3001node2&#xff09;\u78c1\u76d8\u5e03\u5c40\u76f8\u540c&#xff0c;\u90fd\u6709\u4e00\u5757\u72ec\u7acb\u7684 sdb(20G)&#xff0c;\u8fd9\u5f88\u7406\u60f3\u2014\u2014\u4f60\u53ef\u4ee5\u5728\u6bcf\u53f0\u8282\u70b9\u4e0a\u7528 sdb \u521b\u5efa\u76f8\u540c\u540d\u79f0\u7684 VG&#xff0c;\u8fd9\u6837 OpenEBS LVM LocalPV \u5c31\u80fd\u5728\u6240\u6709\u8282\u70b9\u4e0a\u6b63\u5e38\u52a8\u6001 provision PV\u3002<\/p>\n<p>\u786e\u8ba4 sdb \u786e\u5b9e\u7a7a\u95f2\u4e14\u65e0\u91cd\u8981\u6570\u636e<br \/>\nlsblk -f \/dev\/sdb   # \u68c0\u67e5\u662f\u5426\u5df2\u6709\u6587\u4ef6\u7cfb\u7edf&#xff08;\u5e94\u8be5\u4ec0\u4e48\u90fd\u6ca1\u6709&#xff09;<br \/>\nfdisk -l \/dev\/sdb   # \u786e\u8ba4\u65e0\u5206\u533a\u8868<\/p>\n<p># \u521b\u5efa Physical Volume (PV)<br \/>\npvcreate \/dev\/sdb<\/p>\n<p># \u521b\u5efa Volume Group (VG)<br \/>\n# \u5efa\u8bae\u7edf\u4e00\u7528\u540c\u4e00\u4e2a\u540d\u5b57&#xff08;\u5982 openebs-lvm-vg&#xff09;&#xff1a;<br \/>\nvgcreate openebs-lvm-vg \/dev\/sdb<\/p>\n<p># \u9a8c\u8bc1\u521b\u5efa\u6210\u529f<br \/>\npvdisplay<br \/>\nvgdisplay openebs-lvm-vg<br \/>\nlvdisplay   # \u76ee\u524d\u5e94\u8be5\u6ca1\u6709 LV<\/p>\n<p>\u4f60\u5e94\u8be5\u770b\u5230 VG \u5927\u5c0f\u7ea6\u4e3a 20G&#xff08;\u51cf\u53bb\u5c11\u91cf overhead&#xff09;\u3002<\/p>\n<p>\u4e09\u53f0\u8282\u70b9\u5168\u90e8\u64cd\u4f5c\u5b8c\u540e\u7684\u6548\u679c<\/p>\n<ul>\n<li>\n<p>\u6bcf\u53f0\u8282\u70b9\u90fd\u6709\u4e00\u4e2a\u72ec\u7acb\u7684 openebs-lvm-vg&#xff08;\u5bb9\u91cf\u5404 20G&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>OpenEBS LVM provisioner \u4f1a\u81ea\u52a8\u53d1\u73b0\u8fd9\u4e9b VG&#xff0c;\u5e76\u5728\u5bf9\u5e94\u8282\u70b9\u4e0a\u521b\u5efa Local PV&#xff08;PV \u4f1a\u7ed1\u5b9a\u5230\u5177\u4f53\u8282\u70b9&#xff0c;\u4e0d\u53ef\u8de8\u8282\u70b9\u8fc1\u79fb&#xff0c;\u8fd9\u662f LocalPV \u7684\u7279\u6027&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>2.2 \u4f7f\u7528Helm\u5b89\u88c5OpenEBS4.3.3<\/h3>\n<p>Helm\u7248\u672c\u5fc5\u987b\u662f3.2\u53ca\u4ee5\u4e0a<\/p>\n<p># \u6dfb\u52a0 Helm \u4ed3\u5e93<br \/>\n[root&#064;k8s-master ~\/openEBS]# helm repo add openebs https:\/\/openebs.github.io\/openebs<br \/>\n&#034;openebs&#034; has been added to your repositories<br \/>\n[root&#064;k8s-master ~\/openEBS]# helm repo update<br \/>\nHang tight while we grab the latest from your chart repositories&#8230;<br \/>\n&#8230;Successfully got an update from the &#034;openebs&#034; chart repository<br \/>\nUpdate Complete. \u2388Happy Helming!\u2388<br \/>\n[root&#064;k8s-master ~\/openEBS]# helm search repo  openebs &#8211;versions |head<br \/>\nNAME            CHART VERSION   APP VERSION     DESCRIPTION<br \/>\nopenebs\/openebs 4.4.0           4.4.0           Containerized Attached Storage for Kubernetes<br \/>\nopenebs\/openebs 4.3.3           4.3.3           Containerized Attached Storage for Kubernetes<br \/>\nopenebs\/openebs 4.3.2           4.3.2           Containerized Attached Storage for Kubernetes<br \/>\nopenebs\/openebs 4.3.1           4.3.1           Containerized Attached Storage for Kubernetes<br \/>\nopenebs\/openebs 4.3.0           4.3.0           Containerized Attached Storage for Kubernetes<br \/>\nopenebs\/openebs 4.2.0           4.2.0           Containerized Attached Storage for Kubernetes<br \/>\nopenebs\/openebs 4.1.3           4.1.3           Containerized Attached Storage for Kubernetes<br \/>\nopenebs\/openebs 4.1.2           4.1.2           Containerized Attached Storage for Kubernetes<br \/>\nopenebs\/openebs 4.1.1           4.1.1           Containerized Attached Storage for Kubernetes<\/p>\n<h4>2.2.1 \u53ea\u5b89\u88c5OpenEBS Local Volumes\u6a21\u5f0f<\/h4>\n<p>helm install openebs openebs\/openebs \\\\<br \/>\n  &#8211;version 4.3.3 \\\\<br \/>\n  &#8211;namespace openebs \\\\<br \/>\n  &#8211;create-namespace \\\\<br \/>\n  &#8211;set engines.replicated.mayastor.enabled&#061;false<\/p>\n<p>\u7b49\u5f85\u6240\u6709\u7684Pod\u90fd\u5b8c\u6210Running\u5373\u53ef\u3002<\/p>\n<h2>\u4e09\u3001Local PV Hostpath \u6982\u89c8<\/h2>\n<p>OpenEBS Local PV Hostpath \u662f\u4e00\u79cd \u8f7b\u91cf\u7ea7\u3001\u7b80\u5355\u6613\u7528\u7684\u672c\u5730\u6301\u4e45\u5b58\u50a8\u5f15\u64ce&#xff0c;\u5b83\u901a\u8fc7\u4f7f\u7528 Kubernetes Local Persistent Volume&#xff08;Local PV&#xff09;\u7684\u80fd\u529b&#xff0c;\u628a\u8282\u70b9\u4e0a\u7684\u7279\u5b9a\u76ee\u5f55&#xff08;hostPath&#xff09;\u5c01\u88c5\u6210\u53ef\u7531 StorageClass\/PVC \u8bf7\u6c42\u7684\u6301\u4e45\u5b58\u50a8\u3002<\/p>\n<table>\n<tr>\u7279\u6027K8S\u539f\u751fHostPathOpenEBS LocalVolumes<\/tr>\n<tbody>\n<tr>\n<td>\u6570\u636e\u5b58\u653e\u4f4d\u7f6e<\/td>\n<td>\u8282\u70b9\u672c\u5730\u76ee\u5f55<\/td>\n<td>\u8282\u70b9\u672c\u5730\u76d8 &#043; PV \u5c01\u88c5<\/td>\n<\/tr>\n<tr>\n<td>\u751f\u547d\u5468\u671f<\/td>\n<td>\u4f9d\u8d56\u76ee\u5f55\u5b58\u5728<\/td>\n<td>\u4f9d\u8d56 PV\/PVC \u58f0\u660e\u5468\u671f<\/td>\n<\/tr>\n<tr>\n<td>\u8c03\u5ea6\u6269\u5c55<\/td>\n<td>\u65b0\u8282\u70b9\u9700\u624b\u52a8\u521b\u5efa\u76ee\u5f55<\/td>\n<td>Kubernetes \u81ea\u52a8\u7ed1\u5b9a PV\/PVC<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u4e00\u81f4\u6027<\/td>\n<td>\u65e0\u4fdd\u969c<\/td>\n<td>PVC \u5f15\u7528\u4fdd\u8bc1 Pod \u8bbf\u95ee\u540c\u4e00\u6570\u636e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>3.1 \u5b9a\u4e49\u4e0e\u7528\u9014<\/h3>\n<ul>\n<li>\n<p>Local PV Hostpath&#xff1a;OpenEBS \u63d0\u4f9b\u7684\u4e00\u79cd Local Persistent Volume \u7c7b\u578b<\/p>\n<\/li>\n<li>\n<p>Local Persistent Volume&#xff1a;\u7531 Kubernetes \u672c\u5730\u78c1\u76d8\u6216\u76ee\u5f55\u521b\u5efa\u7684 PV&#xff0c;\u53ea\u80fd\u5728\u521b\u5efa\u5b83\u7684\u8282\u70b9\u4e0a\u8bbf\u95ee<\/p>\n<\/li>\n<li>\n<p>Hostpath&#xff1a;\u8282\u70b9\u6587\u4ef6\u7cfb\u7edf\u4e0a\u7684\u67d0\u4e2a\u76ee\u5f55&#xff0c;\u5982 \/var\/openebs\/local<\/p>\n<\/li>\n<li>\n<p>\u52a8\u6001 Provisioning&#xff1a;\u5728\u9700\u8981\u5b58\u50a8\u65f6\u81ea\u52a8\u521b\u5efa\u5bf9\u5e94 PV&#xff0c;\u800c\u4e0d\u662f\u624b\u52a8\u63d0\u524d\u521b\u5efa PV \u6587\u4ef6\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>3.2\u00a0\u5b98\u65b9\u63a8\u8350\u7684\u5de5\u4f5c\u6d41\u7a0b<\/h3>\n<li>\n<p>\u5b89\u88c5 OpenEBS \u5e76\u542f\u7528 Local PV Hostpath Provisioner<\/p>\n<ul>\n<li>\n<p>\u5b89\u88c5 Helm chart \u6216 manifest<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u786e\u8ba4 BasePath \u5b58\u5728<\/p>\n<ul>\n<li>\n<p>\u9ed8\u8ba4\u662f\u8282\u70b9\u4e0a\u7684 \/var\/openebs\/local<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u521b\u5efa StorageClass&#xff08;\u5982\u679c\u9700\u8981\u81ea\u5b9a\u4e49&#xff09;<\/p>\n<ul>\n<li>\n<p>\u4fee\u6539 BasePath \u6216 NodeAffinity \u914d\u7f6e<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u521b\u5efa PVC \u5f15\u7528\u8be5 StorageClass<\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa Pod \u4f7f\u7528 PVC \u8fdb\u884c\u6302\u8f7d<\/p>\n<\/li>\n<li>\n<p>\u9a8c\u8bc1\u6570\u636e\u6301\u4e45\u6027 \/ Backup\/Restore&#xff08;\u53ef\u7528 Velero&#xff09;<\/p>\n<\/li>\n<table>\n<tr>\u5b98\u65b9\u672f\u8bed\u901a\u4fd7\u89e3\u91ca<\/tr>\n<tbody>\n<tr>\n<td>Local PV Hostpath<\/td>\n<td>\u5728\u8282\u70b9\u672c\u5730\u76ee\u5f55\u4e0a\u521b\u5efa\u7684 OpenEBS \u7ba1\u7406\u7684\u6301\u4e45\u5377<\/td>\n<\/tr>\n<tr>\n<td>BasePath<\/td>\n<td>OpenEBS \u5b58\u653e Hostpath PV \u7684\u6839\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>StorageClass<\/td>\n<td>\u7528\u4e8e\u5b9a\u4e49 Local PV Hostpath \u7684\u7b56\u7565\u5165\u53e3<\/td>\n<\/tr>\n<tr>\n<td>Dynamic Provisioning<\/td>\n<td>\u81ea\u52a8\u5728\u8282\u70b9\u4e0a\u521b\u5efa\u76ee\u5f55\u548c PV&#xff0c;\u65e0\u9700\u624b\u52a8 PV \u5b9a\u4e49<\/td>\n<\/tr>\n<tr>\n<td>Node Affinity<\/td>\n<td>Pod \u5fc5\u987b\u8c03\u5ea6\u5230\u62e5\u6709\u8be5 PV \u7684\u8282\u70b9<\/td>\n<\/tr>\n<tr>\n<td>Velero Backup\/Restore<\/td>\n<td>\u96c6\u7fa4\u7ea7\u5907\u4efd\u548c\u6062\u590d\u65b9\u6848&#xff0c;\u53ef\u7528\u4e8e\u6570\u636e\u4fdd\u62a4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>3.3 \u81ea\u5b9a\u4e49StorageClass<\/h3>\n<h4>3.3.1 \u4e3a\u4ec0\u4e48\u8981\u81ea\u5b9a\u4e49 StorageClass&#xff1f;<\/h4>\n<p>OpenEBS \u5b89\u88c5\u5b8c\u6210\u540e\u901a\u5e38\u4f1a\u81ea\u52a8\u521b\u5efa\u4e00\u4e2a\u9ed8\u8ba4\u7684 LocalPV Hostpath StorageClass&#xff1a;<\/p>\n<p>openebs-hostpath<\/p>\n<p>\u9ed8\u8ba4\u7684\u914d\u7f6e\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\n<p>BasePath &#061; \/var\/openebs\/local \u4e5f\u5c31\u662f\u8bf4 LocalPV \u4f1a\u5728\u8be5\u76ee\u5f55\u4e0b\u4e3a\u6bcf\u4e2a PV \u521b\u5efa\u5b50\u76ee\u5f55\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4f46\u5728\u5b9e\u9645\u573a\u666f\u4e2d&#xff0c;\u4f60\u53ef\u80fd\u5e0c\u671b&#xff1a;<\/p>\n<p>\u2705 \u628a\u6570\u636e\u653e\u5230\u4e0d\u540c\u76ee\u5f55&#xff08;\u6bd4\u5982 \/mnt\/data\/hostpath&#xff09;<\/p>\n<p>\u2705 \u7ed9\u4e0d\u540c\u7528\u9014\u7684\u5e94\u7528\u5206\u4e0d\u540c StorageClass<\/p>\n<p>\u2705 \u4fee\u6539\u56de\u6536\u7b56\u7565 \/ \u4eb2\u548c\u7b56\u7565<\/p>\n<p>\u2705 \u6307\u5b9a\u81ea\u5b9a\u4e49\u8282\u70b9\u6807\u8bc6\u6765\u505a\u66f4\u7cbe\u7ec6\u7684\u8c03\u5ea6<\/p>\n<p>\u8fd9\u65f6\u5c31\u9700\u8981 \u81ea\u5b9a\u4e49 StorageClass \u4e86\u3002<\/p>\n<h4>3.3.2 StorageClass \u57fa\u672c\u7ed3\u6784<\/h4>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: local-hostpath<br \/>\n  annotations:<br \/>\n    openebs.io\/cas-type: local<br \/>\ncas.openebs.io\/config: |<br \/>\n  &#8211; name: StorageType<br \/>\n    value: hostpath<br \/>\n  &#8211; name: BasePath<br \/>\n    value: \/var\/local-hostpath<br \/>\nprovisioner: openebs.io\/local<br \/>\nreclaimPolicy: Delete<br \/>\nvolumeBindingMode: WaitForFirstConsumer<\/p>\n<p>&#x1f449; \u6838\u5fc3\u5b57\u6bb5\u89e3\u91ca&#xff1a;<\/p>\n<table>\n<tr>\u5b57\u6bb5\u610f\u4e49<\/tr>\n<tbody>\n<tr>\n<td>metadata.name<\/td>\n<td>StorageClass \u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49\u7684&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>openebs.io\/cas-type: local<\/td>\n<td>\u8868\u793a\u4f7f\u7528 OpenEBS LocalPV \u5f15\u64ce<\/td>\n<\/tr>\n<tr>\n<td>StorageType: hostpath<\/td>\n<td>\u6307\u660e\u4f7f\u7528 Hostpath \u7c7b\u578b\u5b58\u50a8<\/td>\n<\/tr>\n<tr>\n<td>BasePath: \/xxx<\/td>\n<td>\u8fd9\u4e2a StorageClass \u751f\u6210 PV \u65f6\u5728\u8282\u70b9\u4e0a\u7528\u54ea\u4e2a\u6839\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>provisioner: openebs.io\/local<\/td>\n<td>\u4f7f\u7528 LocalPV \u52a8\u6001 Provisioner<\/td>\n<\/tr>\n<tr>\n<td>reclaimPolicy: Delete<\/td>\n<td>PVC \u5220\u9664\u540e PV \u4f1a\u88ab\u81ea\u52a8\u5220\u9664<\/td>\n<\/tr>\n<tr>\n<td>volumeBindingMode: WaitForFirstConsumer<\/td>\n<td>\u5ef6\u540e PV \u521b\u5efa\u5230 Pod \u8c03\u5ea6\u65f6\u673a&#xff08;\u6700\u5b89\u5168&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p># volumeBindingMode: WaitForFirstConsumer<br \/>\n\u8fd9\u53e5\u975e\u5e38\u91cd\u8981&#xff1a;<br \/>\n\u2714 \u5b83\u544a\u8bc9 Kubernetes&#xff1a;\u4e0d\u8981\u5728 PVC \u521b\u5efa\u65f6\u5c31\u7ed1\u5b9a PV<br \/>\n\u2714 Kubernetes \u5148\u7b49 Pod \u8c03\u5ea6\u51b3\u5b9a\u5728\u54ea\u4e2a\u8282\u70b9\u8fd0\u884c<br \/>\n\u2714 Provisioner \u770b\u5230 Pod \u7684\u8282\u70b9\u540e\u624d\u521b\u5efa PV<\/p>\n<p>\u8fd9\u6837\u505a\u7684\u539f\u56e0\u662f&#xff1a;<br \/>\n&#x1f449; Local PV \u9700\u8981\u548c Pod \u5728\u540c\u4e00\u4e2a\u8282\u70b9&#xff0c;\u5426\u5219\u6570\u636e\u201c\u672c\u5730\u201d\u5c31\u4e0d\u6210\u7acb<\/p>\n<p># Node Affinity&#xff08;\u53ef\u9009&#xff09;<br \/>\n\u9ed8\u8ba4 Hostpath \u662f\u901a\u8fc7\u8282\u70b9\u7684 kubernetes.io\/hostname \u6765\u505a\u4eb2\u548c&#xff08;NodeAffinity&#xff09;&#xff1a;<br \/>\nspec:<br \/>\n  local:<br \/>\n    path: \/var\/openebs\/local\/pvc-xxx<br \/>\n  nodeAffinity:<br \/>\n    required:<br \/>\n      nodeSelectorTerms:<br \/>\n      &#8211; matchExpressions:<br \/>\n        &#8211; key: kubernetes.io\/hostname<br \/>\n&#x1f4cc; \u4f46 hostname \u5e76\u4e0d\u662f\u603b\u662f\u4f60\u60f3\u8981\u7684\u8282\u70b9\u552f\u4e00\u6807\u8bc6&#xff0c;\u7279\u522b\u662f&#xff1a;<br \/>\n\u8282\u70b9\u88ab\u66ff\u6362\u540e hostname \u6539\u53d8<br \/>\n\u8282\u70b9\u6709\u591a\u4e2a\u89d2\u8272&#xff0c;\u4f46\u4f60\u60f3\u9650\u5b9a\u5b58\u50a8\u8282\u70b9<\/p>\n<p>\u8fd9\u79cd\u60c5\u51b5\u4e0b\u53ef\u4ee5\u52a0\u5165\u81ea\u5b9a\u4e49\u6807\u7b7e\u65b9\u5f0f&#xff1a;<br \/>\n&#8211; name: NodeAffinityLabels<br \/>\n  list:<br \/>\n  &#8211; &#034;openebs.io\/custom-node-unique-id&#034;<\/p>\n<p>\u8fd9\u6837\u505a\u540e&#xff1a;<br \/>\n\u2714 \u7528\u4f60\u5b9a\u4e49\u7684\u6807\u7b7e\u4f5c\u4e3a\u8282\u70b9\u552f\u4e00\u6807\u8bc6<br \/>\n\u2714 \u5373\u4f7f hostname \u53d8\u4e86&#xff0c;\u53ea\u8981\u6807\u7b7e\u4e00\u81f4&#xff0c;Local PV \u4ecd\u80fd\u5b9a\u4f4d\u6570\u636e<br \/>\n\u2714 \u66f4\u52a0\u7a33\u5b9a\u53ef\u9760&#xff08;\u7279\u522b\u5728\u8282\u70b9\u53d8\u66f4 \/ \u96c6\u7fa4\u91cd\u5efa\u573a\u666f&#xff09;<\/p>\n<p>NodeAffinityLabels \u4e0d\u80fd\u66ff\u4ee3\u8c03\u5ea6\u7b56\u7565<br \/>\n\u4f7f\u7528 NodeAffinityLabels \u53ea\u662f\u4e3a\u4e86\u8ba9 PV \u7ed1\u5b9a\u65f6\u5f15\u7528\u4e00\u4e2a\u7a33\u5b9a\u7684 node identity\u3002<br \/>\n\u274c \u5b83 \u4e0d\u4f1a\u5f71\u54cd Pod \u7684\u8c03\u5ea6<\/p>\n<h4>3.3.3 \u793a\u4f8bStorageClass<\/h4>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: local-hostpath<br \/>\n  annotations:<br \/>\n    openebs.io\/cas-type: local<br \/>\ncas.openebs.io\/config: |<br \/>\n&#8211; name: StorageType<br \/>\n  value: hostpath<br \/>\n&#8211; name: BasePath<br \/>\n  value: \/var\/local-hostpath<br \/>\nprovisioner: openebs.io\/local<br \/>\nreclaimPolicy: Delete<br \/>\nvolumeBindingMode: WaitForFirstConsumer<\/p>\n<h4>3.3.4\u00a0\u90e8\u7f72\u4e00\u4e2a\u6709\u72b6\u6001\u7684\u5e94\u7528<\/h4>\n<p>\u5b98\u65b9 PVC \u793a\u4f8b&#xff08;LocalPV Hostpath&#xff09;<\/p>\n<p>kind: PersistentVolumeClaim<br \/>\napiVersion: v1<br \/>\nmetadata:<br \/>\n  name: local-hostpath-pvc<br \/>\nspec:<br \/>\n  storageClassName: openebs-hostpath<br \/>\n  accessModes:<br \/>\n    &#8211; ReadWriteOnce<br \/>\n  resources:<br \/>\n    requests:<br \/>\n      storage: 5G<\/p>\n<p>\u521b\u5efa Pod \u6765\u4f7f\u7528 PVC<\/p>\n<p>[root&#064;k8s-master ~\/openEBS]# cat pod.yaml<br \/>\napiVersion: v1<br \/>\nkind: Pod<br \/>\nmetadata:<br \/>\n  name: hello-local-hostpath-pod<br \/>\nspec:<br \/>\n  volumes:<br \/>\n    &#8211; name: local-storage<br \/>\n      persistentVolumeClaim:<br \/>\n        claimName: local-hostpath-pvc<br \/>\n  containers:<br \/>\n    &#8211; name: hello-container<br \/>\n      image: myweb:v1<br \/>\n      command:<br \/>\n        &#8211; sh<br \/>\n        &#8211; -c<br \/>\n        &#8211; &#039;while true; do echo &#034;&#096;date&#096; Hello from OpenEBS.&#034; &gt;&gt; \/mnt\/store\/greet.txt; sleep 10; done&#039;<br \/>\n      volumeMounts:<br \/>\n        &#8211; mountPath: \/mnt\/store<br \/>\n          name: local-storage<\/p>\n<p>[root&#064;k8s-master ~\/openEBS]# kubectl get po,pvc<br \/>\nNAME                           READY   STATUS    RESTARTS   AGE<br \/>\npod\/hello-local-hostpath-pod   1\/1     Running   0          13s<\/p>\n<p>NAME                                       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS       VOLUMEATTRIBUTESCLASS   AGE<br \/>\npersistentvolumeclaim\/local-hostpath-pvc   Bound    pvc-29e78edd-d851-49b2-9fbd-4f95bc625952   5G         RWO            openebs-hostpath   &lt;unset&gt;                 5m36s<\/p>\n<p>[root&#064;k8s-master ~\/openEBS]# kubectl exec hello-local-hostpath-pod &#8212; cat \/mnt\/store\/greet.txt<br \/>\nMon Feb  2 08:51:10 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:51:20 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:51:30 UTC 2026 Hello from OpenEBS.<\/p>\n<p>\u6d4b\u8bd5LocalVolumes\u7684\u6301\u4e45\u5316\u6570\u636e<\/p>\n<p># \u5220\u9664Pod\u91cd\u65b0\u521b\u5efa&#xff0c;\u6d4b\u8bd5\u6570\u636e\u662f\u5426\u8fd8\u5b58\u5728\u3002<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl delete pod hello-local-hostpath-pod<br \/>\npod &#034;hello-local-hostpath-pod&#034; deleted<br \/>\n# \u6ca1\u95ee\u9898<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl apply -f pod.yaml<br \/>\npod\/hello-local-hostpath-pod created<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl get po,pvc<br \/>\nNAME                           READY   STATUS    RESTARTS   AGE<br \/>\npod\/hello-local-hostpath-pod   1\/1     Running   0          2s<\/p>\n<p>NAME                                       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS       VOLUMEATTRIBUTESCLASS   AGE<br \/>\npersistentvolumeclaim\/local-hostpath-pvc   Bound    pvc-29e78edd-d851-49b2-9fbd-4f95bc625952   5G         RWO            openebs-hostpath   &lt;unset&gt;                 13m<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl exec hello-local-hostpath-pod &#8212; cat \/mnt\/store\/greet.txt<br \/>\nMon Feb  2 08:51:10 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:51:20 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:51:30 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:51:40 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:51:50 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:52:00 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:52:10 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:52:20 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:52:30 UTC 2026 Hello from OpenEBS.<br \/>\nMon Feb  2 08:52:40 UTC 2026 Hello from OpenEBS.<br \/>\n# \u9a8c\u8bc1\u6570\u636e\u53d1\u73b0Pod\u8c03\u5ea6\u5728node1,\u90a3\u4e48\u6570\u636e\u5c31\u53ea\u5b58\u5728node1<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl get po -o wide<br \/>\nNAME                       READY   STATUS    RESTARTS   AGE   IP              NODE        NOMINATED NODE   READINESS GATES<br \/>\nhello-local-hostpath-pod   1\/1     Running   0          30s   10.200.36.101   k8s-node1   &lt;none&gt;           &lt;none&gt;<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl get po -o wide<br \/>\nNAME                       READY   STATUS    RESTARTS   AGE   IP              NODE        NOMINATED NODE   READINESS GATES<br \/>\nhello-local-hostpath-pod   1\/1     Running   0          30s   10.200.36.101   k8s-node1   &lt;none&gt;           &lt;none&gt;<\/p>\n<p>HostPath\u548cLocalVolumes\u7684\u770b\u6cd5&#xff0c;\u9996\u5148HostPath\u4e0d\u5177\u5907\u6301\u4e45\u5316\u5b58\u50a8&#xff0c;\u5982\u679cPod\u8fd0\u884c\u5728node1\u8282\u70b9\u4ea7\u751f\u4e86\u6570\u636e&#xff0c;\u540e\u7eed\u5982\u679c\u96c6\u7fa4\u7684\u8d44\u6e90\u4e0d\u591f&#xff0c;\u6269\u5c55\u4e86\u4e00\u4e9b\u8282\u70b9&#xff0c;\u7136\u540e\u5982\u679cPod\u4e5f\u4e00\u5e76\u6269\u5c55\u5230\u65b0\u8282\u70b9\u4e0a\u9762&#xff0c;\u4f46\u662f\u65b0\u8282\u70b9\u6ca1\u6709\u521b\u5efaHostPath\u5bf9\u5e94\u7684\u76ee\u5f55&#xff0c;\u90a3\u4e48Pod\u7684\u6570\u636e\u5c31\u4f1a\u4e0d\u4e00\u81f4&#xff0c;\u76ee\u5f55\u88ab\u5220\u9664&#xff0c;\u6570\u636e\u7684\u58f0\u660e\u5468\u671f\u5c31\u4f1a\u7ed3\u675f\u3002\u4f46\u662fopenEBS\u7684LocalVolumes\u9488\u5bf9\u4e8eHostPath\u4ed6\u4e0d\u4e00\u6837&#xff0c;\u4ed6\u662f\u5c01\u88c5\u5728PV\\\\PVC\u8fd9\u4e2a\u5b58\u50a8\u7cfb\u7edf\u4e0a\u9762\u7684hostPath,\u4ed6\u7684\u5468\u671f\u4e0d\u4f9d\u8d56\u4e8e\u76ee\u5f55\u662f\u5426\u5b58\u5728&#xff0c;\u800c\u662fPV\\\\PVC\u7684\u58f0\u660e\u5468\u671f&#xff0c;\u65e0\u8bba\u6269\u5c55\u591a\u5c11\u8282\u70b9&#xff0c;\u53ea\u8981\u662f\u4e00\u4e2a\u96c6\u7fa4\u5185&#xff0c;\u6307\u5411PV\\\\PVC\u90a3\u4e48\u6570\u636e\u5c31\u662f\u4e00\u81f4\u7684\u3002<\/p>\n<h2>\u56db\u3001LocalVolumes-LVM\u6982\u62ec<\/h2>\n<h3>4.1\u00a0\u521b\u5efa\u5b58\u50a8\u7c7bSC<\/h3>\n<p>\u521b\u5efa SC \u7684\u5173\u952e\u5728\u4e8e\u6307\u5b9a LVM \u5b58\u50a8\u7c7b\u578b\u3001Volume Group&#xff08;VG&#xff09;\u540d\u79f0&#xff0c;\u4ee5\u53ca\u53ef\u9009\u7684\u8c03\u5ea6\u7b56\u7565\u3001\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b\u7b49\u53c2\u6570\u3002<\/p>\n<p>\u8fd9\u6837&#xff0c;\u5f53\u4f60\u521b\u5efa PVC&#xff08;PersistentVolumeClaim&#xff09;\u65f6&#xff0c;OpenEBS \u4f1a\u81ea\u52a8\u5728\u5339\u914d\u7684\u8282\u70b9\u4e0a\u4ece\u6307\u5b9a\u7684 VG \u4e2d\u5207\u51fa\u4e00\u4e2a Logical Volume&#xff08;LV&#xff09;\u4f5c\u4e3a Local PV\u3002<\/p>\n<p>\u6587\u6863\u5f3a\u8c03&#xff1a;<br \/>\n\u00a0\u00a0 \u00a0\u5fc5\u987b\u53c2\u6570&#xff1a;\u6307\u5b9a LVM \u7c7b\u578b\u548c VG&#xff08;\u7528 volgroup \u6216 vgpattern&#xff09;\u3002<br \/>\n\u00a0\u00a0 \u00a0\u53ef\u9009\u53c2\u6570&#xff1a;\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b&#xff08;fsType&#xff0c;\u9ed8\u8ba4 ext4&#xff09;\u3001\u8584\u914d\u7f6e&#xff08;thinProvision&#xff09;\u3001\u8c03\u5ea6\u5668&#xff08;scheduler&#xff0c;\u9ed8\u8ba4 SpaceWeighted&#xff0c;\u9009\u62e9\u5269\u4f59\u7a7a\u95f4\u6700\u5927\u7684\u8282\u70b9&#xff09;\u3002<br \/>\n\u00a0\u00a0 \u00a0\u652f\u6301\u6807\u51c6 Kubernetes StorageClass \u53c2\u6570&#xff0c;\u5982\u5377\u6269\u5c55\u3001\u62d3\u6251\u9650\u5236\u3001\u7ed1\u5b9a\u6a21\u5f0f\u7b49\u3002<br \/>\n\u6587\u6863\u63d0\u4f9b\u4e86\u4e24\u4e2a\u5b98\u65b9\u6848\u4f8b YAML&#xff0c;\u6211\u4f1a\u7ed3\u5408\u4f60\u7684\u5b9e\u9645\u60c5\u51b5&#xff08;\u6bcf\u53f0\u8282\u70b9 VG \u540d\u4e3a openebs-lvm-vg&#xff0c;\u5bb9\u91cf 20G&#xff09;\u8fdb\u884c\u5206\u6790\u548c\u9002\u914d\u3002<\/p>\n<h4>4.1.1 \u57fa\u7840 StorageClass&#xff08;\u6700\u7b80&#xff09;<\/h4>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: openebs-lvm-sc   # \u81ea\u5b9a\u4e49\u540d\u5b57&#xff0c;\u5efa\u8bae\u5e26 lvm \u6807\u8bc6<br \/>\nprovisioner: local.csi.openebs.io   # \u9876\u5c42\u5b57\u6bb5&#xff08;CSI \u9a71\u52a8&#xff09;<br \/>\nparameters:<br \/>\n  storage: &#034;lvm&#034;               # \u6307\u5b9a LVM \u7c7b\u578b<br \/>\n  volgroup: &#034;openebs-lvm-vg&#034;   # \u76f4\u63a5\u7528\u4f60\u7684 VG \u540d&#xff0c;\u4e09\u53f0\u8282\u70b9\u90fd\u5339\u914d<br \/>\nreclaimPolicy: Delete<br \/>\nvolumeBindingMode: WaitForFirstConsumer   # \u5f3a\u70c8\u63a8\u8350&#xff0c;\u907f\u514d\u8c03\u5ea6\u5931\u8d25<\/p>\n<h4>4.1.2\u00a0\u5e26 scheduler \u53c2\u6570\u7684SC<\/h4>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: openebs-lvm-balanced-sc<br \/>\nprovisioner: local.csi.openebs.io<br \/>\nparameters:<br \/>\n  storage: &#034;lvm&#034;<br \/>\n  volgroup: &#034;openebs-lvm-vg&#034;      # \u4f60\u7684 VG<br \/>\n  thinProvision: &#034;yes&#034;            # \u63a8\u8350&#xff1a;\u8584\u914d\u7f6e&#xff0c;\u8282\u7701\u7a7a\u95f4<br \/>\n  fsType: &#034;ext4&#034;                  # \u53ef\u6539 xfs<br \/>\n  scheduler: &#034;SpaceWeighted&#034;      # \u9ed8\u8ba4\u5c31\u662f\u8fd9\u4e2a&#xff0c;\u53ef\u663e\u5f0f\u5199&#xff1b;\u6216\u6362 CapacityWeighted<br \/>\nreclaimPolicy: Delete<br \/>\nvolumeBindingMode: WaitForFirstConsumer<br \/>\nallowVolumeExpansion: true<\/p>\n<p>\u4e09\u79cd scheduler \u7684\u901a\u4fd7\u5bf9\u6bd4<\/p>\n<p>SpaceWeighted&#xff08;\u9ed8\u8ba4&#xff0c;\u63a8\u8350\u5165\u95e8&#xff09;&#xff1a;Pod \u9700\u8981\u5b58\u50a8\u65f6&#xff0c;\u81ea\u52a8\u9009\u5f53\u524d\u5269\u4f59\u7a7a\u95f4\u6700\u5927\u7684\u8282\u70b9&#xff08;\u6bd4\u5982 node1 \u5269 15G&#xff0c;node2 \u5269 10G&#xff0c;\u5c31\u9009 node1&#xff09;\u3002\u6700\u5747\u8861\u3002<\/p>\n<p>CapacityWeighted&#xff1a;\u9009\u201c\u5df2\u7528\u6bd4\u4f8b\u6700\u4f4e\u201d\u7684\u8282\u70b9&#xff08;\u9002\u5408\u4f60\u60f3\u5747\u5300\u5206\u914d\u5df2\u7528\u5bb9\u91cf&#xff09;\u3002<\/p>\n<p>VolumeWeighted&#xff1a;\u9009\u5f53\u524d LV \u6570\u91cf\u6700\u5c11\u7684\u8282\u70b9&#xff08;\u5982\u679c\u4f60\u6709\u5f88\u591a\u5c0f\u5377&#xff0c;\u9632\u6b62\u67d0\u4e2a\u8282\u70b9\u5377\u592a\u591a\u5f71\u54cd\u6027\u80fd&#xff09;\u3002<\/p>\n<h4>4.1.3 \u5b58\u50a8\u7c7b\u9009\u9879<\/h4>\n<table>\n<tr>\u53c2\u6570\u662f\u5426\u5fc5\u586b\u9ed8\u8ba4\u503c\u53ef\u80fd\u503c\u63cf\u8ff0<\/tr>\n<tbody>\n<tr>\n<td>storage<\/td>\n<td>\u662f<\/td>\n<td>\u65e0<\/td>\n<td>&#034;lvm&#034;<\/td>\n<td>\u5b58\u50a8\u540e\u7aef\u7c7b\u578b<\/td>\n<\/tr>\n<tr>\n<td>vgpattern<\/td>\n<td>\u6761\u4ef6\u5fc5\u586b<\/td>\n<td>\u65e0<\/td>\n<td>\u6b63\u5219 (e.g., &#034;lvmvg.*&#034;)<\/td>\n<td>\u5339\u914d Volume Group \u7684\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>volgroup<\/td>\n<td>\u6761\u4ef6\u5fc5\u586b<\/td>\n<td>\u65e0<\/td>\n<td>\u5b57\u7b26\u4e32 (e.g., &#034;lvmvg&#034;)<\/td>\n<td>\u786e\u5207 Volume Group \u540d\u79f0&#xff08;\u5c06\u6765\u5e9f\u5f03&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>allowVolumeExpansion<\/td>\n<td>\u5426<\/td>\n<td>false<\/td>\n<td>true \/ false<\/td>\n<td>\u662f\u5426\u652f\u6301\u5377\u6269\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>mountOptions<\/td>\n<td>\u5426<\/td>\n<td>-o default<\/td>\n<td>\u9009\u9879\u5217\u8868 (e.g., debug)<\/td>\n<td>\u6302\u8f7d\u9009\u9879<\/td>\n<\/tr>\n<tr>\n<td>fsType<\/td>\n<td>\u5426<\/td>\n<td>ext4<\/td>\n<td>ext2, ext3, ext4, xfs, btrfs<\/td>\n<td>\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b<\/td>\n<\/tr>\n<tr>\n<td>shared<\/td>\n<td>\u5426<\/td>\n<td>No<\/td>\n<td>&#034;yes&#034;<\/td>\n<td>\u662f\u5426\u5141\u8bb8\u591a Pod \u5171\u4eab<\/td>\n<\/tr>\n<tr>\n<td>thinProvision<\/td>\n<td>\u5426<\/td>\n<td>&#034;no&#034;<\/td>\n<td>&#034;yes&#034;, &#034;no&#034;<\/td>\n<td>\u662f\u5426\u8584\u914d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td>volumeBindingMode<\/td>\n<td>\u5426<\/td>\n<td>Immediate<\/td>\n<td>Immediate, WaitForFirstConsumer<\/td>\n<td>\u5377\u7ed1\u5b9a\u65f6\u673a<\/td>\n<\/tr>\n<tr>\n<td>reclaimPolicy<\/td>\n<td>\u5426<\/td>\n<td>Delete<\/td>\n<td>Delete, Retain<\/td>\n<td>PVC \u5220\u9664\u884c\u4e3a<\/td>\n<\/tr>\n<tr>\n<td>allowedTopologies<\/td>\n<td>\u5426<\/td>\n<td>\u65e0<\/td>\n<td>\u62d3\u6251\u6807\u7b7e\u8868\u8fbe\u5f0f<\/td>\n<td>\u9650\u5236 provision \u8282\u70b9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>4.1.4 \u793a\u4f8bSC<\/h4>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: openebs-lvm-advanced<br \/>\nprovisioner: local.csi.openebs.io<br \/>\nparameters:<br \/>\n  storage: &#034;lvm&#034;<br \/>\n  vgpattern: &#034;openebs-lvm-vg&#034;       # \u7cbe\u786e\u5339\u914d\u4f60\u7684 VG&#xff08;\u6216 &#034;openebs.*&#034; \u66f4\u5bbd\u677e&#xff09;<br \/>\n  thinProvision: &#034;yes&#034;              # \u5f3a\u70c8\u63a8\u8350&#xff1a;\u7701\u7a7a\u95f4&#xff08;\u8bb0\u5f97\u68c0\u67e5 dm_thin_pool \u6a21\u5757&#xff09;<br \/>\n  fsType: &#034;ext4&#034;                    # \u6216\u6539 xfs \u8ffd\u6c42\u6027\u80fd<br \/>\n  shared: &#034;no&#034;                      # \u6309\u9700\u6539 yes<br \/>\nallowVolumeExpansion: true          # \u652f\u6301\u6269\u5bb9<br \/>\nreclaimPolicy: Delete<br \/>\nvolumeBindingMode: WaitForFirstConsumer<\/p>\n<p>\u4e3a\u4ec0\u4e48\u8fd9\u6837\u914d&#xff1f;<\/p>\n<ul>\n<li>\n<p>\u7528 vgpattern \u800c\u975e volgroup&#xff1a;\u5b98\u65b9\u660e\u786e\u63a8\u8350&#xff0c;\u907f\u514d\u5c06\u6765\u5e9f\u5f03\u3002<\/p>\n<\/li>\n<li>\n<p>\u5f00\u542f thinProvision: \u4f60\u7684 20G \u76d8\u6d4b\u8bd5\u7528\u5f88\u5408\u9002&#xff0c;\u5b9e\u9645\u7528\u6570\u636e\u5c11\u65f6\u4e0d\u6d6a\u8d39\u3002<\/p>\n<\/li>\n<li>\n<p>WaitForFirstConsumer&#xff1a;Local PV \u5fc5\u987b&#xff08;\u9632\u6b62 PV \u7ed1\u9519\u8282\u70b9&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u5982\u679c\u4f60\u60f3\u9650\u5236\u53ea\u5728 worker \u8282\u70b9&#xff08;node1\/node2&#xff09;\u7528&#xff0c;\u53ef\u4ee5\u52a0 allowedTopologies&#xff08;\u9700\u5148\u7ed9\u8282\u70b9\u6253\u6807\u7b7e&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<table>\n<tr>\u6a21\u5f0fPVC \u521b\u5efa\u540e\u7acb\u523b\u5e72\u561b&#xff1f;Pod \u8c03\u5ea6\u540e\u4f1a\u600e\u6837&#xff1f;\u9002\u5408 Local PV&#xff1f;\u5e38\u89c1\u95ee\u9898<\/tr>\n<tbody>\n<tr>\n<td>Immediate (\u9ed8\u8ba4)<\/td>\n<td>\u7acb\u523b\u5728\u67d0\u4e2a\u8282\u70b9\u521b\u5efa PV<\/td>\n<td>\u5982\u679c PV \u548c Pod \u4e0d\u5728\u540c\u4e00\u8282\u70b9 \u2192 Pod Pending<\/td>\n<td>\u4e0d\u63a8\u8350<\/td>\n<td>\u8c03\u5ea6\u5931\u8d25\u3001\u53cd\u590d\u91cd\u8bd5<\/td>\n<\/tr>\n<tr>\n<td>WaitForFirstConsumer<\/td>\n<td>\u5565\u90fd\u4e0d\u5e72&#xff0c;\u7b49\u7740<\/td>\n<td>\u5728 Pod \u843d\u4f4d\u7684\u8282\u70b9\u521b\u5efa PV \u2192 \u6210\u529f\u542f\u52a8<\/td>\n<td>\u5f3a\u70c8\u63a8\u8350<\/td>\n<td>\u51e0\u4e4e\u6ca1\u95ee\u9898&#xff0c;\u4e13\u4e3a\u672c\u5730\u5b58\u50a8\u8bbe\u8ba1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>4.2\u00a0\u521b\u5efa\u6301\u4e45\u4f53\u79ef\u58f0\u660e-PVC<\/h3>\n<p>\u6838\u5fc3\u6d41\u7a0b&#xff1a;<\/p>\n<ul>\n<li>PVC \u662f\u6807\u51c6 Kubernetes \u5bf9\u8c61&#xff0c;\u6ca1\u6709 LVM \u4e13\u5c5e\u53c2\u6570\u3002<\/li>\n<li>\u5173\u952e\u53ea\u9700\u6307\u5b9a storageClassName \u4e3a\u4e4b\u524d\u521b\u5efa\u7684 LVM StorageClass&#xff08;SC&#xff09;\u3002<\/li>\n<li>\u5f53 PVC \u88ab Pod \u4f7f\u7528&#xff08;\u5c24\u5176\u662f WaitForFirstConsumer \u6a21\u5f0f\u4e0b&#xff09;&#xff0c;OpenEBS \u4f1a\u81ea\u52a8\u5728\u5408\u9002\u8282\u70b9&#xff08;\u6709\u5339\u914d VG \u7684&#xff09;\u7684 openebs-lvm-vg \u4e0a\u4ece VG \u5207\u51fa\u4e00\u4e2a Logical Volume (LV) \u4f5c\u4e3a PV\u3002<\/li>\n<li>\u9875\u9762\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6700\u7b80\u5b98\u65b9\u6848\u4f8b YAML&#xff0c;\u6ca1\u6709\u989d\u5916\u6b65\u9aa4\u6216\u590d\u6742\u53c2\u6570\u8bf4\u660e&#xff08;\u56e0\u4e3a PVC \u521b\u5efa\u672c\u8eab\u5f88\u7b80\u5355&#xff09;\u3002<\/li>\n<li>\u5f3a\u8c03&#xff1a;accessModes \u901a\u5e38\u7528 ReadWriteOnce&#xff08;RWO&#xff09;&#xff0c;\u56e0\u4e3a Local PV \u662f\u8282\u70b9\u672c\u5730\u5377&#xff0c;\u4e0d\u652f\u6301\u591a\u8282\u70b9\u8bfb\u5199&#xff08;RWX&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u9875\u9762\u6ca1\u6709\u8be6\u7ec6\u8b66\u544a\u6216\u4ea4\u4e92\u89e3\u91ca&#xff0c;\u4f46\u9690\u542b&#xff1a;PVC \u8bf7\u6c42\u7684\u5b58\u50a8\u5927\u5c0f\u5fc5\u987b \u2264 \u8282\u70b9 VG \u5269\u4f59\u7a7a\u95f4&#xff08;\u4f60\u7684\u6bcf\u8282\u70b9 20G VG&#xff09;&#xff0c;\u5426\u5219 provision \u5931\u8d25\u3002<\/p>\n<p>apiVersion: v1<br \/>\nkind: PersistentVolumeClaim<br \/>\nmetadata:<br \/>\n  name: test-lvm-pvc          # \u81ea\u5b9a\u4e49\u540d\u5b57<br \/>\n  annotations:                # \u53ef\u9009&#xff1a;\u52a0\u70b9\u63cf\u8ff0&#xff0c;\u4fbf\u4e8e\u6392\u67e5<br \/>\n    volume.kubernetes.io\/selected-node: k8s-node1   # \u6d4b\u8bd5\u65f6\u5f3a\u5236\u6307\u5b9a\u8282\u70b9&#xff08;\u53ef\u9009&#xff0c;\u8c03\u8bd5\u7528&#xff09;<br \/>\nspec:<br \/>\n  accessModes:<br \/>\n    &#8211; ReadWriteOnce           # \u5fc5\u987b RWO<br \/>\n  resources:<br \/>\n    requests:<br \/>\n      storage: 5Gi              # \u4ece\u5c0f\u5f00\u59cb\u6d4b\u8bd5&#xff08;\u6211\u4eec\u7684 VG 20G&#xff0c;\u591f\u7528&#xff09;<br \/>\n  storageClassName: openebs-lvm-advanced   # \u7528\u4f60\u4e4b\u524d\u521b\u5efa\u7684\u9ad8\u7ea7 SC \u540d&#xff08;\u6216 basic&#xff09;<\/p>\n<h3>4.3\u00a0LVM\u90e8\u7f72Pod\u793a\u4f8b<\/h3>\n<p>apiVersion: v1<br \/>\nkind: PersistentVolumeClaim<br \/>\nmetadata:<br \/>\n  name: test-lvm-pvc<br \/>\nspec:<br \/>\n  accessModes:<br \/>\n  &#8211; ReadWriteOnce<br \/>\n  storageClassName: openebs-lvm-advanced<br \/>\n  resources:<br \/>\n    requests:<br \/>\n      storage: 2Gi<br \/>\n&#8212;<br \/>\napiVersion: v1<br \/>\nkind: Pod<br \/>\nmetadata:<br \/>\n  name: fio<br \/>\nspec:<br \/>\n  restartPolicy: Never<br \/>\n  nodeSelector:<br \/>\n    kubernetes.io\/hostname: k8s-node1<br \/>\n  containers:<br \/>\n  &#8211; name: perfrunner<br \/>\n    image: myweb:v1<br \/>\n    command: [&#034;\/bin\/sh&#034;]<br \/>\n    args: [&#034;-c&#034;, &#034;while true ;do sleep 50; done&#034;]<br \/>\n    volumeMounts:<br \/>\n    &#8211; mountPath: \/datadir<br \/>\n      name: fio-vol<br \/>\n    tty: true<br \/>\n  volumes:<br \/>\n  &#8211; name: fio-vol<br \/>\n    persistentVolumeClaim:<br \/>\n      claimName: test-lvm-pvc<\/p>\n<p># \u9a8c\u8bc1<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl get po,pvc<br \/>\nNAME      READY   STATUS    RESTARTS   AGE<br \/>\npod\/fio   1\/1     Running   0          3m47s<\/p>\n<p>NAME                                       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS           VOLUMEATTRIBUTESCLASS   AGE<br \/>\npersistentvolumeclaim\/local-hostpath-pvc   Bound    pvc-29e78edd-d851-49b2-9fbd-4f95bc625952   5G         RWO            openebs-hostpath       &lt;unset&gt;                 21h<br \/>\npersistentvolumeclaim\/test-lvm-pvc         Bound    pvc-746225fe-1a80-4151-ab6f-9aeb92557375   2Gi        RWO            openebs-lvm-advanced   &lt;unset&gt;                 4m15s<br \/>\n[root&#064;k8s-master ~\/openEBS]# <\/p>\n<h3>4.4\u00a0LVM\u9ad8\u7ea7\u529f\u80fd<\/h3>\n<h4>4.4.1 FSGroup<\/h4>\n<p>\u6838\u5fc3\u76ee\u7684\u662f\u89e3\u51b3 \u975e root \u7528\u6237\/\u8fdb\u7a0b\u8bbf\u95ee\u5377\u7684\u6743\u9650\u95ee\u9898&#xff1a;\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;LVM \u5377\u4ee5 root \u6743\u9650\u521b\u5efa&#xff0c;\u975e root Pod \u53ef\u80fd\u65e0\u6cd5\u8bfb\u5199&#xff08;\u6743\u9650\u62d2\u7edd&#xff09;\u3002\u901a\u8fc7 FSGroup \u914d\u7f6e&#xff0c;CSI \u9a71\u52a8\u4f1a\u5728\u6302\u8f7d\u65f6\u81ea\u52a8\u8c03\u6574\u5377\u7684\u6240\u6709\u8005\u548c\u6743\u9650&#xff0c;\u8ba9\u6307\u5b9a GID&#xff08;\u7ec4 ID&#xff09;\u7684\u8fdb\u7a0b\u80fd\u6b63\u5e38\u8bbf\u95ee\u3002<\/p>\n<p>FSGroup \u5c31\u597d\u6bd4\u7ed9\u5377\u201c\u6362\u95e8\u9501\u201d&#xff1a;\u9ed8\u8ba4\u5377\u662f root \u4e13\u5c5e&#xff0c;\u975e root Pod \u6572\u95e8\u8fdb\u4e0d\u53bb&#xff08;\u6743\u9650\u9519\u8bef&#xff09;\u3002\u914d\u7f6e\u540e&#xff0c;CSI \u9a71\u52a8\u4f1a\u5728 Pod \u6302\u8f7d\u5377\u65f6\u81ea\u52a8\u201c\u6539\u9501\u201d&#xff0c;\u8ba9\u6307\u5b9a\u7ec4&#xff08;GID&#xff09;\u7684\u7528\u6237\u80fd\u987a\u5229\u8fdb\u51fa\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u9700\u8981&#xff1a;<\/p>\n<ul>\n<li>\n<p>Kubernetes \u5b89\u5168\u6700\u4f73\u5b9e\u8df5&#xff1a;\u5f88\u591a\u5e94\u7528\u4ee5\u975e root \u7528\u6237\u8fd0\u884c&#xff08;runAsUser\/runAsGroup&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>LVM \u5377\u9ed8\u8ba4 chown \u4e3a root:root&#xff0c;\u975e root \u8fdb\u7a0b\u5199\u6587\u4ef6\u4f1a\u62a5 \u201cPermission denied\u201d\u3002<\/p>\n<\/li>\n<li>\n<p>FSGroup \u89e3\u51b3\u8fd9\u4e2a&#xff1a;\u81ea\u52a8 chown\/chmod \u5377\u76ee\u5f55&#xff0c;\u8ba9 fsGroup \u6307\u5b9a GID \u62e5\u6709\u5377\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u914d\u7f6e\u4f4d\u7f6e&#xff1a;<\/p>\n<li>\n<p>CSI Driver<\/p>\n<p>&#xff08;\u5168\u5c40\u8bbe\u7f6e&#xff0c;\u63a7\u5236\u9a71\u52a8\u884c\u4e3a&#xff09;&#xff1a;<\/p>\n<p>\u00a0 \u00a0fsGroupPolicy<\/p>\n<ul>\n<li>\n<p>\u6709\u4e09\u4e2a\u503c&#xff1a;<\/p>\n<\/li>\n<li>\n<p>None&#xff1a;\u5565\u90fd\u4e0d\u6539&#xff08;\u975e root \u5fc5\u5931\u8d25&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>ReadWriteOnceWithFSType&#xff1a;\u53ea\u6709 RWO &#043; \u6307\u5b9a fsType \u65f6\u8c03\u6574&#xff08;LVM \u4e0b\u7b49\u540c File&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>File&#xff1a;\u603b\u662f\u8c03\u6574\u6743\u9650&#xff08;\u63a8\u8350&#xff0c;\u65e0\u6761\u4ef6&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u5176\u4ed6\u56fa\u5b9a&#xff1a;attachRequired: false\u3001podInfoOnMount: true\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Pod securityContext<\/p>\n<p>&#xff08;\u6bcf\u4e2a Pod \u5355\u72ec\u6307\u5b9a&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\n<p>fsGroup: \u5fc5\u987b\u5199&#xff0c;\u6307\u5b9a\u76ee\u6807 GID&#xff08;\u5377\u5c06 chown \u4e3a\u8fd9\u4e2a\u7ec4&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>fsGroupChangePolicy<\/p>\n<ul>\n<li>\n<p>Always&#xff1a;\u6bcf\u6b21\u6302\u8f7d\u90fd\u5f3a\u5236\u6539\u6743\u9650\u3002<\/p>\n<\/li>\n<li>\n<p>OnRootMismatch&#xff1a;\u53ea\u5728\u6839\u76ee\u5f55\u6743\u9650\u4e0d\u5339\u914d\u65f6\u6539&#xff08;\u66f4\u9ad8\u6548&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5e38\u914d\u5408 runAsUser\/runAsGroup \u7528\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<h5>4.4.1.1\u00a0\u5b98\u65b9\u6848\u4f8b 1&#xff1a;CSI Driver \u914d\u7f6e<\/h5>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: CSIDriver<br \/>\nmetadata:<br \/>\n  name: local.csi.openebs.io   # OpenEBS LVM \u7684\u56fa\u5b9a\u9a71\u52a8\u540d<br \/>\nspec:<br \/>\n  attachRequired: false<br \/>\n  fsGroupPolicy: File          # \u63a8\u8350\u8fd9\u4e2a<br \/>\n  podInfoOnMount: true<br \/>\n  volumeLifecycleModes:<br \/>\n  &#8211; Persistent<\/p>\n<p>\u63a8\u8350\u5c06fsGroupChangePolicy\u4fee\u6539\u4e3aFile,\u53ef\u4ee5\u6309\u7167\u5982\u4e0b\u64cd\u4f5c\u5b8c\u6210:<\/p>\n<p>[root&#064;k8s-master ~\/openEBS]# kubectl get csidriver local.csi.openebs.io -o yaml  # \u67e5\u770b\u5f53\u524d fsGroupPolicy<br \/>\napiVersion: storage.k8s.io\/v1<br \/>\nkind: CSIDriver<br \/>\nmetadata:<br \/>\n  annotations:<br \/>\n    meta.helm.sh\/release-name: openebs<br \/>\n    meta.helm.sh\/release-namespace: openebs<br \/>\n  creationTimestamp: &#034;2026-02-03T05:51:39Z&#034;<br \/>\n  labels:<br \/>\n    app.kubernetes.io\/managed-by: Helm<br \/>\n  name: local.csi.openebs.io<br \/>\n  resourceVersion: &#034;67827&#034;<br \/>\n  uid: 1ea17b00-ed62-4da4-832c-1b1072f4f875<br \/>\nspec:<br \/>\n  attachRequired: false<br \/>\n  fsGroupPolicy: ReadWriteOnceWithFSType<br \/>\n  podInfoOnMount: true<br \/>\n  requiresRepublish: false<br \/>\n  seLinuxMount: false<br \/>\n  storageCapacity: true<br \/>\n  volumeLifecycleModes:<br \/>\n  &#8211; Persistent<\/p>\n<p>[root&#064;k8s-master ~\/openEBS]# kubectl edit csidriver local.csi.openebs.io<\/p>\n<p>&#8230;<br \/>\n\u627e\u5230fsGroupPlociy: File  ## \u4fee\u6539\u4e3aFile<\/p>\n<p>&#8230;<br \/>\n\u4fdd\u5b58\u9000\u51fa<\/p>\n<p>\u6539\u6210 File \u540e&#xff0c;\u6240\u6709\u540e\u7eed LVM \u5377\u6302\u8f7d\u90fd\u4f1a\u652f\u6301 FSGroup\u3002<br \/>\n\u5b83\u4f1a\u81ea\u52a8\u652f\u6301 FSGroup&#xff1a;\u5f53 Pod \u6307\u5b9a securityContext.fsGroup \u65f6&#xff0c;OpenEBS LVM \u9a71\u52a8\u4f1a\u5728\u6302\u8f7d\u5377\u65f6\u81ea\u52a8 chown\/chmod \u5377\u76ee\u5f55&#xff0c;\u8ba9\u975e root \u8fdb\u7a0b\u6b63\u5e38\u8bfb\u5199&#xff08;\u89e3\u51b3 Permission denied&#xff09;\u3002<\/p>\n<h5>4.4.1.2 \u5b98\u65b9\u6848\u4f8b 2&#xff1a;Pod \u914d\u7f6e&#xff08;\u5e26 securityContext&#xff09;<\/h5>\n<p>apiVersion: v1<br \/>\nkind: Pod<br \/>\nmetadata:<br \/>\n  name: security-context<br \/>\nspec:<br \/>\n  securityContext:<br \/>\n    runAsUser: 2000<br \/>\n    runAsGroup: 3000<br \/>\n    fsGroup: 6000              # \u5173\u952e&#xff1a;\u5377\u5c06\u5c5e\u4e8e\u8fd9\u4e2a GID<br \/>\n    fsGroupChangePolicy: OnRootMismatch<br \/>\n  containers:<br \/>\n  &#8211; name: security-context<br \/>\n    image: busybox<br \/>\n    volumeMounts:<br \/>\n    &#8211; name: data<br \/>\n      mountPath: \/data<br \/>\n    # &#8230; \u5176\u4ed6<br \/>\n  volumes:<br \/>\n  &#8211; name: data<br \/>\n    persistentVolumeClaim:<br \/>\n      claimName: csi-volume<\/p>\n<h4>4.4.2 \u4f7f\u7528\u5efa\u8bae<\/h4>\n<ul>\n<li>\n<p>\u7acb\u5373\u68c0\u67e5\u4f60\u7684 CSIDriver&#xff1a;\u5927\u6982\u7387\u662f None&#xff0c;\u5bfc\u81f4\u6f5c\u5728\u6743\u9650\u5751\u3002<\/p>\n<\/li>\n<li>\n<p>\u6d4b\u8bd5&#xff1a;\u521b\u5efa\u4e00\u4e2a\u975e root Pod&#xff08;runAsUser: 1000&#xff09;&#xff0c;\u4e0d\u52a0 FSGroup \u4f1a\u5931\u8d25&#xff1b;\u52a0\u4e86 &#043; \u9a71\u52a8 File \u5c31\u6210\u529f\u3002<\/p>\n<\/li>\n<li>\n<p>\u751f\u4ea7\u5fc5\u914d&#xff1a;\u914d\u5408 PodSecurityAdmission \u6216 securityContext \u9650\u5236 root\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u4e2a\u914d\u7f6e\u662f\u975e root \u5b89\u5168\u8fd0\u884c\u7684\u5173\u952e&#xff0c;\u9875\u9762\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u5e38\u89c1\u75db\u70b9\u3002\u5982\u679c\u4f60\u9047\u5230\u6743\u9650\u9519\u8bef&#xff08;Permission denied&#xff09;&#xff0c;99% \u662f\u8fd9\u91cc\u7684\u95ee\u9898&#xff01;\u6709\u8f93\u51fa\u8d34\u6211\u5e2e\u770b\u3002<\/p>\n<h3>4.5\u00a0Raw Block Volume&#xff08;\u88f8\u5757\u8bbe\u5907\u5377&#xff09;<\/h3>\n<h4>4.5.1 \u6838\u5fc3\u533a\u522b\u4e8e\u666e\u901a\u6a21\u5f0f<\/h4>\n<ul>\n<li>\n<p>\u9ed8\u8ba4\u662f Filesystem \u6a21\u5f0f&#xff08;\u5377\u4e0a\u81ea\u52a8\u683c\u5f0f\u5316 ext4 \u7b49\u6587\u4ef6\u7cfb\u7edf&#xff0c;Pod \u7528 volumeMounts \u6302\u8f7d\u76ee\u5f55&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>Raw Block \u6a21\u5f0f&#xff1a;\u4e0d\u521b\u5efa\u6587\u4ef6\u7cfb\u7edf&#xff0c;\u76f4\u63a5\u63d0\u4f9b\u88f8\u5757\u8bbe\u5907&#xff08;\/dev\/xxx&#xff09;&#xff0c;\u5e94\u7528\u81ea\u5df1\u7ba1\u7406\u5206\u533a\u3001\u683c\u5f0f\u5316\u3001\u6570\u636e\u5e03\u5c40\u3002<\/p>\n<\/li>\n<li>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u6570\u636e\u5e93&#xff08;\u5982 MySQL\u3001PostgreSQL&#xff09;\u3001\u8f6f\u4ef6\u5b9a\u4e49\u5b58\u50a8\u3001\u9700\u8981\u6781\u81f4\u6027\u80fd\u7684\u5de5\u4f5c\u8d1f\u8f7d&#xff08;\u907f\u514d\u6587\u4ef6\u7cfb\u7edf overhead&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u597d\u5904&#xff1a;\u51cf\u5c11\u6587\u4ef6\u7cfb\u7edf\u5c42\u5f00\u9500&#xff0c;\u63d0\u5347 I\/O \u6027\u80fd&#xff1b;\u5e94\u7528\u5b8c\u5168\u63a7\u5236\u5757\u8bbe\u5907\u3002<\/p>\n<\/li>\n<li>\n<p>\u9650\u5236&#xff1a;\u4e0d\u652f\u6301 fsType \u53c2\u6570&#xff1b;\u5fc5\u987b\u7528 volumeDevices&#xff08;\u800c\u975e volumeMounts&#xff09;&#xff1b;\u4ecd\u53ea\u652f\u6301 ReadWriteOnce&#xff08;RWO&#xff09;&#xff1b;\u5e94\u7528\u5fc5\u987b\u80fd\u5904\u7406\u88f8\u8bbe\u5907\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u9875\u9762\u63d0\u4f9b\u5b8c\u6574 StorageClass\u3001PVC\u3001Deployment \u793a\u4f8b&#xff0c;\u6b65\u9aa4\u6e05\u6670&#xff1a;\u521b\u5efa\u4e13\u7528 SC \u2192 PVC \u8bbe volumeMode: Block \u2192 Pod \u7528 volumeDevices \u6307\u5b9a devicePath\u3002<\/p>\n<p>Raw Block Volume \u5c31\u597d\u6bd4\u7ed9\u4f60\u4e00\u5757\u201c\u88f8\u786c\u76d8\u201d&#xff1a;\u4e0d\u9884\u88c5 Windows\/Linux \u6587\u4ef6\u7cfb\u7edf&#xff0c;\u4f60\u81ea\u5df1\u51b3\u5b9a\u600e\u4e48\u5206\u533a\u3001\u683c\u5f0f\u5316\u3001\u5b58\u6570\u636e\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u7528\u5b83&#xff08;\u5b98\u65b9\u6838\u5fc3&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u666e\u901a Filesystem \u6a21\u5f0f&#xff1a;OpenEBS \u81ea\u52a8\u5728 LV \u4e0a mkfs.ext4&#xff0c;Pod \u6302\u8f7d\u6210\u76ee\u5f55&#xff08;\/datadir&#xff09;&#xff0c;\u65b9\u4fbf\u4f46\u6709\u6587\u4ef6\u7cfb\u7edf\u5f00\u9500&#xff08;\u53cc\u7f13\u5b58\u3001\u6743\u9650\u7ba1\u7406\u7b49&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>Raw Block \u6a21\u5f0f&#xff1a;\u76f4\u63a5\u628a LV \u66b4\u9732\u6210\u5757\u8bbe\u5907&#xff08;\u5982 \/dev\/xvda&#xff09;&#xff0c;\u5e94\u7528\u76f4\u63a5\u8bfb\u5199\u5757&#xff08;\u96f6 overhead&#xff09;&#xff0c;\u9002\u5408\u6570\u636e\u5e93\u7b49\u9ad8\u6027\u80fd\u573a\u666f&#xff08;\u5b83\u4eec\u81ea\u5df1\u6709\u6570\u636e\u7ba1\u7406\u673a\u5236&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u914d\u7f6e\u5173\u952e&#xff08;\u5b98\u65b9\u51c6\u786e&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\n<p>StorageClass&#xff1a;\u548c\u666e\u901a LVM \u5dee\u4e0d\u591a&#xff0c;\u4f46\u4e0d\u80fd\u5199 fsType&#xff08;\u56e0\u4e3a\u65e0\u6587\u4ef6\u7cfb\u7edf&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>PVC&#xff1a;\u5fc5\u987b\u52a0 volumeMode: Block&#xff08;\u8fd9\u662f\u89e6\u53d1 Raw Block \u7684\u5f00\u5173&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>Pod\/Deployment&#xff1a;\u7528 volumeDevices&#xff08;\u800c\u975e volumeMounts&#xff09;&#xff0c;\u6307\u5b9a devicePath&#xff08;\u5982 \/dev\/xvda&#xff0c;\u5e94\u7528\u5c31\u5728\u8fd9\u4e2a\u8def\u5f84\u64cd\u4f5c\u88f8\u8bbe\u5907&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u5176\u4ed6\u53c2\u6570&#xff08;\u5982 volgroup\/vgpattern\u3001thinProvision&#xff09;\u4ecd\u53ef\u7528\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>4.5 .2 \u6d41\u7a0b<\/h4>\n<li>\n<p>\u521b\u5efa&#xff08;\u6216\u590d\u7528&#xff09;LVM SC\u3002<\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa PVC&#xff0c;\u8bbe volumeMode: Block\u3002<\/p>\n<\/li>\n<li>\n<p>\u90e8\u7f72 Pod&#xff0c;\u7528 volumeDevices \u6302\u8f7d\u5230\u6307\u5b9a devicePath\u3002<\/p>\n<\/li>\n<li>\n<p>Pod \u542f\u52a8\u540e&#xff0c;\u5e94\u7528\u5728 devicePath \u4e0a\u81ea\u5df1 mkfs\u3001mount \u6216\u76f4\u63a5\u7528&#xff08;\u53d6\u51b3\u4e8e\u5e94\u7528&#xff09;\u3002<\/p>\n<\/li>\n<h4>4.5.3\u00a0\u5b98\u65b9\u6848\u4f8b\u5206\u6790<\/h4>\n<p># \u5b98\u65b9\u6848\u4f8b 1&#xff1a;StorageClass<br \/>\napiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: openebs-lvm-block-sc   # \u81ea\u5b9a\u4e49\u540d\u5b57&#xff0c;\u5e26 block \u6807\u8bc6<br \/>\nprovisioner: local.csi.openebs.io<br \/>\nparameters:<br \/>\n  storage: &#034;lvm&#034;                   # \u5fc5\u586b&#xff08;\u4f60\u4e4b\u524d SC \u5df2\u914d&#xff09;<br \/>\n  vgpattern: &#034;openebs-lvm-vg&#034;       # \u7528\u4f60\u7684 VG&#xff0c;\u63a8\u8350&#xff08;\u7cbe\u786e\u5339\u914d&#xff09;<br \/>\n  thinProvision: &#034;yes&#034;              # \u4fdd\u6301\u5f00\u542f&#xff0c;\u7701\u7a7a\u95f4<br \/>\n  # fsType: \u4e0d\u5199&#xff01;Raw Block \u4e0d\u652f\u6301<br \/>\nallowVolumeExpansion: true<br \/>\nreclaimPolicy: Delete<br \/>\nvolumeBindingMode: WaitForFirstConsumer   # \u5f3a\u70c8\u63a8\u8350\u4fdd\u6301<\/p>\n<p># \u5b98\u65b9\u6848\u4f8b 2&#xff1a;PVC<br \/>\napiVersion: v1<br \/>\nkind: PersistentVolumeClaim<br \/>\nmetadata:<br \/>\n  name: test-lvm-block-pvc<br \/>\nspec:<br \/>\n  volumeMode: Block                # \u5fc5\u987b\u52a0\u8fd9\u4e2a&#xff0c;\u624d\u662f Raw Block<br \/>\n  accessModes:<br \/>\n  &#8211; ReadWriteOnce<br \/>\n  storageClassName: openebs-lvm-block-sc   # \u7528\u4e0a\u9762\u65b0 SC<br \/>\n  resources:<br \/>\n    requests:<br \/>\n      storage: 5Gi<\/p>\n<p># \u5b98\u65b9\u6848\u4f8b 3&#xff1a;Deployment<br \/>\napiVersion: v1<br \/>\nkind: Pod<br \/>\nmetadata:<br \/>\n  name: test-lvm-block-pod<br \/>\nspec:<br \/>\n  restartPolicy: Never<br \/>\n  nodeSelector:                         # \u63a8\u8350\u52a0&#xff0c;\u6253\u7834 WaitForFirstConsumer \u5faa\u73af<br \/>\n    kubernetes.io\/hostname: k8s-node1<br \/>\n  containers:<br \/>\n  &#8211; name: tester<br \/>\n    image: busybox:latest              # \u65b9\u4fbf exec \u8fdb\u53bb\u6d4b\u8bd5<br \/>\n    command: [&#034;\/bin\/sh&#034;]<br \/>\n    args: [&#034;-c&#034;, &#034;while true; do sleep 30; done&#034;]<br \/>\n    volumeDevices:                     # \u5fc5\u987b\u7528\u8fd9\u4e2a<br \/>\n    &#8211; devicePath: \/dev\/sdb         # \u81ea\u5b9a\u4e49\u8def\u5f84&#xff08;\u5982 \/dev\/myblock&#xff09;&#xff0c;\u5e94\u7528\u5728\u8fd9\u91cc\u64cd\u4f5c<br \/>\n      name: block-vol<br \/>\n  volumes:<br \/>\n  &#8211; name: block-vol<br \/>\n    persistentVolumeClaim:<br \/>\n      claimName: test-lvm-block-pvc<\/p>\n<p>\u6838\u5fc3\u5728\u4e8e&#xff1a;\u00a0<\/p>\n<p>volumeDevices: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # \u5fc5\u987b\u7528\u8fd9\u4e2a<br \/>\n\u00a0 \u00a0 &#8211; devicePath: \/dev\/sdb \u00a0 \u00a0 \u00a0 \u00a0 # \u81ea\u5b9a\u4e49\u8def\u5f84&#xff08;\u5982 \/dev\/myblock&#xff09;&#xff0c;\u5e94\u7528\u5728\u8fd9\u91cc\u64cd\u4f5c<br \/>\n\u00a0 \u00a0 \u00a0 name: block-vol<\/p>\n<h3>4.6\u00a0LVM\u5377\u6269\u5bb9<\/h3>\n<p>\u5377\u6269\u5bb9\u5c31\u597d\u6bd4\u201c\u7ed9\u786c\u76d8\u52a0\u5bb9\u91cf\u201d&#xff1a;\u539f\u6765 4Gi \u7528\u6ee1\u4e86&#xff0c;\u76f4\u63a5\u6539\u7533\u8bf7\u4e3a 5Gi&#xff0c;\u7cfb\u7edf\u81ea\u52a8\u628a\u5e95\u5c42 LV \u62c9\u5927&#xff0c;\u5e76\u5728\u7ebf resize \u6587\u4ef6\u7cfb\u7edf&#xff08;\u5e94\u7528\u7ee7\u7eed\u8dd1&#xff0c;\u4e0d\u4e2d\u65ad&#xff09;\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u80fd\u5728\u7ebf\u6269\u5bb9&#xff08;\u5b98\u65b9\u673a\u5236&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\n<p>Kubernetes \u6807\u51c6\u7279\u6027 &#043; OpenEBS CSI \u9a71\u52a8\u652f\u6301\u3002<\/p>\n<\/li>\n<li>\n<p>\u7f16\u8f91 PVC \u2192 \u63a7\u5236\u5668 resize LV&#xff08;lvextend&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u8282\u70b9\u63d2\u4ef6&#xff08;\u6709 Pod \u6302\u8f7d\u65f6&#xff09;\u6267\u884c lvextend -r&#xff08;-r \u81ea\u52a8 resize \u6587\u4ef6\u7cfb\u7edf&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u5fc5\u987b\u6709\u8fd0\u884c Pod&#xff1a;\u5426\u5219\u6587\u4ef6\u7cfb\u7edf\u4e0d\u6269&#xff08;PVC \u5361 FileSystemResizePending&#xff09;&#xff0c;Pod \u91cd\u542f\u6216\u65b0\u5efa\u540e\u81ea\u52a8\u5b8c\u6210\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u652f\u6301\u7684\u6587\u4ef6\u7cfb\u7edf&#xff08;\u5b98\u65b9&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\n<p>ext4&#xff08;\u9ed8\u8ba4&#xff0c;\u5728\u7ebf\u6269\u5bb9\u5b8c\u7f8e&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>xfs\u3001btrfs&#xff08;\u4e5f\u652f\u6301&#xff0c;btrfs \u5728\u7ebf\u9700 K8s 1.23&#043;&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>Raw Block \u6a21\u5f0f&#xff08;\u5728\u7ebf\u9700 K8s 1.23&#043;&#xff0c;\u5e94\u7528\u81ea\u5df1 resize&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u6ce8\u610f\u4e8b\u9879\/\u8b66\u544a&#xff08;\u5b98\u65b9\u5f3a\u8c03&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\n<p>StorageClass \u5fc5\u987ballowVolumeExpansion: true&#xff0c;\u5426\u5219\u6269\u5bb9\u5931\u8d25\u3002<\/p>\n<\/li>\n<li>\n<p>\u6269\u5bb9\u540e PVC \u4f1a\u77ed\u6682\u663e\u793a FileSystemResizePending&#xff08;\u6b63\u5e38&#xff0c;\u7b49 Pod \u89e6\u53d1&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u65e0 Pod \u4f7f\u7528\u65f6&#xff0c;LV \u5df2\u6269\u4f46\u6587\u4ef6\u7cfb\u7edf\u672a\u6269&#xff08;df -h \u4ecd\u663e\u793a\u65e7\u5927\u5c0f&#xff09;&#xff0c;\u542f\u52a8 Pod \u540e\u81ea\u52a8\u5b8c\u6210\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e0d\u652f\u6301\u7f29\u5bb9&#xff08;Kubernetes \u6807\u51c6\u9650\u5236&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>4.6.1\u00a0\u5b98\u65b9\u6848\u4f8b 1&#xff1a;StorageClass<\/h4>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: openebs-lvmpv<br \/>\nallowVolumeExpansion: true   # &lt;&#8212; \u5173\u952e\u5f00\u5173<br \/>\nparameters:<br \/>\n  fstype: &#034;ext4&#034;<br \/>\n  volgroup: &#034;lvmpv-vg&#034;<br \/>\n  provisioner: local.csi.openebs.io<\/p>\n<h4>4.6.2 \u5b98\u65b9\u6848\u4f8b 2 &amp; 3&#xff1a;PVC&#xff08;\u521d\u59cb &#043; \u6269\u5bb9\u540e&#xff09;<\/h4>\n<p>kind: PersistentVolumeClaim<br \/>\napiVersion: v1<br \/>\nmetadata:<br \/>\n  name: csi-lvmpv<br \/>\nspec:<br \/>\n  storageClassName: openebs-lvmpv<br \/>\n  accessModes:<br \/>\n    &#8211; ReadWriteOnce<br \/>\n  resources:<br \/>\n    requests:<br \/>\n      storage: 4Gi<\/p>\n<p>\u6269\u5bb9\u540e PVC&#xff08;\u53ea\u6539 storage&#xff09;&#xff1a;<\/p>\n<p># &#8230; \u76f8\u540c\u5b57\u6bb5<br \/>\n  resources:<br \/>\n    requests:<br \/>\n      storage: 5Gi   # \u589e\u5927\u8fd9\u91cc<\/p>\n<p>\u5f00\u542f\u540e\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a Bound \u7684 PVC&#xff08;\u5982\u4e4b\u524d\u7684 test-lvm-pvc 2Gi&#xff09;&#xff1a;<\/p>\n<p>\u7f16\u8f91\u6269\u5bb9&#xff08;\u63a8\u8350\u65b9\u5f0f&#xff0c;\u6700\u7b80\u5355&#xff09;&#xff1a;<\/p>\n<p>kubectl edit pvc test-lvm-pvc   # \u76f4\u63a5\u6539 requests.storage \u4e3a 5Gi&#xff08;\u6216\u66f4\u5927&#xff0c;\u4f46 \u2264 VG \u5269\u4f59&#xff09;<br \/>\n\u6216\u8005\u6253\u8865\u4e01\u7684\u65b9\u5f0f<br \/>\nkubectl patch pvc test-lvm-pvc -p &#039;{&#034;spec&#034;:{&#034;resources&#034;:{&#034;requests&#034;:{&#034;storage&#034;:&#034;5Gi&#034;}}}}&#039;<\/p>\n<h3>4.7\u00a0\u5feb\u7167\u4e0e\u5feb\u7167\u6062\u590d<\/h3>\n<p>OpenEBS Local PV LVM \u652f\u6301 \u5feb\u7167&#xff08;Snapshot&#xff09; \u548c \u4ece\u5feb\u7167\u6062\u590d&#xff08;Restore&#xff09; \u9ad8\u7ea7\u64cd\u4f5c&#xff0c;\u57fa\u4e8e Kubernetes VolumeSnapshot API \u548c LVM \u539f\u751f snapshot \u673a\u5236\u3002<\/p>\n<p>\u5feb\u7167&#xff08;Snapshot&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u521b\u5efa\u539f\u5377\u7684\u70b9-in-time \u53ea\u8bfb\u526f\u672c&#xff08;\u9ed8\u8ba4 ReadOnly&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u524d\u63d0&#xff1a;\u8282\u70b9\u52a0\u8f7d dm-snapshot \u5185\u6838\u6a21\u5757&#xff1b;\u652f\u6301\u8584\/\u539a\u5377&#xff08;\u8584\u5377\u521b\u5efa thin snapshot&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u9ed8\u8ba4\u5feb\u7167\u5927\u5c0f &#061; \u539f\u5377\u5927\u5c0f&#xff1b;\u53ef\u9009 snapSize \u53c2\u6570\u81ea\u5b9a\u4e49&#xff08;\u767e\u5206\u6bd4\u6216\u7edd\u5bf9\u503c&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u901a\u8fc7 VolumeSnapshotClass&#xff08;driver: local.csi.openebs.io&#xff09;\u548c VolumeSnapshot \u521b\u5efa\u3002<\/p>\n<\/li>\n<li>\n<p>\u9650\u5236&#xff1a;\u5feb\u7167\u540e\u539f\u5377\u4e0d\u80fd\u6269\u5bb9&#xff08;LVM \u4e0d\u81ea\u52a8\u8c03\u6574 snapshot&#xff09;&#xff1b;\u5feb\u7167\u5fc5\u987b\u4e0e PVC \u540c namespace&#xff1b;deletionPolicy \u9ed8\u8ba4 Delete\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u6062\u590d&#xff08;Restore&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4ece\u5feb\u7167\u521b\u5efa\u65b0\u5377&#xff08;clone&#xff09;&#xff0c;\u6570\u636e\u540c\u5feb\u7167\u65f6\u523b&#xff0c;\u65b0\u5377\u5728\u539f\u5377\u76f8\u540c\u8282\u70b9\u4e0a&#xff0c;\u5c5e\u4e8e\u76f8\u540c VG\u3002<\/p>\n<\/li>\n<li>\n<p>\u901a\u8fc7 PVC \u7684 dataSource \u5f15\u7528 VolumeSnapshot \u521b\u5efa\u65b0 PVC\u3002<\/p>\n<\/li>\n<li>\n<p>\u524d\u63d0&#xff1a;\u4ec5\u652f\u6301 thin snapshot&#xff08;OpenEBS v4.0&#043;&#xff0c;\u63a8\u8350 v4.4.0&#043;&#xff09;&#xff1b;\u6062\u590d\u5377\u5927\u5c0f\u5fc5\u987b\u7cbe\u786e\u5339\u914d\u5feb\u7167 LV \u5927\u5c0f\u3002<\/p>\n<\/li>\n<li>\n<p>\u5dee\u5f02\u4e8e\u52a8\u6001 provision&#xff1a;\u56fa\u5b9a\u8282\u70b9\/VG\/\u5927\u5c0f&#xff1b;\u4e0d\u652f\u6301\u6062\u590d\u540e\u6269\u5bb9\u3002<\/p>\n<\/li>\n<li>\n<p>\u8b66\u544a&#xff1a;thin pool \u6ee1\u53ef\u80fd\u5bfc\u81f4\u5199\u5931\u8d25&#xff08;\u5efa\u8bae\u914d\u7f6e autoextend&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u6574\u4f53&#xff1a;\u5feb\u7167\u9002\u5408\u5907\u4efd\/\u514b\u9686&#xff0c;\u6062\u590d\u9002\u5408\u707e\u5907\u6216\u6d4b\u8bd5\u65b0\u5377\u3002\u4f60\u7684\u73af\u5883&#xff08;thinProvision: &#034;yes&#034; &#043; dm_thin_pool \u5df2\u52a0\u8f7d&#xff09;\u5b8c\u7f8e\u652f\u6301 thin snapshot\/restore&#xff0c;\u4f46\u9700\u989d\u5916\u786e\u8ba4 dm-snapshot \u6a21\u5757\u3002<\/p>\n<p>\u8b66\u544a\u5408\u96c6&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5feb\u7167\u5b58\u5728\u65f6&#xff0c;\u539f\u5377\u7981\u6b62\u6269\u5bb9&#xff08;\u5b98\u65b9\u6545\u610f\u963b\u6b62&#xff0c;\u907f\u514d LVM \u590d\u6742\u6027&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u6062\u590d\u5377\u4e0d\u80fd\u6269\u5bb9&#xff1b;\u5927\u5c0f\u5fc5\u987b &#061; \u5feb\u7167 status.lvSize\u3002<\/p>\n<\/li>\n<li>\n<p>\u53ea\u652f\u6301 thin snapshot \u6062\u590d&#xff08;\u4f60\u7684 SC \u5df2\u914d&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>thin pool \u6ee1\u98ce\u9669&#xff1a;\u914d\u7f6e lvm.conf autoextend&#xff08;VG \u6709\u4f59\u91cf\u65f6\u81ea\u52a8\u6269 pool&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>4.7.1 \u5feb\u7167<\/h4>\n<h5>4.7.1.1 \u5b98\u65b9\u6848\u4f8b&#xff1a;VolumeSnapshotClass&#xff08;\u9ed8\u8ba4 &#043; snapSize&#xff09;<\/h5>\n<p>apiVersion: snapshot.storage.k8s.io\/v1<br \/>\nkind: VolumeSnapshotClass<br \/>\nmetadata:<br \/>\n  name: openebs-lvm-snapclass   # \u81ea\u5b9a\u4e49<br \/>\n  annotations:<br \/>\n    snapshot.storage.kubernetes.io\/is-default-class: &#034;true&#034;   # \u53ef\u8bbe\u9ed8\u8ba4<br \/>\ndriver: local.csi.openebs.io<br \/>\ndeletionPolicy: Delete          # \u6216 Retain&#xff08;\u4fdd\u7559 snapshot \u5185\u5bb9&#xff09;<\/p>\n<p>\u5e26 snapSize&#xff08;\u81ea\u5b9a\u4e49\u5927\u5c0f&#xff0c;\u521b\u5efa\u539a snapshot&#xff09;&#xff1a;<\/p>\n<p># &#8230; \u540c\u4e0a<br \/>\nparameters:<br \/>\n  snapSize: 50%                 # \u6216 &#034;5Gi&#034; \u7edd\u5bf9\u503c<\/p>\n<h5>4.7.1.2 \u5b98\u65b9\u6848\u4f8b&#xff1a;VolumeSnapshot<\/h5>\n<p>apiVersion: snapshot.storage.k8s.io\/v1<br \/>\nkind: VolumeSnapshot<br \/>\nmetadata:<br \/>\n  name: test-lvm-snap           # \u540c PVC namespace<br \/>\nspec:<br \/>\n  volumeSnapshotClassName: openebs-lvm-snapclass<br \/>\n  source:<br \/>\n    persistentVolumeClaimName: test-lvm-pvc   # \u4f60\u7684\u73b0\u6709 PVC<\/p>\n<h5>4.7.1.3\u00a0\u9a8c\u8bc1<\/h5>\n<p>[root&#064;k8s-master ~\/openEBS]# kubectl apply -f snapshotclass.yaml<br \/>\nvolumesnapshotclass.snapshot.storage.k8s.io\/openebs-lvm-snapclass created<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl apply -f snapshot.yaml<br \/>\nvolumesnapshot.snapshot.storage.k8s.io\/test-lvm-snap created<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl get volumesnapshot<br \/>\nNAME            READYTOUSE   SOURCEPVC      SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS           SNAPSHOTCONTENT                                    CREATIONTIME   AGE<br \/>\ntest-lvm-snap   true         test-lvm-pvc                           0             openebs-lvm-snapclass   snapcontent-fd4f61e0-0a8b-4a83-9e9e-c36f7b963c64   4s             4s<br \/>\n[root&#064;k8s-master ~\/openEBS]# kubectl get lvmsnapshot -n openebs<br \/>\nNAME                                            AGE<br \/>\nsnapshot-fd4f61e0-0a8b-4a83-9e9e-c36f7b963c64   8s<br \/>\n[root&#064;k8s-node1 ~]# lvs openebs-lvm-vg<br \/>\n  LV                                       VG             Attr       LSize Pool                    Origin                                   Data%  Meta%  Move Log Cpy%Sync Convert<br \/>\n  fd4f61e0-0a8b-4a83-9e9e-c36f7b963c64     openebs-lvm-vg Vri&#8212;tz-k 2.00g openebs-lvm-vg_thinpool pvc-746225fe-1a80-4151-ab6f-9aeb92557375<br \/>\n  openebs-lvm-vg_thinpool                  openebs-lvm-vg twi-aotz&#8211; 2.00g                                                                  4.79   12.11<br \/>\n  pvc-746225fe-1a80-4151-ab6f-9aeb92557375 openebs-lvm-vg Vwi-aotz&#8211; 2.00g openebs-lvm-vg_thinpool                                          4.79                                   <\/p>\n<h4>4.7.2 \u6062\u590d<\/h4>\n<h5>4.7.2.1 \u5b98\u65b9\u6848\u4f8b&#xff1a;\u6062\u590d PVC<\/h5>\n<p>apiVersion: v1<br \/>\nkind: PersistentVolumeClaim<br \/>\nmetadata:<br \/>\n  name: test-lvm-restore-pvc    # \u540c namespace<br \/>\nspec:<br \/>\n  storageClassName: openebs-lvm-advanced   # \u7528\u4f60\u7684\u73b0\u6709 SC&#xff08;\u9700\u5339\u914d VG&#xff09;<br \/>\n  dataSource:<br \/>\n    name: test-lvm-snap         # \u4e0a\u9762\u5feb\u7167\u540d<br \/>\n    kind: VolumeSnapshot<br \/>\n    apiGroup: snapshot.storage.k8s.io<br \/>\n  accessModes:<br \/>\n  &#8211; ReadWriteOnce<br \/>\n  resources:<br \/>\n    requests:<br \/>\n      storage: 2Gi                # \u5fc5\u987b\u7cbe\u786e\u5339\u914d\u5feb\u7167\u5927\u5c0f&#xff08;\u67e5 volumesnapshot status.restoreSize&#xff09;<\/p>\n<p>\u5148\u67e5\u5feb\u7167\u5927\u5c0f&#xff1a;kubectl get volumesnapshot test-lvm-snap -o yaml | grep restoreSize<\/p>\n<p>\u7528\u4f60\u7684 SC&#xff08;\u5df2\u914d thin &#043; vgpattern: &#034;openebs-lvm-vg&#034;&#xff0c;\u81ea\u52a8\u5339\u914d VG&#xff09;\u3002<\/p>\n<p>\u6062\u590d\u5377\u4f1a\u5728\u539f PVC \u8282\u70b9\u4e0a\u521b\u5efa&#xff08;\u540c VG&#xff09;\u3002<\/p>\n<p># \u9a8c\u8bc1&#xff1a;<br \/>\nkubectl get pvc test-lvm-restore-pvc<br \/>\nkubectl get lvmvolume -n openebs   # \u770b\u5230\u65b0 LVMVolume&#xff0c;spec.source \u6307\u5411 snapshot<\/p>\n<h3>4.8\u00a0Thin Provisioning<\/h3>\n<h4>4.8.1. \u6838\u5fc3\u5185\u5bb9\u603b\u7ed3&#xff08;\u5b98\u65b9\u5b9a\u4e49&#xff09;<\/h4>\n<p>\u7cbe\u7b80\u7f6e\u5907&#xff08;Thin Provisioning&#xff09; \u5141\u8bb8\u4f60\u201c\u8d85\u989d\u5206\u914d\u201d\u5b58\u50a8\u8d44\u6e90\u3002<\/p>\n<ul>\n<li>\n<p>\u4f20\u7edf\u65b9\u5f0f (Thick Provisioning)&#xff1a; \u4f60\u7533\u8bf7 2Gi&#xff0c;\u7cfb\u7edf\u7acb\u523b\u4ece\u786c\u76d8\u5212\u8d70 2Gi \u9501\u6b7b&#xff0c;\u522b\u4eba\u4e0d\u80fd\u7528&#xff0c;\u5373\u4fbf\u4f60\u53ea\u5b58\u4e86 1KB \u7684\u6587\u4ef6\u3002<\/p>\n<\/li>\n<li>\n<p>\u7cbe\u7b80\u65b9\u5f0f (Thin Provisioning)&#xff1a; \u4f60\u7533\u8bf7 2Gi&#xff0c;\u7cfb\u7edf\u5148\u7b54\u5e94\u7ed9\u4f60 2Gi&#xff0c;\u4f46\u5b9e\u9645\u5199\u591a\u5c11\u624d\u5360\u591a\u5c11\u3002\u5c31\u50cf\u4fe1\u7528\u989d\u5ea6&#xff0c;\u4f60\u6709 100 \u4e07\u989d\u5ea6&#xff0c;\u4f46\u4e0d\u4ee3\u8868\u4f60\u94f6\u884c\u91cc\u771f\u7684\u5b58\u4e86 100 \u4e07\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>4.8.2. \u901a\u4fd7\u6613\u61c2\u7684\u89e3\u91ca<\/h4>\n<p>\u60f3\u8c61\u4f60\u5728\u5f00\u4e00\u5bb6\u5065\u8eab\u623f&#xff08;\u5b58\u50a8\u6c60&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u539a\u7f6e\u5907 (Thick)&#xff1a; \u6bcf\u4e2a\u4f1a\u5458\u6765\u529e\u5361&#xff0c;\u4f60\u90fd\u5fc5\u987b\u7ed9\u4ed6\u5728\u66f4\u8863\u5ba4\u6c38\u4e45\u9501\u6b7b\u4e00\u4e2a\u67dc\u5b50\u3002\u5982\u679c\u4f60\u53ea\u6709 100 \u4e2a\u67dc\u5b50&#xff0c;\u529e\u5b8c 100 \u5f20\u5361\u4f60\u5c31\u4e0d\u80fd\u518d\u62db\u4eba\u4e86&#xff0c;\u54ea\u6015\u6709\u4e9b\u4f1a\u5458\u4e00\u5e74\u624d\u6765\u4e00\u6b21&#xff0c;\u67dc\u5b50\u4e00\u76f4\u7a7a\u7740\u3002<\/p>\n<\/li>\n<li>\n<p>\u7cbe\u7b80\u7f6e\u5907 (Thin)&#xff1a; \u4f60\u7167\u6837\u53d1\u4f1a\u5458\u5361&#xff0c;\u751a\u81f3\u53d1 200 \u5f20&#xff08;\u8d85\u5206\u914d&#xff09;\u3002\u67dc\u5b50\u662f\u5171\u4eab\u7684&#xff0c;\u8c01\u6765\u5065\u8eab&#xff08;\u5199\u6570\u636e&#xff09;\u8c01\u624d\u5360\u7528\u67dc\u5b50\u3002\u53ea\u8981\u4e0d\u662f 200 \u4eba\u540c\u65f6\u6765&#xff0c;\u4f60\u7684\u5065\u8eab\u623f\u5c31\u80fd\u6b63\u5e38\u8fd0\u8f6c\u3002<\/p>\n<ul>\n<li>\n<p>\u98ce\u9669&#xff1a; \u5982\u679c 200 \u4eba\u540c\u65f6\u6765\u4e86&#xff0c;\u67dc\u5b50\u5c31\u4e0d\u591f\u7528\u4e86&#xff08;\u7a7a\u95f4\u6491\u7206&#xff09;&#xff0c;\u4f1a\u5bfc\u81f4\u5e94\u7528\u5d29\u6e83\u3002\u6240\u4ee5\u9700\u8981\u76d1\u63a7\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>4.8.3. \u5b98\u65b9\u6848\u4f8b\u914d\u7f6e&#xff1a;<\/h4>\n<p>\u6b65\u9aa4 A&#xff1a;\u5f00\u542f\u5185\u6838\u652f\u6301<\/p>\n<p>\u64cd\u4f5c&#xff1a;modprobe dm_thin_pool \u5206\u6790&#xff1a;LVM \u7684\u7cbe\u7b80\u914d\u7f6e\u4f9d\u8d56 Linux \u5185\u6838\u7684 dm_thin_pool \u6a21\u5757\u3002\u8fd9\u662f\u201c\u5730\u57fa\u201d&#xff0c;\u5982\u679c\u4e0d\u52a0\u8f7d\u8fd9\u4e2a\u6a21\u5757&#xff0c;\u540e\u7eed\u6240\u6709\u64cd\u4f5c\u90fd\u4f1a\u5931\u8d25\u3002<\/p>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: openebs-lvm-advanced<br \/>\nallowVolumeExpansion: true<br \/>\nprovisioner: local.csi.openebs.io<br \/>\nparameters:<br \/>\n  volgroup: &#034;lvmvg&#034;<br \/>\n  thinProvision: &#034;yes&#034;  # \u6838\u5fc3\u53c2\u6570&#xff1a;\u5f00\u542f\u7cbe\u7b80\u7f6e\u5907<\/p>\n<p>\u6b65\u9aa4 B&#xff1a;\u76d1\u63a7\u4e0e\u81ea\u52a8\u6269\u5bb9&#xff08;\u8fdb\u9636\u6848\u4f8b&#xff09;<\/p>\n<p>\u5b98\u65b9\u5f3a\u8c03\u4e86\u81ea\u52a8\u6269\u5bb9&#xff08;Auto-extend&#xff09;&#xff0c;\u8fd9\u662f\u9632\u6b62\u201c\u6324\u5151\u201d\u7684\u5173\u952e\u3002<\/p>\n<p>\u914d\u7f6e\u6848\u4f8b&#xff08;\u5728\u8282\u70b9\u7684 \/etc\/lvm\/lvm.conf \u4e2d&#xff09;&#xff1a;<\/p>\n<p>Code snippet<\/p>\n<p>thin_pool_autoextend_threshold &#061; 75<br \/>\nthin_pool_autoextend_percent &#061; 20<\/p>\n<ul>\n<li>\n<p>\u5206\u6790&#xff1a;<\/p>\n<\/li>\n<li>\n<p>threshold &#061; 75&#xff1a;\u610f\u5473\u7740\u5f53\u7cbe\u7b80\u6c60\u7528\u4e86 75% \u7684\u65f6\u5019&#xff0c;\u89e6\u53d1\u81ea\u52a8\u6269\u5bb9\u3002<\/p>\n<\/li>\n<li>\n<p>percent &#061; 20&#xff1a;\u89e6\u53d1\u540e&#xff0c;\u6c60\u5b50\u7684\u7269\u7406\u5927\u5c0f\u81ea\u52a8\u589e\u52a0 20%\u3002<\/p>\n<\/li>\n<li>\n<p>\u6ce8\u610f&#xff1a;\u5b98\u65b9\u63d0\u9192&#xff0c;\u5373\u4fbf\u6539\u4e86\u914d\u7f6e\u6587\u4ef6&#xff0c;\u4f60\u8fd8\u9700\u8981\u6267\u884c lvchange &#8211;monitor y &lt;vg-name&gt;\/&lt;pool-name&gt;\u3002\u5982\u679c\u4e0d\u5f00\u542f monitor&#xff0c;\u914d\u7f6e\u6587\u4ef6\u6539\u4e86\u4e5f\u6ca1\u7528\u3002<\/p>\n<\/li>\n<\/ul>\n<h2>\u4e94\u3001Replicated PV Mayastor \u6838\u5fc3\u6982\u89c8<\/h2>\n<p>OpenEBS Replicated PV Mayastor \u662f\u4e00\u4e2a\u9ad8\u6027\u80fd\u3001\u5206\u5e03\u5f0f\u7684\u5757\u5b58\u50a8\u5f15\u64ce&#xff0c;\u7528\u4e8e\u5728 Kubernetes \u4e2d\u63d0\u4f9b \u540c\u6b65\u6570\u636e\u5197\u4f59&#xff08;\u591a\u526f\u672c&#xff09;\u4e0e\u9ad8\u53ef\u7528\u6027&#xff08;HA&#xff09;\u3002\u5b83\u9002\u5408 \u5173\u952e\u4efb\u52a1\u5de5\u4f5c\u8d1f\u8f7d&#xff0c;\u5982\u6570\u636e\u5e93\u6216\u5176\u4ed6\u5bf9\u6570\u636e\u6301\u4e45\u6027\u8981\u6c42\u975e\u5e38\u9ad8\u7684\u5e94\u7528\u3002<\/p>\n<h3>5.1\u00a0\u4ec0\u4e48\u662f Replicated PV Mayastor<\/h3>\n<p>Replicated PV Mayastor&#xff08;\u7b80\u79f0 Mayastor&#xff09; \u662f OpenEBS \u7684\u4e00\u4e2a\u5b58\u50a8\u5f15\u64ce&#xff0c;\u5176\u6838\u5fc3\u7279\u70b9\u662f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5757\u5b58\u50a8&#xff08;Block Storage&#xff09;&#xff1a;\u4e0d\u50cf\u76ee\u5f55\u7ea7\u522b\u7684\u6570\u636e\u5377&#xff0c;\u800c\u662f\u5e95\u5c42\u5757\u8bbe\u5907\u7ea7\u522b\u7684\u5b58\u50a8\u3002<\/p>\n<\/li>\n<li>\n<p>\u591a\u526f\u672c\u540c\u6b65&#xff08;Replicated&#xff09;&#xff1a;\u540c\u4e00\u4e2a\u6570\u636e\u5377\u7684\u591a\u4e2a\u526f\u672c\u540c\u65f6\u5b58\u5728\u4e8e\u4e0d\u540c\u8282\u70b9&#xff0c;\u63d0\u9ad8\u5bb9\u9519\u80fd\u529b\u3002<\/p>\n<\/li>\n<li>\n<p>\u9ad8\u53ef\u7528&#xff08;High Availability&#xff09;&#xff1a;\u8282\u70b9\u6545\u969c\u65f6\u6570\u636e\u4ecd\u7136\u53ef\u7528&#xff0c;\u4e0d\u4f1a\u76f4\u63a5\u5bfc\u81f4\u5b58\u50a8\u4e0d\u53ef\u8bbf\u95ee\u3002<\/p>\n<\/li>\n<li>\n<p>Kubernetes \u539f\u751f\u96c6\u6210&#xff1a;\u901a\u8fc7 CSI&#xff08;Container Storage Interface&#xff09;\u4e0e Kubernetes \u8c03\u5ea6\u534f\u540c\u5de5\u4f5c&#xff0c;\u5b9e\u73b0 PV\/PVC \u52a8\u6001\u5206\u914d\u3002<\/p>\n<\/li>\n<li>\n<p>\u6027\u80fd\u53cb\u597d&#xff1a;\u91c7\u7528 Rust \u7f16\u5199&#xff0c;\u9762\u5411 NVMe \u7b49\u9ad8\u901f\u8bbe\u5907&#xff0c;\u5177\u6709\u4f4e\u5ef6\u8fdf\u3001\u9ad8\u541e\u5410\u7684\u5b58\u50a8\u6027\u80fd\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>5.2 \u9002\u7528\u4e8e\u54ea\u4e9b\u573a\u666f<\/h3>\n<p>Replicated PV Mayastor \u4e3b\u8981\u7528\u4e8e\u89e3\u51b3 Kubernetes \u672c\u5730\u5b58\u50a8\u5728\u5bb9\u9519\u4e0e\u6301\u4e45\u6027\u65b9\u9762\u7684\u5c40\u9650&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5bb9\u9519\u95ee\u9898&#xff1a;\u5355\u673a Local PV&#xff08;\u5982 hostPath&#xff09;\u4e00\u65e6\u8282\u70b9\u6545\u969c&#xff0c;\u6570\u636e\u4e0d\u53ef\u7528\u3002<\/p>\n<\/li>\n<li>\n<p>\u9ad8\u53ef\u7528&#xff1a;\u901a\u8fc7\u540c\u6b65\u590d\u5236\u591a\u4e2a\u526f\u672c&#xff0c;\u5728\u8282\u70b9\u6545\u969c\u65f6\u4ecd\u7136\u4fdd\u8bc1\u6570\u636e\u53ef\u4ee5\u5728\u7ebf\u8bbf\u95ee\u3002<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u4e00\u81f4\u6027&#xff1a;\u590d\u5236\u5c42\u4fdd\u8bc1\u6570\u636e\u7684\u4e00\u81f4\u6027&#xff0c;\u5373\u4f7f\u53d1\u751f\u5199\u5165\u6545\u969c\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>5.3 Mayastor \u7684\u4e3b\u8981\u4f18\u52bf<\/h3>\n<h4>5.3.1 \u9ad8\u53ef\u7528\u5b58\u50a8&#xff08;Highly Available Storage&#xff09;<\/h4>\n<ul>\n<li>\n<p>\u6570\u636e\u8de8\u591a\u4e2a\u8282\u70b9\u8fdb\u884c\u540c\u6b65\u590d\u5236<\/p>\n<\/li>\n<li>\n<p>\u8282\u70b9\u6545\u969c\u4e0d\u5f71\u54cd\u5377\u53ef\u7528\u6027<\/p>\n<\/li>\n<li>\n<p>\u670d\u52a1\u5728\u591a\u526f\u672c\u4e4b\u95f4\u81ea\u52a8\u5bb9\u9519\u6062\u590d<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4cc; \u7ed3\u679c&#xff1a;\u5e94\u7528\u65e0\u9700\u81ea\u5df1\u5b9e\u73b0\u526f\u672c\u903b\u8f91\u5373\u53ef\u4eab\u53d7 HA \u80fd\u529b\u3002<\/p>\n<h4>5.3.2 \u6027\u80fd\u4f18\u5316&#xff08;Performance\u2011Optimized&#xff09;<\/h4>\n<ul>\n<li>\n<p>\u5185\u7f6e Rust \u8bed\u8a00\u5b9e\u73b0&#xff08;\u5b89\u5168 &#043; \u6027\u80fd&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u9762\u5411 NVMe \/ block \u8bbe\u5907\u4f18\u5316<\/p>\n<\/li>\n<li>\n<p>\u66f4\u4f4e IO \u5ef6\u8fdf\u3001\u66f4\u9ad8\u541e\u5410\u91cf<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4cc; \u9002\u7528\u4e8e\u6027\u80fd\u654f\u611f\u573a\u666f&#xff0c;\u4f8b\u5982\u6570\u636e\u5e93\u3001\u7f13\u5b58\u7b49\u9700\u8981\u9ad8 IO \u7684\u5e94\u7528\u3002<\/p>\n<h4>5.3.3 \u8282\u70b9\u4e0b\u964d\u6062\u590d\u80fd\u529b&#xff08;Node Failure Resiliency&#xff09;<\/h4>\n<p>\u5f53\u67d0\u4e2a\u8282\u70b9\u4e0d\u53ef\u7528&#xff1a;<\/p>\n<ul>\n<li>\n<p>Mayastor \u4f1a\u81ea\u52a8\u5c06\u8be5\u8282\u70b9\u7684\u526f\u672c\u4ece\u96c6\u7fa4\u4e2d\u5254\u9664<\/p>\n<\/li>\n<li>\n<p>\u5e76\u786e\u4fdd\u5269\u4f59\u526f\u672c\u7ee7\u7eed\u5bf9\u5916\u63d0\u4f9b\u6570\u636e\u670d\u52a1<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4cc; \u8fd9\u5927\u5927\u63d0\u5347\u4e86\u751f\u4ea7\u7ea7\u5bb9\u9519\u80fd\u529b\u3002<\/p>\n<h3>5.4\u00a0Mayastor \u4e0e OpenEBS LocalPV \u7684\u5bf9\u6bd4<\/h3>\n<table>\n<tr>\u7279\u6027LocalPVMayastor Replicated<\/tr>\n<tbody>\n<tr>\n<td>\u6570\u636e\u526f\u672c<\/td>\n<td>\u274c \u5355\u4e00<\/td>\n<td>\u2705 \u591a\u526f\u672c<\/td>\n<\/tr>\n<tr>\n<td>HA \u5bb9\u9519<\/td>\n<td>\u274c \u65e0<\/td>\n<td>\u2705 \u6709<\/td>\n<\/tr>\n<tr>\n<td>\u8282\u70b9\u6269\u5c55<\/td>\n<td>\u274c \u6570\u636e\u9501\u5b9a\u8282\u70b9<\/td>\n<td>\u2705 \u53ef\u91cd\u590d\u8c03\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>\u6027\u80fd\u5f00\u9500<\/td>\n<td>\u2b50\u2b50\u2b50<\/td>\n<td>\u2b50\u2b50&#xff08;\u56e0 replication&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Kubernetes \u539f\u751f<\/td>\n<td>\u2714<\/td>\n<td>\u2714<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u5408\u573a\u666f<\/td>\n<td>\u672c\u5730\u4e34\u65f6\u6570\u636e<\/td>\n<td>\u5173\u952e\u4efb\u52a1\u6301\u4e45\u5b58\u50a8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u516d\u3001\u5b89\u88c5\u8fd0\u884cReplicated PV Mayastor<\/h2>\n<h3>6.1 \u5b89\u88c5\u524d\u7f6e\u51c6\u5907<\/h3>\n<p>\u8fd9\u4e2a\u662f OpenEBS \u7528\u4e8e\u9ad8\u53ef\u9760\u6027\u548c\u9ad8\u6027\u80fd\u7684\u5f15\u64ce&#xff0c;\u5bf9\u73af\u5883\u8981\u6c42\u66f4\u4e25\u683c&#xff1a;<\/p>\n<li>\n<p>\u901a\u7528\u8981\u6c42<\/p>\n<ul>\n<li>\n<p>x86-64 CPU&#xff0c;\u652f\u6301 SSE4.2 \u6307\u4ee4\u96c6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u63a8\u8350 Linux kernel \u2265 5.15&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8282\u70b9\u5fc5\u987b\u6ee1\u8db3 SPI-NVMe\u3001ext4\/xfs \u7b49\u6a21\u5757\u52a0\u8f7d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Helm \u7248\u672c \u2265 v3.7&#xff08;\u5b89\u88c5 Mayastor \u7ec4\u4ef6\u7528&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8d44\u6e90\u8981\u6c42<\/p>\n<ul>\n<li>\n<p>Io-engine pod \u6bcf\u4e2a\u8282\u70b9\u81f3\u5c11&#xff1a;<\/p>\n<ul>\n<li>\n<p>2 \u4e2a CPU \u6838\u5fc3<\/p>\n<\/li>\n<li>\n<p>1GiB RAM<\/p>\n<\/li>\n<li>\n<p>\u652f\u6301 HugePages&#xff08;\u5927\u9875&#xff09;&#xff08;\u81f3\u5c11 2GiB 2MiB \u9875\u9762&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u7f51\u7edc\u8981\u6c42<\/p>\n<ul>\n<li>\n<p>\u786e\u4fdd\u67d0\u4e9b\u7aef\u53e3\u4e0d\u88ab\u5360\u7528&#xff0c;\u5982 gRPC \u670d\u52a1\u7aef\u53e3 10124&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5982\u679c\u7528 NVMe-oF TCP \u534f\u8bae&#xff0c;\u5fc5\u987b\u542f\u7528\u5e76\u4fdd\u8bc1\u8fde\u63a5\u65e0\u9632\u706b\u5899\u963b\u65ad\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u96c6\u7fa4\u89c4\u6a21<\/p>\n<ul>\n<li>\n<p>\u81f3\u5c11 3 \u4e2a worker \u8282\u70b9&#xff08;\u5c24\u5176\u4f7f\u7528\u590d\u5236\/\u955c\u50cf\u5377\u65f6&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u534f\u8bae\u9650\u5236<\/p>\n<ul>\n<li>\n<p>Replicated PV Mayastor \u53ea\u652f\u6301 NVMe-oF over TCP \u65b9\u5f0f\u6302\u8f7d\u5377\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<p>NVMe-oF TCP\u68c0\u67e5(\u6240\u6709\u8282\u70b9)<\/p>\n<p>lsmod | grep nvme_tcp<br \/>\n\u5982\u679c\u6ca1\u6709&#xff1a;<br \/>\nmodprobe nvme_tcp<br \/>\n# \u6c38\u4e45\u751f\u6548<br \/>\n[root&#064;k8s-master ~]# echo &#034;nvme_tcp&#034; &gt; \/etc\/modules-load.d\/nvme_tcp.conf<br \/>\n[root&#064;k8s-master ~]# cat \/etc\/modules-load.d\/nvme_tcp.conf<br \/>\nnvme_tcp<br \/>\n[root&#064;k8s-master ~]# systemctl daemon-reload &amp;&amp; systemctl restart systemd-modules-load.service<br \/>\n[root&#064;k8s-master ~]# lsmod | grep nvme_tcp<br \/>\nnvme_tcp               90112  0<br \/>\nnvme_fabrics           36864  1 nvme_tcp<br \/>\nnvme_core             241664  2 nvme_tcp,nvme_fabrics<br \/>\nnvme_keyring           20480  3 nvme_tcp,nvme_core,nvme_fabrics<\/p>\n<p>\u4e3aMayastor\u518d\u6b21\u6dfb\u52a0\u4e00\u575720G\u5927\u5c0f\u7684\u78c1\u76d8&#xff0c;\u6bcf\u4e00\u4e2a\u53c2\u4e0e\u526f\u672c\u8c03\u5ea6\u7684\u8282\u70b9\u90fd\u5fc5\u987b\u5177\u5907\u81f3\u5c11\u4e00\u5757\u72ec\u7acb\u7684\u88f8\u5757\u8bbe\u5907\u3002<\/p>\n<p>[root&#064;k8s-master ~]# lsblk<br \/>\nNAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS<br \/>\nsda                         8:0    0  100G  0 disk<br \/>\n\u251c\u2500sda1                      8:1    0    1M  0 part<br \/>\n\u251c\u2500sda2                      8:2    0    2G  0 part \/boot<br \/>\n\u2514\u2500sda3                      8:3    0   98G  0 part<br \/>\n  \u2514\u2500ubuntu&#8211;vg-ubuntu&#8211;lv 252:0    0   49G  0 lvm  \/var\/lib\/kubelet\/pods\/aa8670d2-3e92-418a-bebc-50e13b484160\/volume-subpaths\/tigera-ca-bundle\/calico-node\/6<br \/>\n                                                   \/<br \/>\nsdc                         8:16   0   20G  0 disk <\/p>\n<p>[root&#064;k8s-node2 ~]# mkfs.ext4 \/dev\/sdb<br \/>\nmke2fs 1.47.2 (1-Jan-2025)<br \/>\nCreating filesystem with 5242880 4k blocks and 1310720 inodes<br \/>\nFilesystem UUID: 242e50b2-91c5-46cc-8387-c14510cd2c4b<br \/>\nSuperblock backups stored on blocks:<br \/>\n        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,<br \/>\n        4096000<\/p>\n<p>Allocating group tables: done<br \/>\nWriting inode tables: done<br \/>\nCreating journal (32768 blocks): done<br \/>\nWriting superblocks and filesystem accounting information: done   <\/p>\n<p>[root&#064;k8s-node2 ~]# ls -l \/dev\/disk\/by-uuid\/ |grep sdb<br \/>\nlrwxrwxrwx 1 root root  9 Feb  3 09:07 242e50b2-91c5-46cc-8387-c14510cd2c4b -&gt; ..\/..\/sdb<\/p>\n<p>HugePages\u914d\u7f6e&#xff0c;\u6240\u6709\u8282\u70b9<\/p>\n<p>echo 1024 | sudo tee \/sys\/kernel\/mm\/hugepages\/hugepages-2048kB\/nr_hugepages<\/p>\n<p># \u9a8c\u8bc1<br \/>\n[root&#064;k8s-master ~]# grep Huge \/proc\/meminfo<br \/>\nAnonHugePages:         0 kB<br \/>\nShmemHugePages:        0 kB<br \/>\nFileHugePages:     20480 kB<br \/>\nHugePages_Total:    1024<br \/>\nHugePages_Free:     1024<br \/>\nHugePages_Rsvd:        0<br \/>\nHugePages_Surp:        0<br \/>\nHugepagesize:       2048 kB<br \/>\nHugetlb:         2097152 kB<\/p>\n<p># \u8bbe\u7f6e\u4e3a\u6c38\u4e45<br \/>\nvi \/etc\/sysctl.conf<br \/>\n\u52a0\u5165&#xff1a;<br \/>\nvm.nr_hugepages &#061; 1024<br \/>\n\u5e94\u7528&#xff1a;<br \/>\n[root&#064;k8s-master ~]# sysctl -p<br \/>\nvm.nr_hugepages &#061; 1024<\/p>\n<p>\u9a8c\u8bc1<br \/>\n[root&#064;k8s-master ~]# kubectl describe node k8s-node1 | grep -i hugepages-2Mi<br \/>\n  hugepages-2Mi:      2Gi<br \/>\n  hugepages-2Mi:      2Gi<br \/>\n  hugepages-2Mi      256Mi (12%)  256Mi (12%)<\/p>\n<p>\u5982\u679c\u662f0\u5219\u9700\u8981\u91cd\u542f\u6240\u6709\u8282\u70b9\u7684kubelet<br \/>\n[root&#064;k8s-master ~]#  systemctl restart kubelet<br \/>\n[root&#064;k8s-master ~]#  systemctl status kubelet<br \/>\n\u25cf kubelet.service &#8211; kubelet: The Kubernetes Node Agent<br \/>\n     Loaded: loaded (\/usr\/lib\/systemd\/system\/kubelet.service; enabled; preset: enabled)<br \/>\n    Drop-In: \/usr\/lib\/systemd\/system\/kubelet.service.d<br \/>\n             \u2514\u250010-kubeadm.conf<br \/>\n     Active: active (running) since Tue 2026-02-03 10:56:40 CST; 10s ago<br \/>\n Invocation: 84fbb8e199474a39b8920f033a575434<br \/>\n       Docs: https:\/\/kubernetes.io\/docs\/<br \/>\n   Main PID: 9263 (kubelet)<br \/>\n      Tasks: 12 (limit: 5114)<br \/>\n     Memory: 70.5M (peak: 108.3M)<br \/>\n        CPU: 3.466s<br \/>\n     CGroup: \/system.slice\/kubelet.service<br \/>\n             \u2514\u25009263 \/usr\/bin\/kubelet &#8211;bootstrap-kubeconfig&#061;\/etc\/kubernetes\/bootstrap-kubelet.conf &#8211;kubeconfig&#061;\/etc\/kubernetes\/kubelet.conf &#8211;config&#061;\/var\/lib\/kubelet\/config.yaml -&gt;<\/p>\n<p>Feb 03 10:56:47 k8s-master kubelet[9263]: I0203 10:56:47.510172    9263 reconciler_common.go:251] &#034;operationExecutor.VerifyControllerAttachedVolume started for volume \\\\&#034;ca-certs\\\\&#034; &gt;<br \/>\nFeb 03 10:56:47 k8s-master kubelet[9263]: I0203 10:56:47.510192    9263 reconciler_common.go:251] &#034;operationExecutor.VerifyControllerAttachedVolume started for volume \\\\&#034;kubeconfig\\\\&gt;<br \/>\nFeb 03 10:56:47 k8s-master kubelet[9263]: I0203 10:56:47.510201    9263 reconciler_common.go:251] &#034;operationExecutor.VerifyControllerAttachedVolume started for volume \\\\&#034;usr-local-s&gt;<br \/>\nFeb 03 10:56:47 k8s-master kubelet[9263]: I0203 10:56:47.510217    9263 reconciler_common.go:251] &#034;operationExecutor.VerifyControllerAttachedVolume started for volume \\\\&#034;usr-share-c&gt;<br \/>\nFeb 03 10:56:47 k8s-master kubelet[9263]: I0203 10:56:47.510231    9263 reconciler_common.go:251] &#034;operationExecutor.VerifyControllerAttachedVolume started for volume \\\\&#034;etcd-data\\\\&#034;&gt;<br \/>\nFeb 03 10:56:47 k8s-master kubelet[9263]: I0203 10:56:47.510240    9263 reconciler_common.go:251] &#034;operationExecutor.VerifyControllerAttachedVolume started for volume \\\\&#034;k8s-certs\\\\&#034;&gt;<br \/>\nFeb 03 10:56:47 k8s-master kubelet[9263]: I0203 10:56:47.941825    9263 kubelet_node_status.go:124] &#034;Node was previously registered&#034; node&#061;&#034;k8s-master&#034;<br \/>\nFeb 03 10:56:50 k8s-master kubelet[9263]: I0203 10:56:50.158212    9263 operation_generator.go:557] &#034;MountVolume.MountDevice succeeded for volume \\\\&#034;pvc-4dbad85b-bf40-43b2-85f6-cc1e&gt;<br \/>\nFeb 03 10:56:50 k8s-master kubelet[9263]: E0203 10:56:50.159466    9263 kubelet.go:3196] &#034;Failed creating a mirror pod&#034; err&#061;&#034;pods \\\\&#034;kube-controller-manager-k8s-master\\\\&#034; already exi&gt;<br \/>\nFeb 03 10:56:50 k8s-master kubelet[9263]: I0203 10:56:50.159492    9263 kubelet.go:3194] &#034;Creating a mirror pod for static pod&#034; pod&#061;&#034;kube-system\/kube-scheduler-k8s-master&#034;<\/p>\n<p>\u4e3a\u6240\u6709K8S\u96c6\u7fa4\u7684\u8282\u70b9\u6253\u4e0a\u5b58\u50a8\u6807\u7b7e<\/p>\n<p>[root&#064;k8s-master ~\/openEBS]# kubectl label node k8s-master k8s-node1 k8s-node2 openebs.io\/engine&#061;mayastor<\/p>\n<p>6.2 \u4f7f\u7528Helm\u5b89\u88c5\u5e94\u7528<\/p>\n<p># \u53ea\u5b89\u88c5 Replicated Storage&#xff08;Mayastor&#xff09;<br \/>\nhelm install openebs openebs\/openebs \\\\<br \/>\n\u00a0 &#8211;namespace openebs \\\\<br \/>\n\u00a0 &#8211;create-namespace \\\\<br \/>\n\u00a0 &#8211;set engines.local.hostpath.enabled&#061;false \\\\<br \/>\n\u00a0 &#8211;set engines.local.lvm.enabled&#061;false \\\\<br \/>\n\u00a0 &#8211;set engines.local.zfs.enabled&#061;false \\\\<br \/>\n\u00a0 &#8211;wait \\\\<br \/>\n\u00a0 &#8211;timeout 15m<\/p>\n<h3>6.2\u00a0\u5178\u578b\u5de5\u4f5c\u6d41\u7a0b<\/h3>\n<p>1) \u521b\u5efa DiskPool&#xff08;\u5757\u8bbe\u5907\u6c60&#xff09;<\/p>\n<ul>\n<li>\n<p>\u5728\u6bcf\u4e2a\u652f\u6301 Mayastor \u7684\u8282\u70b9\u4e0a\u58f0\u660e\u4e00\u4e2a\u6216\u591a\u4e2a DiskPool<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u9645\u7531\u5355\u4e2a\u5757\u8bbe\u5907&#xff08;\u5982 NVMe \/ SSD \/ raw disk&#xff09;\u63d0\u4f9b\u5bb9\u91cf<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4cc; DiskPool \u662f Mayastor \u5377\u7684\u5b58\u50a8\u57fa\u7840&#xff0c;\u7528\u4e8e\u5206\u914d\u526f\u672c\u5b58\u50a8\u7a7a\u95f4\u3002<\/p>\n<p>2) \u521b\u5efa Replicated StorageClass<\/p>\n<p>\u4f60\u53ef\u4ee5\u5b9a\u4e49 StorageClass \u6765\u6307\u5b9a&#xff1a;<\/p>\n<ul>\n<li>\n<p>protocol&#xff08;\u5982 nvmf&#xff09;<\/p>\n<\/li>\n<li>\n<p>repl&#xff08;\u526f\u672c\u6570&#xff0c;\u4f8b\u5982 2 \u6216 3&#xff09;<\/p>\n<\/li>\n<li>\n<p>thin \/ thick provisioning<\/p>\n<\/li>\n<li>\n<p>fsType&#xff08;\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b&#xff09;<\/p>\n<\/li>\n<\/ul>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: mayastor-3<br \/>\nparameters:<br \/>\n  protocol: nvmf<br \/>\n  repl: &#034;3&#034;<br \/>\nprovisioner: io.openebs.csi-mayastor<\/p>\n<p>3) PVC \u2192 Pod \u6d41\u7a0b<\/p>\n<li>\n<p>\u521b\u5efa PVC&#xff0c;\u6307\u5b9a\u4e0a\u9762\u7684 StorageClass<\/p>\n<\/li>\n<li>\n<p>CSI driver \u8c03\u7528 Mayastor \u670d\u52a1\u521b\u5efa\u903b\u8f91\u5377<\/p>\n<\/li>\n<li>\n<p>Mayastor \u4f1a\u5728\u591a\u4e2a\u8282\u70b9\u4e0a\u521b\u5efa\u526f\u672c\u5e76\u540c\u6b65<\/p>\n<\/li>\n<li>\n<p>Pod \u6302\u8f7d\u5377\u5e76\u6b63\u5e38\u8bfb\u5199<\/p>\n<\/li>\n<li>\n<p>\u5982\u679c\u8282\u70b9\u6545\u969c&#xff0c;\u526f\u672c\u4ecd\u7136\u5728\u7ebf\u63d0\u4f9b\u6570\u636e\u670d\u52a1<\/p>\n<\/li>\n<p>&#x1f4cc; \u6574\u4e2a\u8fc7\u7a0b\u7531 Kubernetes \u4e0e CSI \u534f\u8bae\u7edf\u4e00\u7ba1\u7406&#xff0c;\u65e0\u9700\u624b\u5de5\u64cd\u4f5c\u3002<\/p>\n<h3>6.3 \u521b\u5efaDiskPool<\/h3>\n<p>\u521b\u5efa DiskPool&#xff08;\u5b58\u50a8\u6c60&#xff09;DiskPool \u662f Mayastor \u5377\u7684\u7269\u7406\u57fa\u7840&#xff0c;\u7528\u4e8e\u7ba1\u7406\u8282\u70b9\u4e0a\u7684\u5757\u8bbe\u5907\u3002<br \/>\n# \u8282\u70b9 k8s-master \u7684\u5b58\u50a8\u6c60<br \/>\napiVersion: &#034;openebs.io\/v1beta3&#034;<br \/>\nkind: DiskPool<br \/>\nmetadata:<br \/>\n  name: pool-k8s-master<br \/>\n  namespace: openebs<br \/>\nspec:<br \/>\n  node: k8s-master<br \/>\n  disks: [&#034;aio:\/\/\/dev\/disk\/by-uuid\/746b2ce7-c116-4b5a-b860-ef0b17340558&#034;]<br \/>\n&#8212;<br \/>\n# \u8282\u70b9 k8s-node1 \u7684\u5b58\u50a8\u6c60<br \/>\napiVersion: &#034;openebs.io\/v1beta3&#034;<br \/>\nkind: DiskPool<br \/>\nmetadata:<br \/>\n  name: pool-k8s-node1<br \/>\n  namespace: openebs<br \/>\nspec:<br \/>\n  node: k8s-node1<br \/>\n  disks: [&#034;aio:\/\/\/dev\/disk\/by-uuid\/38821f23-8e48-4d1a-87ab-99320cd4306a&#034;]<br \/>\n&#8212;<br \/>\n# \u8282\u70b9 k8s-node2 \u7684\u5b58\u50a8\u6c60<br \/>\napiVersion: &#034;openebs.io\/v1beta3&#034;<br \/>\nkind: DiskPool<br \/>\nmetadata:<br \/>\n  name: pool-k8s-node2<br \/>\n  namespace: openebs<br \/>\nspec:<br \/>\n  node: k8s-node2<br \/>\n  disks: [&#034;aio:\/\/\/dev\/disk\/by-uuid\/242e50b2-91c5-46cc-8387-c14510cd2c4b&#034;]<\/p>\n<p>[root&#064;k8s-master ~\/openEBS]# kubectl apply -f DiskPool.yaml<br \/>\ndiskpool.openebs.io\/pool-k8s-master created<br \/>\ndiskpool.openebs.io\/pool-k8s-node1 created<br \/>\ndiskpool.openebs.io\/pool-k8s-node2 created<\/p>\n<p>kubectl get dsp -n openebs<br \/>\n\u5fc5\u987b\u786e\u4fdd\u4e09\u4e2a\u6c60\u7684 STATE \u90fd\u662f Online\u3002<\/p>\n<ul>\n<li>\n<p>nodeSelector&#xff1a;\u6307\u5b9a\u78c1\u76d8\u6240\u5c5e\u8282\u70b9<\/p>\n<\/li>\n<li>\n<p>disks&#xff1a;\u88f8\u5757\u8bbe\u5907\u8def\u5f84<\/p>\n<\/li>\n<li>\n<p>\u6bcf\u4e2a\u8282\u70b9\u53ef\u4ee5\u6709\u591a\u4e2a DiskPool<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4cc; \u89e3\u91ca&#xff1a;DiskPool \u5c31\u662f\u5b58\u50a8\u6c60&#xff0c;\u6bcf\u4e2a\u8282\u70b9\u6302\u4e00\u5757\u8bbe\u5907&#xff0c;Mayastor \u5377\u53ef\u4ee5\u8de8\u6c60\u521b\u5efa\u526f\u672c\u3002<\/p>\n<h3>6.4 \u521b\u5efaSC<\/h3>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: mayastor-3-repl<br \/>\nprovisioner: openebs.io\/logging<br \/>\nparameters:<br \/>\n  repl: &#034;3&#034;              # \u526f\u672c\u6570\u91cf<br \/>\n  protocol: nvmf         # \u6570\u636e\u4f20\u8f93\u534f\u8bae<br \/>\n  # \u5982\u679c\u4f60\u4ee5\u540e\u60f3\u7ed9\u6c60\u52a0\u6807\u7b7e\u8fdb\u884c\u7cbe\u7ec6\u5316\u7ba1\u7406&#xff0c;\u53ef\u4ee5\u5f00\u542f\u4e0b\u9762\u7684\u53c2\u6570<br \/>\n  # poolHasTopologyKey: &#034;openebs.io\/engine&#034;<br \/>\nallowVolumeExpansion: true<br \/>\nreclaimPolicy: Delete<br \/>\nvolumeBindingMode: Immediate<\/p>\n<ul>\n<li>\n<p>provisioner: openebs.io\/logging \u662f Mayastor 4.x \u9ed8\u8ba4\u7684\u5b58\u50a8\u9a71\u52a8\u540d\u79f0\u3002<\/p>\n<p>repl: &#034;3&#034;: \u8fd9\u610f\u5473\u7740\u5f53\u4f60\u521b\u5efa\u4e00\u4e2a PVC \u65f6&#xff0c;Mayastor \u4f1a\u81ea\u52a8\u5728\u4f60\u7684\u4e09\u4e2a DiskPool \u4e0a\u5404\u521b\u5efa\u4e00\u4e2a\u526f\u672c\u3002<\/p>\n<p>protocol: nvmf: \u4f7f\u7528 NVMe-over-Fabrics \u534f\u8bae\u3002\u56e0\u4e3a\u4f60\u4e4b\u524d\u5df2\u7ecf\u52a0\u8f7d\u4e86 nvme_tcp \u6a21\u5757&#xff0c;\u6240\u4ee5\u8fd9\u91cc\u7528\u8fd9\u4e2a\u534f\u8bae\u6027\u80fd\u6700\u597d\u3002<\/p>\n<p>volumeBindingMode: Immediate: \u7acb\u5373\u7ed1\u5b9a\u3002\u5bf9\u4e8e\u5206\u5e03\u5f0f\u5b58\u50a8&#xff0c;\u8fd9\u80fd\u786e\u4fdd PVC \u521b\u5efa\u540e\u7acb\u523b\u5b8c\u6210\u8c03\u5ea6\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u9ad8\u7ea7\u8c03\u5ea6\u53c2\u6570 (Placement &amp; Topology)<\/p>\n<p>\u8fd9\u4e9b\u53c2\u6570\u51b3\u5b9a\u4e86\u526f\u672c\u201c\u843d\u5728\u54ea\u91cc\u201d&#xff1a;<\/p>\n<ul>\n<li>\n<p>poolHasTopologyKey: \u5982\u679c\u4f60\u7ed9 DiskPool \u6253\u4e86\u81ea\u5b9a\u4e49\u6807\u7b7e&#xff08;\u4f8b\u5982 topology.kubernetes.io\/zone&#061;zone1&#xff09;&#xff0c;\u8bbe\u7f6e\u6b64\u53c2\u6570\u53ef\u4ee5\u8ba9 Mayastor \u4f18\u5148\u9009\u62e9\u5e26\u6709\u8be5\u6807\u7b7e\u7684\u6c60\u3002<\/p>\n<\/li>\n<li>\n<p>affinityGroup: \u7528\u4e8e\u786e\u4fdd\u5c5e\u4e8e\u540c\u4e00\u7ec4\u7684\u5377\u526f\u672c\u5728\u7269\u7406\u4e0a\u5c3d\u53ef\u80fd\u5206\u6563\u6216\u805a\u5408\u3002<\/p>\n<\/li>\n<li>\n<p>nodeSelector \/ poolSelector: \u901a\u8fc7\u6807\u7b7e\u8fc7\u6ee4\u7279\u5b9a\u7684\u8282\u70b9\u6216\u5b58\u50a8\u6c60\u3002\u4f8b\u5982&#xff1a;\u53ea\u60f3\u8ba9\u6570\u636e\u5e93\u8fd0\u884c\u5728\u5e26 SSD \u7684\u8282\u70b9\u4e0a\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>6.5 \u521b\u5efaPVC<\/h3>\n<p>cat &lt;&lt;EOF | kubectl apply -f &#8211;<br \/>\napiVersion: v1<br \/>\nkind: PersistentVolumeClaim<br \/>\nmetadata:<br \/>\n  name: mayastor-test-pvc<br \/>\nspec:<br \/>\n  storageClassName: mayastor-3-repl<br \/>\n  accessModes:<br \/>\n    &#8211; ReadWriteOnce<br \/>\n  resources:<br \/>\n    requests:<br \/>\n      storage: 1Gi<br \/>\nEOF<\/p>\n<h3>6.6 \u521b\u5efa\u6d4b\u8bd5Pod<\/h3>\n<p>cat &lt;&lt;EOF | kubectl apply -f &#8211;<br \/>\napiVersion: v1<br \/>\nkind: Pod<br \/>\nmetadata:<br \/>\n  name: storage-test-app<br \/>\nspec:<br \/>\n  containers:<br \/>\n  &#8211; name: writer<br \/>\n    image: alpine<br \/>\n    command: [&#034;\/bin\/sh&#034;, &#034;-c&#034;]<br \/>\n    args:<br \/>\n      &#8211; while true; do<br \/>\n          date &gt;&gt; \/mnt\/data\/test-log.txt;<br \/>\n          echo &#034;Data written to Mayastor volume&#034;;<br \/>\n          sleep 5;<br \/>\n        done<br \/>\n    volumeMounts:<br \/>\n    &#8211; name: my-volume<br \/>\n      mountPath: \/mnt\/data<br \/>\n  volumes:<br \/>\n  &#8211; name: my-volume<br \/>\n    persistentVolumeClaim:<br \/>\n      claimName: mayastor-test-pvc<br \/>\nEOF<\/p>\n<p>&#x1f4cc; \u89e3\u91ca&#xff1a;Pod \u6302\u8f7d PVC&#xff0c;Mayastor \u4f1a\u5728\u591a\u4e2a\u8282\u70b9\u4e0a\u521b\u5efa\u526f\u672c&#xff0c;\u5b9e\u73b0\u9ad8\u53ef\u7528\u5b58\u50a8\u3002<\/p>\n<p>\u6838\u5fc3\u6ce8\u610f\u4e8b\u9879<\/p>\n<li>\n<p>\u526f\u672c\u6570 \u2264 \u8282\u70b9\u6570<\/p>\n<ul>\n<li>\n<p>\u5982\u679c\u96c6\u7fa4\u53ea\u6709 2 \u8282\u70b9&#xff0c;repl&#061;3 \u4f1a\u5931\u8d25<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u88f8\u5757\u8bbe\u5907<\/p>\n<ul>\n<li>\n<p>DiskPool \u5fc5\u987b\u4f7f\u7528\u672a\u6302\u8f7d\u7684\u5757\u8bbe\u5907&#xff08;\u4e0d\u80fd\u662f \/var\/lib\/kubelet\/pods\/ \u5df2\u6302\u8f7d\u5377&#xff09;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6587\u4ef6\u7cfb\u7edf<\/p>\n<ul>\n<li>\n<p>Mayastor \u53ef\u4ee5\u76f4\u63a5\u63d0\u4f9b\u5757\u8bbe\u5907\u7ed9 Pod&#xff0c;PVC \u53ef\u4ee5\u9009\u62e9 xfs \u6216 ext4<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6269\u5bb9<\/p>\n<ul>\n<li>\n<p>StorageClass \u5f00\u542f allowVolumeExpansion: true&#xff0c;PVC \u53ef\u5728\u7ebf\u6269\u5bb9<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u9ad8\u53ef\u7528<\/p>\n<ul>\n<li>\n<p>Pod \u8c03\u5ea6\u8282\u70b9\u5931\u8d25\u6216\u8282\u70b9\u6545\u969c&#xff0c;\u4e0d\u5f71\u54cd\u5377\u8bfb\u5199.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<table>\n<tr>\u5b98\u65b9\u672f\u8bed\u901a\u4fd7\u7406\u89e3<\/tr>\n<tbody>\n<tr>\n<td>DiskPool<\/td>\n<td>\u8282\u70b9\u7269\u7406\u5757\u8bbe\u5907\u6c60<\/td>\n<\/tr>\n<tr>\n<td>Mayastor Volume<\/td>\n<td>\u591a\u526f\u672c\u5b58\u50a8\u5377&#xff08;PV&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>StorageClass<\/td>\n<td>\u5377\u6a21\u677f&#xff0c;\u6307\u5b9a\u526f\u672c\u3001\u534f\u8bae\u3001\u6587\u4ef6\u7cfb\u7edf\u7b49<\/td>\n<\/tr>\n<tr>\n<td>repl<\/td>\n<td>\u526f\u672c\u6570<\/td>\n<\/tr>\n<tr>\n<td>nvmf \/ iscsi<\/td>\n<td>\u5757\u8bbe\u5907\u8bbf\u95ee\u534f\u8bae<\/td>\n<\/tr>\n<tr>\n<td>WaitForFirstConsumer<\/td>\n<td>\u5377\u7ed1\u5b9a\u5728 Pod \u8c03\u5ea6\u8282\u70b9\u65f6\u521b\u5efa<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u4e03\u3001Replicated PV Mayastor\u9ad8\u7ea7\u7279\u6027<\/h2>\n<h3>7.1\u00a0\u9ad8\u53ef\u7528\u6027<\/h3>\n<h4>7.1.1 Mayastor HA \u7684\u6838\u5fc3\u7ec4\u4ef6<\/h4>\n<p>Mayastor \u5b9e\u73b0\u201c\u6545\u969c\u65e0\u611f\u201d\u5207\u6362\u4e3b\u8981\u9760\u4e24\u4e2a\u673a\u5236&#xff1a;<\/p>\n<ul>\n<li>\n<p>Nexus&#xff08;\u63a7\u5236\u8282\u70b9&#xff09;&#xff1a;\u5377\u7684\u201c\u6307\u6325\u4e2d\u5fc3\u201d&#xff0c;\u8d1f\u8d23\u63a5\u6536 I\/O \u5e76\u5206\u53d1\u7ed9\u5404\u4e2a\u526f\u672c\u3002<\/p>\n<\/li>\n<li>\n<p>High Availability Storage Agent (ha-node)&#xff1a;\u5728\u6bcf\u4e2a\u8282\u70b9\u4e0a\u8fd0\u884c&#xff0c;\u8d1f\u8d23\u76d1\u63a7\u8def\u5f84\u5065\u5eb7\u72b6\u51b5\u5e76\u5728\u4e3b\u8282\u70b9\u5931\u6548\u65f6\u5feb\u901f\u5207\u6362\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>7.1.2 HA \u7684\u5173\u952e\u5de5\u4f5c\u6d41\u7a0b<\/h4>\n<p>\u5f53\u4e00\u4e2a\u5b58\u50a8\u8282\u70b9\u6302\u6389\u65f6&#xff0c;Mayastor \u4f1a\u6309\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c&#xff1a;<\/p>\n<li>\n<p>\u68c0\u6d4b&#xff08;Detection&#xff09;&#xff1a;\u63a7\u5236\u5e73\u9762\u53d1\u73b0\u67d0\u4e2a\u526f\u672c\u65e0\u6cd5\u8fde\u63a5\u3002<\/p>\n<\/li>\n<li>\n<p>\u6807\u8bb0&#xff08;Marking&#xff09;&#xff1a;\u8be5\u526f\u672c\u88ab\u6807\u8bb0\u4e3a Faulted\u3002<\/p>\n<\/li>\n<li>\n<p>IO \u91cd\u65b0\u8def\u7531&#xff1a;\u5982\u679c\u6302\u6389\u7684\u662f\u4e3b\u8282\u70b9&#xff08;Nexus \u6240\u5728\u8282\u70b9&#xff09;&#xff0c;CSI \u4f1a\u8fc5\u901f\u5728\u53e6\u4e00\u4e2a\u5065\u5eb7\u7684\u8282\u70b9\u4e0a\u91cd\u5efa Nexus&#xff0c;Pod \u7684 I\/O \u81ea\u52a8\u5207\u5230\u65b0\u8def\u5f84\u3002<\/p>\n<\/li>\n<li>\n<p>\u81ea\u52a8\u4fee\u590d&#xff08;Self-healing&#xff09;&#xff1a;\u4e00\u65e6\u574f\u8282\u70b9\u6062\u590d\u6216\u65b0\u8282\u70b9\u52a0\u5165&#xff0c;Mayastor \u4f1a\u81ea\u52a8\u4ece\u5065\u5eb7\u7684\u526f\u672c\u5f00\u59cb Rebuild&#xff08;\u6570\u636e\u91cd\u6784&#xff09;&#xff0c;\u76f4\u5230\u526f\u672c\u6570\u518d\u6b21\u8fbe\u5230 repl \u8bbe\u5b9a\u7684\u503c\u3002<\/p>\n<\/li>\n<h4>7.1.3 HA \u76f8\u5173\u7684\u91cd\u8981 SC \u53c2\u6570<\/h4>\n<p>\u5728 StorageClass \u4e2d&#xff0c;\u6709\u4e24\u4e2a\u9ad8\u7ea7\u53c2\u6570\u53ef\u4ee5\u5fae\u8c03 HA \u884c\u4e3a&#xff1a;<\/p>\n<table>\n<tr>\u53c2\u6570\u5efa\u8bae\u503c\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>local<\/td>\n<td>true<\/td>\n<td>\u672c\u5730\u4f18\u5148\u3002Nexus \u4f1a\u4f18\u5148\u521b\u5efa\u5728 Pod \u6240\u5728\u7684\u8282\u70b9\u4e0a&#xff0c;\u51cf\u5c11\u7f51\u7edc\u5f00\u9500\u3002<\/td>\n<\/tr>\n<tr>\n<td>rebuildOrder<\/td>\n<td>0<\/td>\n<td>\u91cd\u6784\u4f18\u5148\u7ea7\u3002\u6570\u503c\u8d8a\u5c0f&#xff0c;\u5f53\u53d1\u751f\u6545\u969c\u65f6&#xff0c;\u8be5\u5377\u91cd\u6784\u7684\u4f18\u5148\u7ea7\u8d8a\u9ad8\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5e38\u7528\u7ef4\u62a4\u64cd\u4f5c<\/p>\n<p>A. \u67e5\u770b\u5377\u7684\u5065\u5eb7\u8be6\u7ec6\u72b6\u6001<\/p>\n<p>\u4e0d\u4ec5\u4ec5\u662f kubectl get pvc&#xff0c;\u4f60\u9700\u8981\u770b Mayastor \u4e13\u5c5e\u7684\u8d44\u6e90\u72b6\u6001&#xff1a;<\/p>\n<p># \u67e5\u770b\u6240\u6709 Mayastor \u5377\u53ca\u5176\u5065\u5eb7\u72b6\u6001<br \/>\nkubectl get mayastorvolumes -n openebs<br \/>\n\u200b<br \/>\n# \u67e5\u770b\u66f4\u8be6\u7ec6\u7684\u526f\u672c\u5206\u5e03\u548c Nexus \u72b6\u6001<br \/>\nkubectl describe mnv -n openebs &lt;volume-name&gt;<\/p>\n<p>B. \u6a21\u62df\u6545\u969c\u6d4b\u8bd5 (Chaos Testing)<\/p>\n<p>\u4f60\u53ef\u4ee5\u624b\u52a8\u5220\u6389\u4e00\u4e2a io-engine Pod \u6765\u6a21\u62df\u8282\u70b9\u5b95\u673a&#xff1a;<\/p>\n<li>\n<p>\u89c2\u5bdf kubectl get mnv&#xff0c;\u4f60\u4f1a\u53d1\u73b0\u5377\u7684\u72b6\u6001\u53d8\u4e3a Degraded&#xff08;\u964d\u7ea7&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u89c2\u5bdf\u4f60\u7684\u6d4b\u8bd5\u5e94\u7528&#xff0c;\u7531\u4e8e\u6709 3 \u526f\u672c&#xff0c;\u8bfb\u5199\u5e94\u8be5 \u4e0d\u4f1a\u4e2d\u65ad\u3002<\/p>\n<\/li>\n<li>\n<p>\u6062\u590d Pod \u540e&#xff0c;\u89c2\u5bdf\u72b6\u6001\u53d8\u4e3a Online&#xff0c;\u8bf4\u660e\u91cd\u6784\u5b8c\u6210\u3002<\/p>\n<\/li>\n<p>\u6700\u4f73\u5b9e\u8df5\u5efa\u8bae<\/p>\n<p>\u526f\u672c\u6570 &gt;&#061;3&#xff1a;\u8fd9\u662f HA \u7684\u57fa\u7840&#xff0c;\u4fdd\u8bc1\u5728\u201c\u4e00\u8282\u70b9\u7ef4\u62a4&#043;\u4e00\u8282\u70b9\u7a81\u53d1\u6545\u969c\u201d\u65f6\u6570\u636e\u4f9d\u7136\u5b89\u5168\u3002<\/p>\n<p>\u7f51\u7edc\u5ef6\u8fdf&#xff1a;HA \u4f9d\u8d56\u8282\u70b9\u95f4\u7684\u5b9e\u65f6\u540c\u6b65&#xff0c;\u786e\u4fdd\u4f60\u7684\u4e09\u53f0\u865a\u62df\u673a\u4e4b\u95f4\u662f\u4e07\u5146\u7f51\u6216\u6781\u4f4e\u5ef6\u8fdf\u7684\u5185\u7f51\u3002<\/p>\n<p>\u4e0d\u8981\u5728 Master \u8282\u70b9\u8fd0\u884c I\/O \u5bc6\u96c6\u578b\u5e94\u7528&#xff1a;\u867d\u7136\u4f60\u73b0\u5728\u662f\u4e09\u8282\u70b9\u5168\u5f00&#xff0c;\u4f46\u5728\u5927\u89c4\u6a21\u73af\u5883\u4e0b&#xff0c;\u5efa\u8bae\u5c06\u5b58\u50a8\u8282\u70b9\u548c\u8ba1\u7b97\u8282\u70b9\u9002\u5f53\u5206\u79bb\u3002<\/p>\n<h3>7.2 Kubectl \u63d2\u4ef6<\/h3>\n<p>OpenEBS \u5b98\u65b9\u63d0\u4f9b\u4e86\u4e00\u4e2a\u540d\u4e3a mayastor \u7684 kubectl \u63d2\u4ef6&#xff0c;\u5b83\u662f\u8fd0\u7ef4 Mayastor \u7684\u201c\u745e\u58eb\u519b\u5200\u201d\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u5bf9\u8be5\u63d2\u4ef6\u6838\u5fc3\u529f\u80fd\u548c\u5e38\u7528\u547d\u4ee4\u7684\u6df1\u5ea6\u603b\u7ed3&#xff1a;<\/p>\n<p>\u867d\u7136 Mayastor \u7684\u5bf9\u8c61&#xff08;\u5982 DiskPool, Volume&#xff09;\u662f K8s \u8d44\u6e90&#xff0c;\u4f46\u5f88\u591a\u5e95\u5c42\u7ec6\u8282&#xff08;\u5982 Nexus \u5185\u90e8\u72b6\u6001\u3001\u526f\u672c\u540c\u6b65\u8fdb\u5ea6\u3001SPDK \u6307\u6807&#xff09;\u5728\u6807\u51c6\u547d\u4ee4\u4e0b\u662f\u4e0d\u53ef\u89c1\u7684\u3002\u8be5\u63d2\u4ef6\u76f4\u63a5\u4e0e\u63a7\u5236\u5e73\u9762\u901a\u4fe1&#xff0c;\u63d0\u4f9b \u5b58\u50a8\u89c6\u89d2 \u7684\u5b9e\u65f6\u6570\u636e\u3002<\/p>\n<h4>7.2.1 \u6838\u5fc3\u67e5\u8be2\u547d\u4ee4\u603b\u7ed3<\/h4>\n<table>\n<tr>\u7ef4\u5ea6\u547d\u4ee4\u7528\u9014<\/tr>\n<tbody>\n<tr>\n<td>\u5b58\u50a8\u8282\u70b9<\/td>\n<td>kubectl mayastor get nodes<\/td>\n<td>\u67e5\u770b\u6240\u6709\u5b58\u50a8\u8282\u70b9\u7684\u72b6\u6001\u3001gRPC \u7aef\u70b9\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5b58\u50a8\u6c60<\/td>\n<td>kubectl mayastor get pools<\/td>\n<td>\u67e5\u770b\u6c60\u7684\u7269\u7406\u5bb9\u91cf\u3001\u5df2\u7528\u7a7a\u95f4\u3001\u8282\u70b9\u5f52\u5c5e\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5b58\u50a8\u5377<\/td>\n<td>kubectl mayastor get volumes<\/td>\n<td>\u6700\u5e38\u7528\u3002\u67e5\u770b\u5377\u7684\u5065\u5eb7\u72b6\u6001&#xff08;Online, Degraded&#xff09;\u3001\u526f\u672c\u6570\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u526f\u672c\u7ec6\u8282<\/td>\n<td>kubectl mayastor get replicas<\/td>\n<td>\u67e5\u770b\u5177\u4f53\u6bcf\u4e2a\u526f\u672c\u5728\u54ea\u4e2a\u8282\u70b9\u3001\u54ea\u4e2a\u76d8\u4e0a\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fdb\u9636\u8bca\u65ad\u547d\u4ee4<\/p>\n<p>\u5f53\u4f60\u9047\u5230 PVC \u6302\u8f7d\u4e0d\u4e0a\u6216\u8005 IO \u62a5\u9519\u65f6&#xff0c;\u4ee5\u4e0b\u547d\u4ee4\u80fd\u6551\u547d&#xff1a;<\/p>\n<p>A. \u67e5\u770b\u5377\u7684\u62d3\u6251\u7ed3\u6784<\/p>\n<p>kubectl mayastor get volume-spec &lt;volume-uuid&gt;<\/p>\n<p>\u8fd9\u80fd\u5c55\u793a\u8fd9\u4e2a\u5377\u7684 Nexus \u8fd0\u884c\u5728\u54ea\u4e2a\u8282\u70b9&#xff0c;\u4ee5\u53ca\u5b83\u7684 Replica \u5206\u5e03\u5728\u54ea\u4e9b\u8282\u70b9\u3002<\/p>\n<p>B. \u52a8\u6001\u8c03\u6574\u526f\u672c\u6570<\/p>\n<p>\u5982\u679c\u53d1\u73b0\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\u6216\u60f3\u63d0\u9ad8\u5197\u4f59&#xff0c;\u53ef\u4ee5\u52a8\u6001\u4fee\u6539&#xff1a;<\/p>\n<p># \u5c06\u526f\u672c\u6570\u4ece 3 \u6539\u4e3a 2<br \/>\nkubectl mayastor scale volume &lt;volume-uuid&gt; &#8211;replica-count 2<\/p>\n<p>\u6545\u969c\u5904\u7406\u5b9e\u6218\u573a\u666f<\/p>\n<p>\u573a\u666f 1&#xff1a;\u78c1\u76d8\u574f\u4e86\u600e\u4e48\u529e&#xff1f; \u4f7f\u7528\u63d2\u4ef6\u5c06\u574f\u76d8\u4e0a\u7684\u526f\u672c\u6807\u8bb0\u4e3a\u6545\u969c&#xff0c;\u5e76\u89e6\u53d1\u91cd\u65b0\u540c\u6b65&#xff1a; kubectl mayastor fault replica &lt;uuid&gt;<\/p>\n<p>\u573a\u666f 2&#xff1a;\u526f\u672c\u540c\u6b65\u5361\u4f4f\u4e86&#xff1f; \u67e5\u770b\u5377\u7684\u8be6\u7ec6\u72b6\u6001&#xff0c;\u53ef\u4ee5\u770b\u5230 Rebuild \u8fdb\u5ea6\u767e\u5206\u6bd4&#xff0c;\u8fd9\u662f\u539f\u751f kubectl \u7edd\u5bf9\u770b\u4e0d\u5230\u7684\u4fe1\u606f\u3002<\/p>\n<h4>7.2.2 \u5b89\u88c5\u65b9\u6cd5<\/h4>\n<p># \u5b98\u65b9\u63a8\u8350\u901a\u8fc7\u4e8c\u8fdb\u5236\u4e0b\u8f7d<br \/>\ncurl -L https:\/\/github.com\/openebs\/mayastor-control-plane\/releases\/download\/v2.9.3\/kubectl-mayastor-x86_64-linux-musl.tar.gz<br \/>\ntar -xvf kubectl-mayastor-x86_64-linux-musl.tar.gz<br \/>\nmv kubectl-mayastor \/usr\/local\/bin\/<\/p>\n<p>kubectl-mayastor \u63d2\u4ef6\u662f\u8fde\u63a5\u201cK8s \u903b\u8f91\u5c42\u201d\u548c\u201c\u5b58\u50a8\u7269\u7406\u5c42\u201d\u7684\u6865\u6881\u3002<\/p>\n<h3>7.3\u00a0\u5feb\u7167&#xff08;Snapshot&#xff09;<\/h3>\n<h4>7.3.1. \u6838\u5fc3\u6982\u5ff5\u4e0e\u5148\u51b3\u6761\u4ef6<\/h4>\n<p>\u5728 Mayastor \u4e2d&#xff0c;\u5feb\u7167\u7684\u64cd\u4f5c\u9075\u5faa Kubernetes \u6807\u51c6\u7684 CSI Snapshotter \u5de5\u4f5c\u6d41\u3002<\/p>\n<ul>\n<li>\n<p>\u77ac\u65f6\u6027&#xff1a;\u5feb\u7167\u662f\u51e0\u4e4e\u77ac\u95f4\u5b8c\u6210\u7684&#xff0c;\u4e0d\u4f1a\u7531\u4e8e\u5377\u7684\u5927\u5c0f\u800c\u589e\u52a0\u521b\u5efa\u65f6\u95f4\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f9d\u8d56\u9879&#xff1a;\u4f60\u5fc5\u987b\u5148\u914d\u7f6e\u597d VolumeSnapshotClass\u3002<\/p>\n<\/li>\n<li>\n<p>\u7a7a\u95f4\u5360\u7528&#xff1a;\u521d\u6b21\u521b\u5efa\u51e0\u4e4e\u4e0d\u5360\u7a7a\u95f4&#xff0c;\u53ea\u6709\u5f53\u539f\u5377&#xff08;Source Volume&#xff09;\u53d1\u751f\u6570\u636e\u53d8\u5316\u65f6&#xff0c;\u5feb\u7167\u624d\u4f1a\u5f00\u59cb\u5360\u7528\u5b58\u50a8\u6c60\u7a7a\u95f4\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>7.3.2. \u5173\u952e\u8d44\u6e90\u5bf9\u8c61 (CRDs)<\/h4>\n<p>\u5feb\u7167\u6d89\u53ca\u4e09\u4e2a\u4e92\u76f8\u534f\u4f5c\u7684 K8s \u8d44\u6e90&#xff1a;<\/p>\n<li>\n<p>VolumeSnapshotClass&#xff1a;\u5feb\u7167\u7684\u201c\u6a21\u7248\u201d&#xff0c;\u5b9a\u4e49\u7531\u8c01&#xff08;Mayastor&#xff09;\u6765\u6267\u884c\u5feb\u7167\u3002<\/p>\n<\/li>\n<li>\n<p>VolumeSnapshot&#xff1a;\u7528\u6237\u7684\u8bf7\u6c42&#xff0c;\u7c7b\u4f3c\u4e8e PVC\u3002<\/p>\n<\/li>\n<li>\n<p>VolumeSnapshotContent&#xff1a;\u5b9e\u9645\u5b58\u50a8\u5728\u78c1\u76d8\u4e0a\u7684\u5feb\u7167\u6570\u636e&#xff0c;\u7c7b\u4f3c\u4e8e PV\u3002<\/p>\n<\/li>\n<h4>7.3.3. \u5b9e\u6218\u914d\u7f6e\u6b65\u9aa4<\/h4>\n<p>A. \u521b\u5efa VolumeSnapshotClass<\/p>\n<p>\u9996\u5148&#xff0c;\u4f60\u9700\u8981\u544a\u8bc9 K8s \u5982\u4f55\u5904\u7406 Mayastor \u7684\u5feb\u7167\u8bf7\u6c42&#xff1a;<\/p>\n<p>cat &lt;&lt;EOF | kubectl apply -f &#8211;<br \/>\napiVersion: snapshot.storage.k8s.io\/v1<br \/>\nkind: VolumeSnapshotClass<br \/>\nmetadata:<br \/>\n  name: mayastor-snapshot-class<br \/>\ndriver: openebs.io\/logging<br \/>\ndeletionPolicy: Delete<br \/>\nEOF<\/p>\n<p>B. \u4e3a\u4f60\u7684\u6d4b\u8bd5\u5377\u521b\u5efa\u5feb\u7167<\/p>\n<p>\u5047\u8bbe\u4f60\u4e4b\u524d\u521b\u5efa\u7684 PVC \u53eb mayastor-test-pvc&#xff1a;<\/p>\n<p>cat &lt;&lt;EOF | kubectl apply -f &#8211;<br \/>\napiVersion: snapshot.storage.k8s.io\/v1<br \/>\nkind: VolumeSnapshot<br \/>\nmetadata:<br \/>\n  name: test-pvc-snapshot<br \/>\nspec:<br \/>\n  volumeSnapshotClassName: mayastor-snapshot-class<br \/>\n  source:<br \/>\n    persistentVolumeClaimName: mayastor-test-pvc<br \/>\nEOF<\/p>\n<h4>7.3.4. \u6838\u5fc3\u529f\u80fd\u603b\u7ed3\u8868<\/h4>\n<table>\n<tr>\u64cd\u4f5c\u573a\u666f\u547d\u4ee4\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>\u521b\u5efa\u5feb\u7167<\/td>\n<td>\u6570\u636e\u66f4\u65b0\u524d\u5907\u4efd\u3001\u521b\u5efa\u68c0\u67e5\u70b9<\/td>\n<td>kubectl apply -f snapshot.yaml<\/td>\n<\/tr>\n<tr>\n<td>\u67e5\u770b\u72b6\u6001<\/td>\n<td>\u786e\u8ba4\u5feb\u7167\u662f\u5426\u51c6\u5907\u5c31\u7eea<\/td>\n<td>kubectl get volumesnapshot<\/td>\n<\/tr>\n<tr>\n<td>\u5feb\u7167\u56de\u6eda<\/td>\n<td>\u6570\u636e\u635f\u574f&#xff0c;\u9700\u8981\u6062\u590d<\/td>\n<td>\u4e0d\u652f\u6301\u539f\u5730\u8986\u76d6&#xff0c;\u9700\u901a\u8fc7\u5feb\u7167\u521b\u5efa\u65b0 PVC\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u514b\u9686\/\u6062\u590d<\/td>\n<td>\u4ece\u5feb\u7167\u521b\u5efa\u4e00\u4e2a\u4e00\u6a21\u4e00\u6837\u7684\u65b0\u5377<\/td>\n<td>\u5728\u65b0 PVC \u7684 dataSource \u4e2d\u6307\u5b9a\u5feb\u7167\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5220\u9664\u5feb\u7167<\/td>\n<td>\u4ece\u96c6\u7fa4\u4e2d\u5c06\u5feb\u7167\u79fb\u9664<\/td>\n<td>kubectl delete volumesnapshot mayastor-pvc-snap<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>7.4 Snapshot Restore\u5feb\u7167\u6062\u590d<\/h3>\n<p>\u5728 Kubernetes \u7684 CSI \u6807\u51c6&#xff08;\u5305\u62ec Mayastor&#xff09;\u4e2d&#xff0c;&#034;\u6062\u590d&#034;\u7684\u6982\u5ff5\u901a\u5e38\u6307\u7684\u662f &#034;\u4ece\u5feb\u7167\u521b\u5efa\u4e00\u4e2a\u65b0\u5377&#034;&#xff0c;\u800c\u4e0d\u662f\u76f4\u63a5\u56de\u6eda\u65e7\u5377\u3002<\/p>\n<h4>7.4.1. \u6838\u5fc3\u6982\u5ff5 (Core Concepts)<\/h4>\n<ul>\n<li>\n<p>\u6280\u672f\u5b9a\u4e49&#xff1a; \u5feb\u7167\u6062\u590d&#xff08;Snapshot Restore&#xff09;\u672c\u8d28\u4e0a\u662f\u4e00\u4e2a Provisioning&#xff08;\u8d44\u6e90\u8c03\u914d&#xff09; \u8fc7\u7a0b\u3002\u5b83\u521b\u5efa\u4e00\u4e2a \u5168\u65b0 \u7684 PersistentVolumeClaim (PVC)&#xff0c;\u5e76\u9884\u5148\u586b\u5145\u7279\u5b9a VolumeSnapshot \u4e2d\u7684\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p>\u901a\u4fd7\u89e3\u91ca&#xff1a; Mayastor \u4e0d\u652f\u6301\u201c\u65f6\u5149\u5012\u6d41\u201d&#xff08;\u5373\u76f4\u63a5\u628a\u539f\u6765\u7684\u76d8\u56de\u6eda\u5230\u4ee5\u524d\u7684\u72b6\u6001&#xff09;\u3002 \u5b83\u7684\u201c\u6062\u590d\u201d\u5c31\u50cf\u662f \u201c\u57fa\u4e8e\u6a21\u7248\u590d\u5370\u201d&#xff1a;\u4f60\u62ff\u7740\u4e00\u5f20\u5feb\u7167&#xff08;\u5e95\u7247&#xff09;&#xff0c;\u53bb\u7533\u8bf7\u4e00\u5757\u65b0\u7684\u786c\u76d8&#xff0c;\u8fd9\u5757\u65b0\u786c\u76d8\u91cc\u51fa\u5382\u5c31\u81ea\u5e26\u4e86\u548c\u5feb\u7167\u4e00\u6a21\u4e00\u6837\u7684\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p>\u5173\u952e\u673a\u5236&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u975e\u539f\u5730\u8986\u76d6 (No In-place Restore)&#xff1a;\u6062\u590d\u64cd\u4f5c\u4e0d\u4f1a\u5f71\u54cd\u539f\u59cb\u7684 PVC\u3002<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u6e90\u5f15\u7528 (DataSource Reference)&#xff1a;\u5728\u521b\u5efa\u65b0 PVC \u65f6&#xff0c;\u901a\u8fc7\u5b57\u6bb5\u6307\u5b9a\u6570\u636e\u6765\u6e90\u4e3a\u67d0\u4e2a\u5feb\u7167\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>7.4.2. \u6838\u5fc3\u64cd\u4f5c\u6b65\u9aa4 (Procedure)<\/h4>\n<p>\u6574\u4e2a\u8fc7\u7a0b\u53ea\u9700\u8981\u4e00\u6b65&#xff1a;\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PVC \u5bf9\u8c61&#xff0c;\u4f46\u5728\u914d\u7f6e\u4e2d\u591a\u52a0\u4e00\u4e2a dataSource \u53c2\u6570\u3002<\/p>\n<h5>\u5173\u952e\u77e5\u8bc6\u70b9&#xff1a;<\/h5>\n<li>\n<p>Namespace \u4e00\u81f4\u6027&#xff1a;\u6062\u590d\u51fa\u6765\u7684 PVC \u5fc5\u987b\u548c\u5feb\u7167&#xff08;VolumeSnapshot&#xff09;\u5728\u540c\u4e00\u4e2a\u547d\u540d\u7a7a\u95f4&#xff08;Namespace&#xff09;\u4e0b\u3002<\/p>\n<\/li>\n<li>\n<p>\u5bb9\u91cf\u9650\u5236&#xff1a;\u65b0\u7533\u8bf7\u7684 PVC \u5bb9\u91cf&#xff08;resources.requests.storage&#xff09;\u5fc5\u987b \u5927\u4e8e\u6216\u7b49\u4e8e \u5feb\u7167\u539f\u59cb\u5377\u7684\u5bb9\u91cf\u3002\u4f60\u4e0d\u80fd\u628a 10G \u7684\u6570\u636e\u6062\u590d\u5230 5G \u7684\u76d8\u91cc\u3002<\/p>\n<\/li>\n<li>\n<p>StorageClass&#xff1a;\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0e\u539f\u5377\u76f8\u540c\u7684 StorageClass&#xff0c;\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684&#xff08;\u53ea\u8981\u8be5 SC \u652f\u6301 Mayastor&#xff09;\u3002<\/p>\n<\/li>\n<h4>7.4.3. \u5b98\u65b9\u6807\u51c6\u6848\u4f8b (Official Example)<\/h4>\n<p>\u8fd9\u662f\u4ece\u5feb\u7167\u6062\u590d\u6570\u636e\u7684\u6807\u51c6 YAML \u914d\u7f6e\u3002<\/p>\n<p>\u5047\u8bbe\u4f60\u5df2\u7ecf\u6709\u4e00\u4e2a\u540d\u4e3a test-pvc-snapshot \u7684\u5feb\u7167&#xff08;\u7531\u4e0a\u4e00\u6b65\u751f\u6210&#xff09;&#xff0c;\u73b0\u5728\u6211\u4eec\u8981\u4ece\u4e2d\u6062\u590d\u51fa\u4e00\u4e2a\u53eb restored-pvc \u7684\u65b0\u5377\u3002<\/p>\n<p>apiVersion: v1<br \/>\nkind: PersistentVolumeClaim<br \/>\nmetadata:<br \/>\n  name: restored-pvc             # 1. \u65b0\u5377\u7684\u540d\u79f0<br \/>\n  namespace: default             # 2. \u5fc5\u987b\u4e0e\u5feb\u7167\u5728\u540c\u4e00\u547d\u540d\u7a7a\u95f4<br \/>\nspec:<br \/>\n  storageClassName: mayastor-3-repl  # 3. \u4f7f\u7528\u7684\u5b58\u50a8\u7c7b&#xff08;\u901a\u5e38\u4e0e\u539f\u5377\u4e00\u81f4&#xff09;<br \/>\n  dataSource:                    # 4. [\u6838\u5fc3] \u6307\u5b9a\u6570\u636e\u6765\u6e90<br \/>\n    name: test-pvc-snapshot      #    \u8fd9\u91cc\u5199\u5feb\u7167\u7684\u540d\u5b57<br \/>\n    kind: VolumeSnapshot         #    \u7c7b\u578b\u5fc5\u987b\u662f VolumeSnapshot<br \/>\n    apiGroup: snapshot.storage.k8s.io<br \/>\n  accessModes:<br \/>\n    &#8211; ReadWriteOnce<br \/>\n  resources:<br \/>\n    requests:<br \/>\n      storage: 1Gi               # 5. \u5bb9\u91cf\u5fc5\u987b &gt;&#061; \u539f\u5377\u5bb9\u91cf<\/p>\n<h4>7.4.4. \u9a8c\u8bc1\u6062\u590d\u7ed3\u679c (Verification)<\/h4>\n<p>\u5f53\u4f60\u5e94\u7528\u4e0a\u8ff0 YAML \u540e&#xff0c;Kubernetes \u4f1a\u6267\u884c\u4ee5\u4e0b\u6d41\u7a0b&#xff1a;<\/p>\n<li>\n<p>Provisioning: CSI \u9a71\u52a8\u8bfb\u53d6\u5feb\u7167\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p>Binding: \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PV \u5e76\u7ed1\u5b9a\u5230 restored-pvc\u3002<\/p>\n<\/li>\n<li>\n<p>Ready: \u5f53 PVC \u72b6\u6001\u53d8\u4e3a Bound \u65f6&#xff0c;\u8868\u793a\u6570\u636e\u5df2\u51c6\u5907\u597d\u3002<\/p>\n<\/li>\n<p>kubectl get pvc restored-pvc<\/p>\n<p>\u5982\u679c\u770b\u5230 &#096;STATUS: Bound&#096;&#xff0c;\u8bf4\u660e\u6062\u590d\u6210\u529f\u3002<\/p>\n<p>\u6b64\u65f6&#xff0c;\u4f60\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Pod \u6302\u8f7d\u8fd9\u4e2a &#096;restored-pvc&#096;&#xff0c;\u91cc\u9762\u7684\u6570\u636e\u5c31\u662f\u4f60\u5feb\u7167\u65f6\u523b\u7684\u6570\u636e\u3002<\/p>\n<h3>7.5\u00a0Encryption (\u6570\u636e\u52a0\u5bc6)<\/h3>\n<p>\u8fd9\u662f\u6839\u636e OpenEBS Mayastor 4.3.x \u5b98\u65b9\u6587\u6863\u5173\u4e8e Encryption (\u6570\u636e\u52a0\u5bc6) \u7684\u6df1\u5ea6\u7b14\u8bb0\u603b\u7ed3\u3002<\/p>\n<p>OpenEBS Mayastor \u7684\u52a0\u5bc6\u65b9\u6848\u4e3b\u8981\u9488\u5bf9 \u9759\u6001\u6570\u636e\u52a0\u5bc6 (Data-at-Rest Encryption)&#xff0c;\u4e5f\u5c31\u662f\u786e\u4fdd\u5b58\u50a8\u5728\u7269\u7406\u78c1\u76d8\u4e0a\u7684\u6570\u636e\u662f\u52a0\u5bc6\u7684&#xff0c;\u5373\u4fbf\u786c\u76d8\u88ab\u76d7\u4e5f\u65e0\u6cd5\u76f4\u63a5\u8bfb\u53d6\u6570\u636e\u3002<\/p>\n<hr \/>\n<h4>7.5.1. \u6838\u5fc3\u6982\u5ff5 (Core Concepts)<\/h4>\n<ul>\n<li>\n<p>\u6280\u672f\u5b9a\u4e49&#xff1a; Mayastor \u4f7f\u7528 AES-XTS \u7b97\u6cd5 \u5bf9 DiskPool (\u5b58\u50a8\u6c60) \u8fdb\u884c\u52a0\u5bc6\u3002<\/p>\n<\/li>\n<li>\n<p>\u901a\u4fd7\u89e3\u91ca&#xff1a; \u5b83\u4e0d\u662f\u5bf9\u6bcf\u4e2a\u6587\u4ef6\u5355\u72ec\u52a0\u5bc6&#xff0c;\u800c\u662f\u7ed9\u6574\u4e2a\u201c\u5b58\u50a8\u4ed3\u5e93\u201d&#xff08;DiskPool&#xff09;\u52a0\u4e86\u4e00\u628a\u9501\u3002 \u53ea\u8981\u4f60\u628a\u8fd9\u4e2a\u4ed3\u5e93&#xff08;DiskPool&#xff09;\u914d\u7f6e\u6210\u52a0\u5bc6\u6a21\u5f0f&#xff0c;\u90a3\u4e48\u6240\u6709\u5b58\u653e\u8fdb\u53bb\u7684\u201c\u8d27\u7269\u201d&#xff08;Volume Replicas \/ \u5377\u526f\u672c&#xff09;\u90fd\u4f1a\u81ea\u52a8\u88ab\u52a0\u5bc6\u3002<\/p>\n<\/li>\n<li>\n<p>\u5173\u952e\u673a\u5236&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6c60\u7ea7\u52a0\u5bc6 (Pool-Level Encryption)&#xff1a;\u52a0\u5bc6\u662f\u5728\u5b58\u50a8\u6c60\u5c42\u9762\u914d\u7f6e\u7684&#xff0c;\u800c\u4e0d\u662f\u5728\u6bcf\u4e2a PVC \u4e0a\u5355\u72ec\u914d\u5bc6\u94a5\u3002<\/p>\n<\/li>\n<li>\n<p>AES-XTS Cipher&#xff1a;\u4e00\u79cd\u4e13\u95e8\u7528\u4e8e\u78c1\u76d8\u52a0\u5bc6\u7684\u9ad8\u5f3a\u5ea6\u7b97\u6cd5&#xff0c;\u9700\u8981\u4e24\u4e2a 128 \u4f4d\u7684\u5bc6\u94a5\u3002<\/p>\n<\/li>\n<li>\n<p>StorageClass \u7ea6\u675f&#xff1a;\u4f60\u9700\u8981\u544a\u8bc9 StorageClass&#xff0c;\u201c\u6211\u8fd9\u4e2a\u5377\u5fc5\u987b\u653e\u5230\u52a0\u5bc6\u7684\u6c60\u5b50\u91cc\u53bb\u201d\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>7.5.2. \u6838\u5fc3\u64cd\u4f5c\u6d41\u7a0b (Procedure)<\/h4>\n<p>\u8981\u5b9e\u73b0\u52a0\u5bc6\u5b58\u50a8&#xff0c;\u9700\u8981\u4e09\u4e2a\u6b65\u9aa4&#xff1a;\u914d\u94a5\u5319 (Secret) -&gt; \u5efa\u4ed3\u5e93 (DiskPool) -&gt; \u5b58\u8d27\u7269 (StorageClass)\u3002<\/p>\n<h5>\u7b2c\u4e00\u6b65&#xff1a;\u521b\u5efa\u5bc6\u94a5 Secret (Create Encryption Secret)<\/h5>\n<p>\u4f60\u9700\u8981\u521b\u5efa\u4e00\u4e2a Kubernetes Secret \u6765\u5b58\u653e AES-XTS \u5bc6\u94a5\u3002<\/p>\n<ul>\n<li>\n<p>\u8981\u6c42&#xff1a;\u5305\u542b\u4e24\u4e2a 128 \u4f4d\u7684 Key&#xff08;\u5341\u516d\u8fdb\u5236\u7f16\u7801&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u6ce8\u610f&#xff1a;\u5b98\u65b9\u5efa\u8bae\u5c06\u6b64 Secret \u8bbe\u7f6e\u4e3a immutable: true (\u4e0d\u53ef\u53d8)&#xff0c;\u9632\u6b62\u8bef\u6539\u3002<\/p>\n<\/li>\n<\/ul>\n<h5>\u7b2c\u4e8c\u6b65&#xff1a;\u914d\u7f6e\u52a0\u5bc6 DiskPool (Configure Encrypted DiskPool)<\/h5>\n<p>\u5728\u521b\u5efa DiskPool \u65f6&#xff0c;\u5f15\u7528\u4e0a\u9762\u7684 Secret\u3002\u8fd9\u6837\u8fd9\u4e2a\u6c60\u5b50\u91cc\u7684\u6240\u6709\u6570\u636e\u90fd\u4f1a\u88ab\u52a0\u5bc6\u3002<\/p>\n<h5>\u7b2c\u4e09\u6b65&#xff1a;\u5b9a\u4e49\u52a0\u5bc6 StorageClass (Define Encrypted StorageClass)<\/h5>\n<p>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 StorageClass&#xff0c;\u5e76\u5f3a\u5236\u8981\u6c42\u4f7f\u7528\u52a0\u5bc6\u6c60\u3002<\/p>\n<h4>7.5.3. \u5b98\u65b9\u6807\u51c6\u6848\u4f8b (Official Examples)<\/h4>\n<p>1. \u521b\u5efa\u5bc6\u94a5 Secret<\/p>\n<p>apiVersion: v1<br \/>\nkind: Secret<br \/>\nmetadata:<br \/>\n  name: pool-encr-secret<br \/>\n  namespace: openebs  # \u5047\u8bbe\u4f60\u7684 Mayastor \u8fd0\u884c\u5728 openebs \u547d\u540d\u7a7a\u95f4<br \/>\ntype: Opaque<br \/>\nimmutable: true<br \/>\nstringData:<br \/>\n  encryption_parameters: |<br \/>\n    {<br \/>\n      &#034;cipher&#034;: &#034;AesXts&#034;,<br \/>\n      &#034;key&#034;: &#034;2b7e151628aed2a6abf7158809cf4f3c&#034;,<br \/>\n      &#034;key_len&#034;: 128,<br \/>\n      &#034;key2&#034;: &#034;2b7e151628aed2a6abf7158809cf4f3d&#034;,<br \/>\n      &#034;key2_len&#034;: 128<br \/>\n    }<\/p>\n<p>\u6ce8&#xff1a;\u4e0a\u9762\u7684 key \u4ec5\u4e3a\u5b98\u65b9\u793a\u4f8b&#xff0c;\u751f\u4ea7\u73af\u5883\u8bf7\u52a1\u5fc5\u751f\u6210\u968f\u673a\u7684\u9ad8\u5f3a\u5ea6\u5bc6\u94a5\u3002<\/p>\n<p>2. \u521b\u5efa\u5f15\u7528\u8be5\u5bc6\u94a5\u7684 DiskPoo<\/p>\n<p>apiVersion: &#034;openebs.io\/v1beta3&#034;<br \/>\nkind: DiskPool<br \/>\nmetadata:<br \/>\n  name: encrypted-pool-1<br \/>\n  namespace: openebs<br \/>\nspec:<br \/>\n  node: k8s-node-1<br \/>\n  disks: [&#034;\/dev\/disk\/by-id\/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1&#034;]<br \/>\n  encryptionConfig:          # [\u6838\u5fc3] \u5f15\u7528\u52a0\u5bc6\u914d\u7f6e<br \/>\n    source:<br \/>\n      secret:<br \/>\n        name: pool-encr-secret<\/p>\n<p>3.\u521b\u5efa\u5f3a\u5236\u52a0\u5bc6\u7684 StorageClass<\/p>\n<p>apiVersion: storage.k8s.io\/v1<br \/>\nkind: StorageClass<br \/>\nmetadata:<br \/>\n  name: mayastor-encrypted-sc<br \/>\nparameters:<br \/>\n  protocol: nvmf<br \/>\n  repl: &#034;2&#034;<br \/>\n  encrypted: &#034;true&#034;          # [\u6838\u5fc3] \u5fc5\u987b\u8bbe\u4e3a true<br \/>\nprovisioner: openebs.io\/logging<br \/>\nreclaimPolicy: Delete<\/p>\n<h4>7.5.4. \u6838\u5fc3\u7b14\u8bb0\u4e0e\u9650\u5236 (Key Takeaways &amp; Limitations)<\/h4>\n<li>\n<p>\u5bc6\u94a5\u8f6e\u6362 (Key Rotation)&#xff1a;\u4e0d\u652f\u6301\u3002\u76ee\u524d\u4e00\u65e6\u6c60\u521b\u5efa&#xff0c;\u5bc6\u94a5\u5c31\u4e0d\u80fd\u6362\u3002<\/p>\n<\/li>\n<li>\n<p>\u8fc1\u79fb (Migration)&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u6709\u4e00\u5806\u6ca1\u52a0\u5bc6\u7684\u6570\u636e&#xff0c;\u4e0d\u80fd\u81ea\u52a8\u8fc1\u79fb\u5230\u52a0\u5bc6\u6c60\u3002<\/p>\n<\/li>\n<li>\n<p>\u624b\u52a8\u8fc1\u79fb\u65b9\u6848&#xff1a;\u5fc5\u987b\u65b0\u5efa\u4e00\u4e2a\u52a0\u5bc6\u6c60&#xff0c;\u7136\u540e\u628a\u65e7\u5377\u7684\u526f\u672c\u6269\u5bb9&#xff08;Scale Up&#xff09;\u5230\u65b0\u6c60&#xff0c;\u518d\u628a\u65e7\u6c60\u7684\u526f\u672c\u7f29\u5bb9&#xff08;Scale Down&#xff09;\u5220\u6389\u3002\u8fc7\u7a0b\u6bd4\u8f83\u7e41\u7410\u4e14\u9700\u8981\u8c28\u614e\u64cd\u4f5c&#xff08;\u5efa\u8bae\u5148\u5907\u4efd\u5feb\u7167&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5b89\u5168\u6027&#xff1a;DiskPool \u7684\u52a0\u5bc6\u4f9d\u8d56\u4e8e\u90a3\u4e2a K8s Secret\u3002\u5982\u679c Secret \u6cc4\u9732&#xff0c;\u52a0\u5bc6\u4e5f\u5c31\u5f62\u540c\u865a\u8bbe\u3002\u5efa\u8bae\u7ed3\u5408 K8s \u81ea\u8eab\u7684 ETCD \u52a0\u5bc6\u529f\u80fd\u6765\u4fdd\u62a4\u8fd9\u4e2a Secret\u3002<\/p>\n<\/li>\n<h3>7.6 Velero\u6570\u636e\u8fc1\u79fb<\/h3>\n<p>\u4f7f\u7528 Velero \u8fdb\u884c\u6570\u636e\u8fc1\u79fb<\/p>\n<p>\u8fd9\u9879\u6280\u672f\u4e3b\u8981\u7528\u4e8e\u5c06\u65e7\u7684 OpenEBS \u5f15\u64ce&#xff08;\u5982 cStor, Jiva&#xff09;\u6216\u5176\u4ed6\u5b58\u50a8\u7684\u6570\u636e&#xff0c;\u8fc1\u79fb\u5230\u65b0\u7684 Replicated Storage (Mayastor) \u5f15\u64ce\u4e2d\u3002<\/p>\n<h4>7.6.1. \u6838\u5fc3\u6982\u5ff5 (Core Concepts)<\/h4>\n<ul>\n<li>\n<p>\u6280\u672f\u5b9a\u4e49&#xff1a; \u5229\u7528 Velero \u914d\u5408 Restic&#xff08;\u6216 Kopia&#xff09;\u7ec4\u4ef6&#xff0c;\u6267\u884c \u6587\u4ef6\u7cfb\u7edf\u7ea7\u522b (File System Level) \u7684\u5907\u4efd\u4e0e\u6062\u590d&#xff0c;\u4ece\u800c\u5b9e\u73b0\u8de8\u5b58\u50a8\u5f15\u64ce\u7684\u6570\u636e\u8fc1\u79fb\u3002<\/p>\n<\/li>\n<li>\n<p>\u901a\u4fd7\u89e3\u91ca&#xff1a; \u56e0\u4e3a\u65e7\u7684\u5b58\u50a8&#xff08;\u5982 cStor&#xff09;\u548c\u65b0\u7684\u5b58\u50a8&#xff08;Mayastor&#xff09;\u5e95\u5c42\u683c\u5f0f\u4e0d\u4e00\u6837&#xff0c;\u4e0d\u80fd\u76f4\u63a5\u628a\u786c\u76d8\u201c\u63d2\u201d\u8fc7\u53bb\u3002 \u8fd9\u4e2a\u65b9\u6cd5\u76f8\u5f53\u4e8e&#xff1a;\u5148\u628a\u65e7\u786c\u76d8\u91cc\u7684\u6587\u4ef6\u5168\u90e8\u6253\u5305\u4e0a\u4f20\u5230\u4e91\u7aef&#xff08;S3\/MinIO&#xff09;&#xff0c;\u7136\u540e\u5728\u65b0\u7684\u786c\u76d8\u91cc\u628a\u6587\u4ef6\u4e0b\u8f7d\u4e0b\u6765\u3002<\/p>\n<\/li>\n<li>\n<p>\u9002\u7528\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4ece\u65e7\u7248 OpenEBS \u8fc1\u79fb\u5230 Mayastor\u3002<\/p>\n<\/li>\n<li>\n<p>\u5206\u5e03\u5f0f\u6570\u636e\u5e93&#xff08;\u5982 Cassandra, MongoDB&#xff09;\u7684\u8fc1\u79fb\u3002<\/p>\n<\/li>\n<li>\n<p>\u8de8\u96c6\u7fa4\u8fc1\u79fb\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>7.6.2. \u6838\u5fc3\u7ec4\u4ef6\u4e0e\u673a\u5236 (Mechanisms)<\/h4>\n<li>\n<p>Velero&#xff1a;Kubernetes \u5907\u4efd\u548c\u6062\u590d\u7684\u6807\u51c6\u5de5\u5177&#xff0c;\u4f5c\u4e3a\u201c\u6307\u6325\u5b98\u201d\u3002<\/p>\n<\/li>\n<li>\n<p>Restic&#xff1a;Velero \u7684\u63d2\u4ef6&#xff0c;\u8d1f\u8d23\u5177\u4f53\u7684\u201c\u642c\u8fd0\u5de5\u4f5c\u201d&#xff0c;\u6df1\u5165\u5230 Pod \u5185\u90e8\u53bb\u590d\u5236\u6587\u4ef6\u3002<\/p>\n<\/li>\n<li>\n<p>Execution Hooks (\u6267\u884c\u94a9\u5b50)&#xff1a;\u8fd9\u662f\u5206\u5e03\u5f0f\u6570\u636e\u5e93\u5907\u4efd\u7684\u5173\u952e\u3002<\/p>\n<ul>\n<li>\n<p>\u4e3a\u4ec0\u4e48\u9700\u8981&#xff1f; \u6570\u636e\u5e93\u901a\u5e38\u4f1a\u5728\u5185\u5b58\u91cc\u7f13\u5b58\u6570\u636e&#xff0c;\u76f4\u63a5\u590d\u5236\u6587\u4ef6\u4f1a\u5bfc\u81f4\u6570\u636e\u635f\u574f&#xff08;\u4e0d\u4e00\u81f4&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u600e\u4e48\u505a&#xff1f; \u5728\u5907\u4efd\u524d\u201c\u51bb\u7ed3\u201d\u6570\u636e\u5e93&#xff08;Pre-hook&#xff09;&#xff0c;\u5907\u4efd\u5b8c\u540e\u201c\u89e3\u51bb\u201d\u6570\u636e\u5e93&#xff08;Post-hook&#xff09;&#xff0c;\u786e\u4fdd\u6570\u636e\u9759\u6b62\u4e14\u4e00\u81f4\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>StorageClass Mapping (\u5b58\u50a8\u7c7b\u6620\u5c04)&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6062\u590d\u65f6&#xff0c;\u4f60\u9700\u8981\u544a\u8bc9 Velero&#xff1a;\u201c\u539f\u672c\u662f\u7528 cstor-sc \u7684\u6570\u636e&#xff0c;\u8bf7\u6062\u590d\u5230 mayastor-3-repl \u53bb\u201d\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<h4>7.6.3. \u64cd\u4f5c\u6d41\u7a0b\u7b14\u8bb0 (Step-by-Step Procedure)<\/h4>\n<p>\u6574\u4e2a\u8fc7\u7a0b\u5206\u4e3a\u4e09\u4e2a\u9636\u6bb5&#xff1a;\u51c6\u5907 -&gt; \u5907\u4efd (Backup) -&gt; \u6062\u590d (Restore)\u3002<\/p>\n<p>\u7b2c\u4e00\u9636\u6bb5&#xff1a;\u51c6\u5907\u5de5\u4f5c<\/p>\n<ul>\n<li>\n<p>\u5b89\u88c5 Velero \u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef&#xff0c;\u5e76\u914d\u7f6e\u597d\u540e\u7aef\u5b58\u50a8&#xff08;\u5982 MinIO \u6216 AWS S3&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u91cd\u8981&#xff1a;\u5fc5\u987b\u542f\u7528 &#8211;use-restic (\u6216 &#8211;use-node-agent \u5728\u65b0\u7248\u4e2d)&#xff0c;\u56e0\u4e3a\u6211\u4eec\u9700\u8981\u5907\u4efd PV \u91cc\u7684\u6587\u4ef6&#xff0c;\u800c\u4e0d\u662f\u5feb\u7167\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u7b2c\u4e8c\u9636\u6bb5&#xff1a;\u5907\u4efd (Backup for Distributed DB)<\/p>\n<p>\u6838\u5fc3\u5728\u4e8e\u5904\u7406\u6570\u636e\u4e00\u81f4\u6027\u3002<\/p>\n<li>\n<p>Annotate Pods (\u6dfb\u52a0\u6ce8\u89e3)&#xff1a; \u4f60\u9700\u8981\u7ed9\u6570\u636e\u5e93\u7684 Pod \u6253\u4e0a\u6807\u7b7e&#xff0c;\u544a\u8bc9 Velero \u54ea\u4e2a\u5377\u9700\u8981\u5907\u4efd\u3002<\/p>\n<ul>\n<li>\n<p>\u683c\u5f0f&#xff1a;backup.velero.io\/backup-volumes: &lt;volume-mount-name&gt;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u914d\u7f6e Hooks (\u914d\u7f6e\u51bb\u7ed3\u94a9\u5b50)&#xff1a; \u5b9a\u4e49\u5907\u4efd\u524d\u548c\u5907\u4efd\u540e\u7684\u52a8\u4f5c\u3002\u901a\u5e38\u6d89\u53ca fsfreeze \u547d\u4ee4\u3002<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c\u5907\u4efd&#xff1a; \u8fd0\u884c Velero \u5907\u4efd\u547d\u4ee4\u3002<\/p>\n<\/li>\n<p>\u7b2c\u4e09\u9636\u6bb5&#xff1a;\u6062\u590d (Restore to New Storage)<\/p>\n<p>\u6838\u5fc3\u5728\u4e8e\u201c\u5077\u6881\u6362\u67f1\u201d&#xff0c;\u628a\u5e95\u5c42\u5b58\u50a8\u6362\u6210 Mayastor\u3002<\/p>\n<li>\n<p>\u914d\u7f6e\u6620\u5c04 (Configure Mapping)&#xff1a; \u521b\u5efa\u4e00\u4e2a ConfigMap&#xff0c;\u5b9a\u4e49 old-storage-class: new-storage-class\u3002<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c\u6062\u590d&#xff1a; \u8fd0\u884c Velero \u6062\u590d\u547d\u4ee4&#xff0c;Velero \u4f1a\u81ea\u52a8\u521b\u5efa\u65b0\u7684 PVC&#xff08;\u4f7f\u7528 Mayastor&#xff09;&#xff0c;\u5e76\u5c06\u6570\u636e\u4ece S3 \u62c9\u53d6\u8fdb\u53bb\u3002<\/p>\n<\/li>\n<h4>7.6.4. \u5b98\u65b9\u6807\u51c6\u6848\u4f8b (Official Example)<\/h4>\n<p>\u4ee5\u4e0b\u6848\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u8fc1\u79fb\u4e00\u4e2a Cassandra \u6570\u636e\u5e93&#xff08;StatefulSet&#xff09;\u3002<\/p>\n<p>\u6b65\u9aa4 A: \u5907\u4efd\u914d\u7f6e (Backup)<\/p>\n<p>1. \u7ed9 Pod \u6dfb\u52a0\u6ce8\u89e3 \u5047\u8bbe Cassandra \u7684\u6570\u636e\u5377\u6302\u8f7d\u540d\u4e3a cassandra-data\u3002<\/p>\n<p>kubectl -n cassandra annotate pod cassandra-0 backup.velero.io\/backup-volumes&#061;cassandra-data<\/p>\n<p>2. \u5b9a\u4e49 Hooks (\u5728\u5907\u4efd\u547d\u4ee4\u4e2d\u6216\u901a\u8fc7\u6ce8\u89e3)<\/p>\n<p>\u4e3a\u4e86\u4fdd\u8bc1\u6570\u636e\u4e00\u81f4\u6027&#xff0c;\u6211\u4eec\u9700\u8981\u5728\u5907\u4efd\u524d\u8c03\u7528 nodetool flush \u5c06\u5185\u5b58\u6570\u636e\u5237\u5165\u78c1\u76d8\u3002 (\u6ce8&#xff1a;\u5b98\u65b9\u6587\u6863\u901a\u5e38\u5efa\u8bae\u4f7f\u7528\u6ce8\u89e3\u65b9\u5f0f\u5b9a\u4e49 Hook&#xff0c;\u4ee5\u4e0b\u662f\u6807\u51c6\u903b\u8f91)<\/p>\n<p># \u8fd9\u662f\u4e00\u4e2a\u903b\u8f91\u793a\u610f&#xff0c;\u5b9e\u9645\u914d\u7f6e\u901a\u5e38\u5199\u5728 Pod \u6ce8\u89e3\u4e2d<br \/>\npre.hook.backup.velero.io\/command: &#039;[&#034;\/bin\/bash&#034;, &#034;-c&#034;, &#034;nodetool flush&#034;]&#039;<br \/>\npre.hook.backup.velero.io\/container: cassandra<\/p>\n<p>\u6267\u884c\u5907\u4efd\u547d\u4ee4<\/p>\n<p>velero backup create cassandra-backup \\\\<br \/>\n \u00a0&#8211;include-namespaces cassandra \\\\<br \/>\n \u00a0&#8211;default-volumes-to-restic&#061;true<\/p>\n<p>\u6b65\u9aa4 B: \u6062\u590d\u914d\u7f6e (Restore)<\/p>\n<p>1. \u521b\u5efa StorageClass \u6620\u5c04\u914d\u7f6e (ConfigMap) \u6211\u4eec\u8981\u628a\u539f\u672c\u7684\u5b58\u50a8&#xff08;\u5047\u8bbe\u662f openebs-cstor&#xff09;\u6620\u5c04\u5230\u65b0\u7684 mayastor-3-repl\u3002<\/p>\n<p>apiVersion: v1<br \/>\nkind: ConfigMap<br \/>\nmetadata:<br \/>\n  name: change-storage-class-config<br \/>\n  namespace: velero<br \/>\n  labels:<br \/>\n    velero.io\/plugin-config: &#034;&#034;<br \/>\n    velero.io\/change-storage-class: RestoreItemAction<br \/>\ndata:<br \/>\n  openebs-cstor: mayastor-3-repl  # [\u6838\u5fc3] \u5de6\u8fb9\u662f\u65e7SC&#xff0c;\u53f3\u8fb9\u662f\u65b0SC<\/p>\n<p>\u6267\u884c\u6062\u590d\u547d\u4ee4<\/p>\n<p>velero restore create &#8211;from-backup cassandra-backup \\\\<br \/>\n  &#8211;namespace-mappings cassandra:cassandra-new  # \u53ef\u9009&#xff1a;\u6062\u590d\u5230\u65b0\u547d\u540d\u7a7a\u95f4<\/p>\n<h4>7.6.5. \u6838\u5fc3\u7b14\u8bb0\u603b\u7ed3 (Key Takeaways)<\/h4>\n<li>\n<p>\u672c\u8d28&#xff1a;\u8fd9\u662f\u6587\u4ef6\u7ea7\u8fc1\u79fb&#xff0c;\u4e0d\u662f\u5757\u7ea7\u8fc1\u79fb\u3002<\/p>\n<\/li>\n<li>\n<p>\u5173\u952e\u70b9&#xff1a;\u5206\u5e03\u5f0f\u6570\u636e\u5e93\u5fc5\u987b\u914d\u7f6e Hooks (fsfreeze\/flush)&#xff0c;\u5426\u5219\u6062\u590d\u51fa\u6765\u7684\u6570\u636e\u53ef\u80fd\u574f\u6389\u3002<\/p>\n<\/li>\n<li>\n<p>\u6620\u5c04&#xff1a;\u6062\u590d\u65f6\u5fc5\u987b\u901a\u8fc7 ConfigMap \u505a StorageClass \u7684\u6620\u5c04&#xff0c;\u8fd9\u662f\u4ece\u65e7\u5f15\u64ce\u5207\u6362\u5230 Mayastor \u7684\u5173\u952e\u6b65\u9aa4\u3002<\/p>\n<\/li>\n<li>\n<p>\u9650\u5236&#xff1a;\u7531\u4e8e\u662f\u6587\u4ef6\u62f7\u8d1d&#xff0c;\u901f\u5ea6\u53d6\u51b3\u4e8e\u6570\u636e\u91cf\u5927\u5c0f\u548c\u7f51\u7edc\u5e26\u5bbd&#xff0c;\u6bd4\u5feb\u7167\u6062\u590d\u8981\u6162\u3002<\/p>\n<\/li>\n<h3>7.7\u00a0\u53ef\u89c2\u6d4b\u6027\u76d1\u63a7<\/h3>\n<h4>7.7.1. \u6838\u5fc3\u6982\u5ff5 (Core Concepts)<\/h4>\n<ul>\n<li>\n<p>\u6280\u672f\u5b9a\u4e49&#xff1a; Mayastor \u76d1\u63a7\u4f53\u7cfb\u662f\u57fa\u4e8e Prometheus \u67b6\u6784\u7684&#xff0c;\u901a\u8fc7 mayastor-obs-call-home \u548c mayastor-obs-exporter \u4e24\u4e2a\u6838\u5fc3\u7ec4\u4ef6&#xff0c;\u5c06\u5206\u5e03\u5f0f\u5b58\u50a8\u7684\u5185\u90e8\u72b6\u6001\u8f6c\u5316\u4e3a\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p>\u901a\u4fd7\u89e3\u91ca&#xff1a; \u5982\u679c\u8bf4\u201c\u53ef\u89c2\u6d4b\u6027\u201d\u662f\u8bbe\u8ba1\u56fe\u7eb8&#xff0c;\u90a3\u4e48\u201c\u76d1\u63a7\u201d\u5c31\u662f\u5177\u4f53\u7684\u5b89\u88c5\u8bf4\u660e\u4e66\u3002\u5b83\u624b\u628a\u624b\u6559\u4f60\u5982\u4f55\u628a Mayastor \u7684\u5404\u9879\u6027\u80fd\u6570\u636e\u63a5\u5165\u5230\u4f60\u7684 Prometheus \u76d1\u63a7\u5927\u5c4f\u5e55\u4e0a\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>7.7.2. \u6838\u5fc3\u76d1\u63a7\u7ec4\u4ef6 (Key Components)<\/h4>\n<li>\n<p>Exporters (\u5bfc\u51fa\u5668)&#xff1a;<\/p>\n<ul>\n<li>\n<p>io-engine-exporter&#xff1a;\u8fd0\u884c\u5728\u6bcf\u4e2a\u5b58\u50a8\u8282\u70b9\u4e0a&#xff0c;\u6293\u53d6\u6700\u5e95\u5c42\u7684\u78c1\u76d8 I\/O \u6027\u80fd\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p>agent-core-exporter&#xff1a;\u6293\u53d6\u63a7\u5236\u5e73\u9762\u7684\u903b\u8f91\u6570\u636e&#xff08;\u6bd4\u5982\u5377\u7684\u526f\u672c\u72b6\u6001&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>ServiceMonitors&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5b98\u65b9\u63d0\u4f9b\u7684 Kubernetes \u81ea\u5b9a\u4e49\u8d44\u6e90&#xff0c;\u7528\u6765\u544a\u8bc9 Prometheus&#xff1a;\u201c\u53bb\u8fd9\u91cc\u6293\u53d6 Mayastor \u7684\u6570\u636e\u201d\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<h4>7.7.3. \u6838\u5fc3\u6307\u6807\u7b14\u8bb0 (Official Metrics)<\/h4>\n<p>\u8fd9\u662f\u8fd0\u7ef4\u4e2d\u6700\u6709\u4ef7\u503c\u7684\u90e8\u5206&#xff0c;\u5efa\u8bae\u76f4\u63a5\u8bb0\u5f55\u8fd9\u4e9b\u5b98\u65b9\u672f\u8bed&#xff1a;<\/p>\n<table>\n<tr>\u76d1\u63a7\u7c7b\u522b\u5b98\u65b9\u6307\u6807\u540d (\u90e8\u5206)\u901a\u4fd7\u89e3\u91ca<\/tr>\n<tbody>\n<tr>\n<td>\u6c60\u5bb9\u91cf<\/td>\n<td>mayastor_pool_size_bytes<\/td>\n<td>\u6c60\u7684\u603b\u7a7a\u95f4\u5927\u5c0f&#xff08;\u5b57\u8282&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u6c60\u5360\u7528<\/td>\n<td>mayastor_pool_used_bytes<\/td>\n<td>\u5df2\u7ecf\u88ab\u5360\u7528\u7684\u7a7a\u95f4\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5377\u6027\u80fd<\/td>\n<td>mayastor_volume_read_iops<\/td>\n<td>\u5377\u7684\u6bcf\u79d2\u8bfb\u53d6\u6b21\u6570\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5377\u5e26\u5bbd<\/td>\n<td>mayastor_volume_write_throughput_bytes<\/td>\n<td>\u6bcf\u79d2\u5199\u5165\u7684\u6570\u636e\u91cf\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5ef6\u8fdf<\/td>\n<td>mayastor_volume_latency_us<\/td>\n<td>\u8bfb\u5199\u64cd\u4f5c\u7684\u5ef6\u8fdf&#xff08;\u5fae\u79d2&#xff0c;\u6570\u503c\u8d8a\u5c0f\u6027\u80fd\u8d8a\u597d&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5065\u5eb7\u5ea6<\/td>\n<td>mayastor_node_status<\/td>\n<td>\u5b58\u50a8\u8282\u70b9\u662f\u5426\u5728\u7ebf&#xff08;1 \u4e3a\u6b63\u5e38&#xff09;\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>7.7.4. \u5b98\u65b9\u6807\u51c6\u90e8\u7f72\u6848\u4f8b (Standard Procedures)<\/h4>\n<p>\u5b98\u65b9\u63a8\u8350\u4f7f\u7528 Helm \u6765\u4e00\u952e\u5f00\u542f\u76d1\u63a7\u529f\u80fd\u3002<\/p>\n<p>\u6848\u4f8b\u4e00&#xff1a;\u5b89\u88c5\u65f6\u5f00\u542f\u76d1\u63a7<\/p>\n<p>\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5b89\u88c5 Mayastor&#xff0c;\u53ef\u4ee5\u5728\u5b89\u88c5\u547d\u4ee4\u4e2d\u52a0\u5165\u76d1\u63a7\u53c2\u6570&#xff1a;<\/p>\n<p>helm install openebs openebs\/openebs \\\\<br \/>\n  &#8211;namespace openebs \\\\<br \/>\n  &#8211;set mayastor.obs.enabled&#061;true \\\\<br \/>\n  &#8211;set mayastor.obs.callhome.enabled&#061;true<\/p>\n<p>\u6848\u4f8b\u4e8c&#xff1a;\u624b\u52a8\u914d\u7f6e Prometheus \u6293\u53d6 (ServiceMonitor)<\/p>\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86 Prometheus Operator&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u5e94\u7528\u5b98\u65b9\u7684 ServiceMonitor&#xff1a;<\/p>\n<p>apiVersion: monitoring.coreos.com\/v1<br \/>\nkind: ServiceMonitor<br \/>\nmetadata:<br \/>\n  name: mayastor-io-engine<br \/>\n  namespace: openebs<br \/>\nspec:<br \/>\n  selector:<br \/>\n    matchLabels:<br \/>\n      app: io-engine      # \u5339\u914d Mayastor \u7684\u5b58\u50a8\u5f15\u64ce Pod<br \/>\n  endpoints:<br \/>\n  &#8211; port: metrics         # \u9ed8\u8ba4\u76d1\u542c 9502 \u7aef\u53e3<br \/>\n    interval: 15s<\/p>\n<h2 style=\"background-color:transparent\">\u516b\u3001\u603b\u7ed3<\/h2>\n<p>\u9488\u5bf9\u4e8e\u4e0a\u8ff0\u7684LocalVolumes\u7684HostPath\u548cLVM-Volumes\u4ee5\u53caReplicated Volumes\u5b58\u50a8\u7c7b\u578b&#xff0c;\u5176\u5b9e\u5728\u751f\u4ea7\u73af\u5883\u4f7f\u7528\u6700\u591a\u7684\u8fd8\u662fLocal Volumes\u7684LVM\u4e0eZFS\u5c45\u591a&#xff0c;\u8d8a\u6765\u8d8a\u591a\u7684\u67b6\u6784\u5e08\u503e\u5411\u4e8e\u5728\u5e94\u7528\u5c42&#xff08;\u5982\u6570\u636e\u5e93\u5206\u7247\u3001Elasticsearch \u526f\u672c&#xff09;\u89e3\u51b3\u6570\u636e\u53ef\u9760\u6027&#xff0c;\u800c\u975e\u5728\u5b58\u50a8\u5c42\u8fdb\u884c\u4e8c\u6b21\u540c\u6b65\u3002<\/p>\n<p>\u5728\u4e0a\u8ff0\u7684\u6240\u6709\u573a\u666f\u4e2d&#xff0c;\u5176\u5b9eLocal Volumes\u548cReplicated Volumes\u662f\u4e24\u79cd\u5b58\u50a8\u7c7b\u578b&#xff0c;\u662f\u53ef\u4ee5\u5206\u5f00\u90e8\u7f72\u7684\u3002<\/p>\n<p># \u53ea\u5b89\u88c5 OpenEBS Local Volumes&#xff08;HostPath&#xff09;<br \/>\nhelm install openebs openebs\/openebs \\\\<br \/>\n  &#8211;version 4.3.3 \\\\<br \/>\n  &#8211;namespace openebs \\\\<br \/>\n  &#8211;create-namespace \\\\<br \/>\n  &#8211;set engines.replicated.mayastor.enabled&#061;false<\/p>\n<p># \u53ea\u5b89\u88c5 Replicated Storage&#xff08;Mayastor&#xff09;<br \/>\nhelm install openebs openebs\/openebs \\\\<br \/>\n  &#8211;version 4.3.3 \\\\<br \/>\n  &#8211;namespace openebs \\\\<br \/>\n  &#8211;create-namespace \\\\<br \/>\n  &#8211;set engines.local.hostpath.enabled&#061;false \\\\<br \/>\n  &#8211;set engines.local.lvm.enabled&#061;false \\\\<br \/>\n  &#8211;set engines.local.zfs.enabled&#061;false \\\\<br \/>\n  &#8211;wait \\\\<br \/>\n  &#8211;timeout 15m<\/p>\n<p>\u5f53\u7136\u4e5f\u53ef\u4ee5\u4e24\u5957\u67b6\u6784\u540c\u65f6\u90e8\u7f72<\/p>\n<p># \u8fd9\u4e2a\u662f\u4e24\u79cd\u5b58\u50a8\u6a21\u5f0f\u90fd\u5b89\u88c5<br \/>\n[root&#064;k8s-master ~\/openEBS]# helm install openebs .\/openebs-4.3.3.tgz &#8211;namespace openebs &#8211;create-namespace  &#8211;timeout 10m &#8211;wait<\/p>\n<p>\u5728\u5bf9 OpenEBS \u7684\u6838\u5fc3\u7ec4\u4ef6\u6709\u4e86\u6df1\u5165\u4e86\u89e3\u540e&#xff0c;\u6211\u4eec\u4e0d\u96be\u53d1\u73b0&#xff0c;\u5e76\u6ca1\u6709\u6240\u8c13\u7684\u201c\u6700\u4f73\u201d\u5b58\u50a8&#xff0c;\u53ea\u6709\u201c\u6700\u9002\u5408\u4e1a\u52a1\u573a\u666f\u201d\u7684\u9009\u578b\u3002\u4e3a\u4e86\u65b9\u4fbf\u5927\u5bb6\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5feb\u901f\u51b3\u7b56&#xff0c;\u6211\u5c06 HostPath\u3001LVM-Volumes \u548c Replicated Volumes (\u4ee5 Mayastor \u4e3a\u4e3b) \u8fdb\u884c\u4e86\u5168\u65b9\u4f4d\u7684\u5bf9\u6bd4&#xff1a;<\/p>\n<table>\n<tr>\n<td>\u7ef4\u5ea6<\/td>\n<td>Local PV: HostPath<\/td>\n<td>Local PV: LVM<\/td>\n<td>Replicated (Mayastor)<\/td>\n<\/tr>\n<tbody>\n<tr>\n<td>\u5e95\u5c42\u539f\u7406<\/td>\n<td>\u7ed1\u5b9a\u5bbf\u4e3b\u673a\u7279\u5b9a\u76ee\u5f55<\/td>\n<td>\u57fa\u4e8e Linux LVM \u903b\u8f91\u5377<\/td>\n<td>\u8de8\u8282\u70b9\u540c\u6b65\u5197\u4f59 (NVMe-oF)<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5b89\u5168\u6027<\/td>\n<td>\u4f4e (\u968f\u8282\u70b9\u5b95\u673a\u4e0d\u53ef\u7528)<\/td>\n<td>\u4f4e (\u968f\u8282\u70b9\u5b95\u673a\u4e0d\u53ef\u7528)<\/td>\n<td>\u9ad8 (\u5141\u8bb8\u8282\u70b9\u7ea7\u6545\u969c)<\/td>\n<\/tr>\n<tr>\n<td>\u8bfb\u5199\u6027\u80fd<\/td>\n<td>\u6781\u9ad8 (\u539f\u751f\u78c1\u76d8\u6027\u80fd)<\/td>\n<td>\u6781\u9ad8 (\u63a5\u8fd1\u539f\u751f\u88f8\u76d8)<\/td>\n<td>\u4e2d\u7b49\/\u9ad8 (\u53d7\u7f51\u7edc IO \u5f71\u54cd)<\/td>\n<\/tr>\n<tr>\n<td>\u8fd0\u7ef4\u590d\u6742\u5ea6<\/td>\n<td>\u6781\u4f4e (\u96f6\u914d\u7f6e\u4e0a\u624b)<\/td>\n<td>\u4e2d\u7b49 (\u9700\u7ba1\u7406 VG \u5377\u7ec4)<\/td>\n<td>\u9ad8 (\u9700\u914d\u7f6e\u5b58\u50a8\u7f51\u7edc\/\u5927\u9875\u5185\u5b58)<\/td>\n<\/tr>\n<tr>\n<td>\u52a8\u6001\u6269\u5bb9<\/td>\n<td>\u4e0d\u652f\u6301<\/td>\n<td>\u652f\u6301 (\u5728\u7ebf\u6269\u5bb9)<\/td>\n<td>\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>\u5feb\u7167\/\u514b\u9686<\/td>\n<td>\u4e0d\u652f\u6301<\/td>\n<td>\u652f\u6301<\/td>\n<td>\u652f\u6301<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8bfb\u5199\u6548\u7387\u6df1\u5ea6\u89e3\u6790<\/p>\n<ul>\n<li>\n<p>HostPath &amp; LVM (\u672c\u5730\u738b\u8005)&#xff1a; \u7531\u4e8e\u6570\u636e\u8def\u5f84\u4e0d\u7ecf\u8fc7\u7f51\u7edc&#xff0c;\u4e5f\u4e0d\u5b58\u5728\u989d\u5916\u7684\u8f6f\u4ef6\u5c01\u88c5\u5c42&#xff0c;\u5b83\u4eec\u7684 I\/O \u8def\u5f84\u6700\u77ed\u3002\u5728\u968f\u673a\u8bfb\u5199\u6d4b\u8bd5\u4e2d&#xff0c;\u5ef6\u8fdf\u51e0\u4e4e\u7b49\u540c\u4e8e\u7269\u7406 SSD\u3002LVM \u76f8\u6bd4 HostPath \u7565\u6709\u4e00\u70b9\u70b9\u903b\u8f91\u5377\u7ba1\u7406\u7684\u5f00\u9500&#xff0c;\u4f46\u5728\u73b0\u4ee3 CPU \u4e0b\u51e0\u4e4e\u53ef\u4ee5\u5ffd\u7565\u4e0d\u8ba1\u3002<\/p>\n<\/li>\n<li>\n<p>Replicated Volumes (\u9ad8\u53ef\u7528\u4ee3\u4ef7)&#xff1a; \u867d\u7136 OpenEBS \u7684 Mayastor \u5f15\u64ce\u901a\u8fc7 SPDK \u548c NVMe-oF \u6781\u5927\u5730\u4f18\u5316\u4e86\u8def\u5f84&#xff0c;\u4f46\u5199\u64cd\u4f5c\u5fc5\u987b\u5728\u591a\u4e2a\u8282\u70b9&#xff08;\u901a\u5e38\u662f 3 \u526f\u672c&#xff09;\u90fd\u5b8c\u6210\u786e\u8ba4\u540e\u624d\u8fd4\u56de\u3002\u8fd9\u610f\u5473\u7740\u5176\u5199\u5165\u6548\u7387\u53d7\u9650\u4e8e\u4f60\u7684\u201c\u6700\u6162\u7f51\u7edc\u8282\u70b9\u201d\u3002\u901a\u5e38\u5176\u8bfb\u6027\u80fd\u5f88\u5f3a&#xff0c;\u4f46\u5199\u5ef6\u8fdf\u4f1a\u6bd4\u672c\u5730\u5377\u9ad8\u51fa 2-5 \u500d\u3002<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<p>\u6700\u4f73\u5b9e\u8df5\u573a\u666f\u5efa\u8bae<\/p>\n<p>&#x1f4a1; \u573a\u666f\u4e00&#xff1a;\u5206\u5e03\u5f0f\u6570\u636e\u5e93 (MySQL MHA, TiDB, Cassandra)<\/p>\n<ul>\n<li>\n<p>\u9996\u9009\u65b9\u6848&#xff1a;LVM-Volumes\u6216\u8005Zfs<\/p>\n<\/li>\n<li>\n<p>\u7406\u7531&#xff1a; \u8fd9\u4e9b\u5e94\u7528\u672c\u8eab\u5728\u5e94\u7528\u5c42\u5c31\u6709\u526f\u672c\u673a\u5236\u3002\u5b58\u50a8\u5c42\u518d\u505a\u526f\u672c\u4f1a\u5bfc\u81f4\u201c1\u51992\u53d8\u4e3a1\u51994\u201d&#xff0c;\u6781\u5927\u5730\u6d6a\u8d39\u5e26\u5bbd\u3002LVM \u63d0\u4f9b\u4e86\u672c\u5730\u9ad8\u6027\u80fd&#xff0c;\u540c\u65f6\u652f\u6301\u5feb\u7167\u5907\u4efd\u548c\u52a8\u6001\u6269\u5bb9&#xff0c;\u662f\u8fd9\u7c7b\u8d1f\u8f7d\u7684\u751f\u4ea7\u6807\u51c6\u914d\u7f6e\u3002<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4a1; \u573a\u666f\u4e8c&#xff1a;\u5f00\u53d1\u6d4b\u8bd5\u73af\u5883\u6216\u6781\u7b80\u96c6\u7fa4<\/p>\n<ul>\n<li>\n<p>\u9996\u9009\u65b9\u6848&#xff1a;HostPath<\/p>\n<\/li>\n<li>\n<p>\u7406\u7531&#xff1a; \u5feb\u901f\u90e8\u7f72&#xff0c;\u65e0\u9700\u63d0\u524d\u89c4\u5212\u78c1\u76d8\u9635\u5217\u6216 LVM \u5377\u7ec4\u3002\u5982\u679c\u4f60\u53ea\u662f\u60f3\u8dd1\u4e2a\u4e34\u65f6\u7684 CI\/CD \u6d41\u6c34\u7ebf&#xff0c;HostPath \u662f\u6700\u5feb\u4e14\u6700\u8f7b\u91cf\u7684\u9009\u62e9\u3002<\/p>\n<\/li>\n<\/ul>\n<p>&#x1f4a1; \u573a\u666f\u4e09&#xff1a;\u4f20\u7edf\u5355\u673a\u5e94\u7528 (\u5355\u5b9e\u4f8b PostgreSQL, \u5185\u90e8 Wiki)<\/p>\n<ul>\n<li>\n<p>\u9996\u9009\u65b9\u6848&#xff1a;Replicated Volumes (Mayastor)<\/p>\n<\/li>\n<li>\n<p>\u7406\u7531&#xff1a; \u5f53\u4f60\u7684\u5e94\u7528\u81ea\u8eab\u65e0\u6cd5\u5904\u7406\u6570\u636e\u5197\u4f59&#xff0c;\u4e14\u4f60\u4e0d\u80fd\u63a5\u53d7\u7531\u4e8e\u4e00\u4e2a\u8282\u70b9\u6545\u969c\u5bfc\u81f4\u670d\u52a1\u5f7b\u5e95\u4e2d\u65ad\u65f6&#xff0c;\u5fc5\u987b\u5728\u5b58\u50a8\u5c42\u5b9e\u73b0\u9ad8\u53ef\u7528\u3002\u867d\u7136\u727a\u7272\u4e86\u90e8\u5206\u6027\u80fd&#xff0c;\u4f46\u6362\u6765\u4e86 Pod \u53ef\u4ee5\u5728\u8282\u70b9\u95f4\u81ea\u7531\u6f02\u79fb\u7684\u80fd\u529b\u3002<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<p>\u5728\u6700\u540e\u6211\u4eec\u4e5f\u9700\u8981\u63d0\u4e00\u4e0bZFS-LocalPV\u8fd9\u4e00\u79cd\u5b58\u50a8\u65b9\u5f0f&#xff0c;\u6211\u4eec\u76f4\u63a5\u7528\u5b83\u548cLVM-LocalPV\u505a\u5bf9\u6bd4\u3002<\/p>\n<table>\n<tr>\n<td>\u7ef4\u5ea6<\/td>\n<td>LVM-LocalPV<\/td>\n<td>ZFS-LocalPV<\/td>\n<\/tr>\n<tbody>\n<tr>\n<td>I\/O \u8def\u5f84<\/td>\n<td>\u77ed\u4e14\u76f4\u63a5\u3002\u6570\u636e\u76f4\u63a5\u901a\u8fc7\u5185\u6838\u9a71\u52a8\u5199\u5165\u7269\u7406\u5757\u3002<\/td>\n<td>\u957f\u4e14\u590d\u6742\u3002\u6570\u636e\u9700\u7ecf\u8fc7\u5199\u65f6\u590d\u5236 (CoW)\u3001\u6821\u9a8c\u8ba1\u7b97\u7b49\u903b\u8f91\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5199\u5165\u6027\u80fd<\/td>\n<td>\u6781\u4f73\u3002\u7531\u4e8e\u662f\u8986\u76d6\u5199&#xff0c;\u5ef6\u8fdf\u4f4e\u4e14\u7a33\u5b9a\u3002<\/td>\n<td>\u6ce2\u52a8\/\u6162\u3002\u5199\u65f6\u590d\u5236 (CoW) \u5bfc\u81f4\u788e\u7247\u5316&#xff0c;\u5199\u64cd\u4f5c\u4f1a\u6709\u653e\u5927\u6548\u5e94\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u8bfb\u53d6\u6027\u80fd<\/td>\n<td>\u7a33\u5b9a\u3002\u4f9d\u8d56 Linux \u5185\u6838\u7684 Page Cache\u3002<\/td>\n<td>\u6781\u5feb (\u547d\u4e2d\u7f13\u5b58\u65f6)\u3002\u4f9d\u9760\u5f3a\u5927\u7684 ARC (\u81ea\u9002\u5e94\u7f13\u5b58)&#xff0c;\u5e38\u7528\u6570\u636e\u51e0\u4e4e\u5168\u5728\u5185\u5b58\u4e2d\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u5185\u5b58\u5f00\u9500<\/td>\n<td>\u6781\u4f4e\u3002\u51e0\u4e4e\u4e0d\u6d88\u8017\u989d\u5916\u5185\u5b58\u3002<\/td>\n<td>\u6781\u9ad8\u3002\u9ed8\u8ba4\u4f1a\u5403\u6389\u8282\u70b9 50% \u7684\u7269\u7406\u5185\u5b58\u4f5c\u4e3a\u7f13\u5b58&#xff08;\u5efa\u8bae 1TB \u5b58\u50a8\u914d 1GB RAM&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>CPU \u6d88\u8017<\/td>\n<td>\u6781\u4f4e\u3002<\/td>\n<td>\u8f83\u9ad8 (\u5c24\u5176\u5f00\u542f\u538b\u7f29\u3001\u6821\u9a8c\u6216\u52a0\u5bc6\u65f6)\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e3a\u4ec0\u4e48 ZFS \u6709\u65f6\u6bd4 LVM \u5feb&#xff0c;\u6709\u65f6\u5374\u6162&#xff1f;<\/p>\n<p>ZFS \u7684\u201c\u4f5c\u5f0a\u201d\u795e\u5668&#xff1a;ARC \u7f13\u5b58<\/p>\n<p>ZFS \u5728\u8bfb\u6027\u80fd\u4e0a\u5f80\u5f80\u80fd\u201c\u79d2\u6740\u201d LVM&#xff0c;\u56e0\u4e3a\u5b83\u62e5\u6709\u4e00\u5957\u6781\u5176\u806a\u660e\u7684 ARC (Adaptive Replacement Cache)\u3002<\/p>\n<ul>\n<li>\n<p>\u4f18\u52bf&#xff1a; \u5982\u679c\u4f60\u7684\u6570\u636e\u5e93\u6709\u5927\u91cf\u91cd\u590d\u8bfb\u64cd\u4f5c&#xff0c;ZFS \u4f1a\u76f4\u63a5\u4ece\u5185\u5b58\u4e2d\u8fd4\u56de\u7ed3\u679c&#xff0c;\u901f\u5ea6\u6bd4 SSD \u8fd8\u5feb\u3002<\/p>\n<\/li>\n<li>\n<p>\u4ee3\u4ef7&#xff1a; \u8fd9\u79cd\u6027\u80fd\u662f\u62ff\u5185\u5b58\u6362\u6765\u7684\u3002\u5982\u679c\u5185\u5b58\u4e0d\u8db3&#xff0c;ZFS \u7684\u6027\u80fd\u4f1a\u65ad\u5d16\u5f0f\u4e0b\u8dcc\u3002<\/p>\n<\/li>\n<\/ul>\n<p>ZFS \u7684\u963f\u5580\u7409\u65af\u4e4b\u8e35&#xff1a;\u5199\u65f6\u590d\u5236 (CoW)<\/p>\n<ul>\n<li>\n<p>LVM&#xff1a; \u50cf\u5728\u7eb8\u4e0a\u7528\u94c5\u7b14\u5199\u5b57&#xff0c;\u54ea\u91cc\u4e0d\u8981\u6539\u54ea\u91cc&#xff0c;\u539f\u5730\u8986\u76d6\u3002<\/p>\n<\/li>\n<li>\n<p>ZFS&#xff1a; \u50cf\u5728\u7eb8\u4e0a\u7528\u94a2\u7b14\u5199\u5b57&#xff0c;\u6539\u9519\u4e00\u4e2a\u5b57\u5c31\u8981\u5728\u65b0\u9875\u9762\u4e0a\u91cd\u65b0\u5199\u6574\u6bb5\u8bdd\u3002\u8fd9\u79cd CoW (Copy-on-Write) \u673a\u5236\u5728\u5904\u7406\u9ad8\u9891\u7387\u7684\u968f\u673a\u5c0f\u6587\u4ef6\u5199\u5165&#xff08;\u5982\u5927\u8d1f\u8f7d\u6570\u636e\u5e93&#xff09;\u65f6&#xff0c;\u4f1a\u5bfc\u81f4\u4e25\u91cd\u7684\u78c1\u76d8\u788e\u7247\u548c\u8f83\u9ad8\u7684\u5199\u5165\u5ef6\u8fdf\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u7279\u8272\u529f\u80fd\u7684\u6027\u80fd\u52a0\u6210<\/p>\n<ul>\n<li>\n<p>\u900f\u660e\u538b\u7f29 (LZ4\/ZSTD)&#xff1a; ZFS \u652f\u6301\u5728\u7ebf\u538b\u7f29\u3002\u5728 CPU \u8d44\u6e90\u5145\u8db3\u7684\u60c5\u51b5\u4e0b&#xff0c;\u5f00\u542f LZ4 \u538b\u7f29\u53cd\u800c\u80fd\u63d0\u5347\u6027\u80fd&#xff0c;\u56e0\u4e3a\u5199\u5165\u78c1\u76d8\u7684\u6570\u636e\u53d8\u5c11\u4e86&#xff0c;\u5bf9\u4e8e I\/O \u5bc6\u96c6\u578b\u4efb\u52a1\u662f\u4e2a\u5de8\u5927\u7684\u4f18\u5316\u3002LVM \u672c\u8eab\u4e0d\u652f\u6301\u6b64\u529f\u80fd&#xff0c;\u9700\u4f9d\u8d56\u6587\u4ef6\u7cfb\u7edf\u5c42\u3002<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u6821\u9a8c (Checksum)&#xff1a; ZFS \u6bcf\u6b21\u8bfb\u5199\u90fd\u4f1a\u8ba1\u7b97\u6821\u9a8c\u548c\u4ee5\u9632\u6b62\u201c\u9759\u9ed8\u6570\u636e\u635f\u574f\u201d\u3002\u8fd9\u589e\u52a0\u4e86 CPU \u8d1f\u62c5&#xff0c;\u4f46\u5728\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u8fd9\u79cd\u6027\u80fd\u635f\u8017\u6362\u53d6\u4e86\u6781\u9ad8\u7684\u6570\u636e\u5b89\u5168\u6027\u3002<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u9009 LVM-LocalPV \u7684\u60c5\u51b5&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4f60\u7684\u8d44\u6e90\u53d7\u9650&#xff08;\u5185\u5b58\u5c0f\u4e8e 16GB&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f60\u7684\u5e94\u7528\u672c\u8eab\u662f\u5199\u5bc6\u96c6\u578b\u7684&#xff08;\u5982\u9ad8\u9891\u65e5\u5fd7\u6536\u96c6\u3001\u91cd\u578b\u968f\u673a\u5199\u6570\u636e\u5e93&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f60\u9700\u8981\u8ffd\u6c42\u6781\u81f4\u7684\u4f4e\u5ef6\u8fdf\u548c\u4f4e CPU \u5f00\u9500\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u9009 ZFS-LocalPV \u7684\u60c5\u51b5&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4f60\u7684\u670d\u52a1\u5668\u5185\u5b58\u975e\u5e38\u5145\u88d5\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f60\u7684\u6570\u636e\u975e\u5e38\u91cd\u8981&#xff0c;\u4e0d\u80fd\u5fcd\u53d7\u4efb\u4f55\u9759\u9ed8\u635f\u574f\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f60\u9700\u8981\u6781\u81f4\u7684\u5feb\u7167\u6027\u80fd&#xff08;ZFS \u7684\u5feb\u7167\u51e0\u4e4e\u4e0d\u5f71\u54cd\u6027\u80fd&#xff0c;\u800c LVM \u7684 Thick Snapshot \u4f1a\u62d6\u6162\u7cfb\u7edf&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f60\u7684\u6570\u636e\u5177\u6709\u9ad8\u538b\u7f29\u7387&#xff0c;\u60f3\u901a\u8fc7 LZ4 \u538b\u7f29\u6765\u8282\u7701\u7a7a\u95f4\u5e76\u63d0\u5347\u541e\u5410\u91cf\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u535a\u4e3b\u603b\u7ed3&#xff1a; \u5982\u679c\u4f60\u8ffd\u6c42\u6781\u81f4\u6027\u80fd\u4e14\u5e94\u7528\u81ea\u5e26\u9ad8\u53ef\u7528&#xff0c;\u8bf7\u95ed\u773c\u9009 LVM-Volumes&#xff1b;\u5982\u679c\u4f60\u8ffd\u6c42\u7edd\u5bf9\u7684\u6570\u636e\u9ad8\u53ef\u7528\u4e14\u4e0d\u5dee\u94b1&#xff08;\u7f51\u7edc\u548c\u786c\u4ef6&#xff09;&#xff0c;\u8bf7\u5c1d\u8bd5 Mayastor&#xff1b;\u5982\u679c\u4f60\u53ea\u662f\u60f3\u5feb\u901f\u4e0a\u624b\u73a9\u4e00\u73a9&#xff0c;HostPath \u6c38\u8fdc\u662f\u4f60\u6700\u597d\u7684\u670b\u53cb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001OpenEBS\u6982\u8ff01.1 OpenEBS\u7684\u6838\u5fc3\u6982\u5ff5OpenEBS \u662f\u4e00\u4e2a\u5b8c\u5168 Kubernetes \u539f\u751f&#xff08;Cloud Native Storage&#xff09; \u7684\u5f00\u6e90\u5b58\u50a8\u89e3\u51b3\u65b9\u6848&#xff0c;\u5b83\u80fd\u5c06 Kubernetes \u8282\u70b9\u4e0a\u7684\u53ef\u7528\u5b58\u50a8\u8d44\u6e90\u8f6c\u5316\u6210 Persistent Volumes&#xff08;\u6301\u4e45\u5377&#xff09; \u4f9b\u5bb9\u5668\u5316\u5e94\u7528\u4f7f\u7528\u3002\u5b83\u901a\u8fc7 Container Attached Storage (CAS) \u67b6\u6784\u76f4\u63a5\u628a\u5b58\u50a8\u5f15\u64ce\u4ee5\u5bb9\u5668\u65b9\u5f0f\u90e8\u7f72\u5728 K<\/p>\n","protected":false},"author":2,"featured_media":73773,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[120,763,48],"topic":[],"class_list":["post-73775","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-kubernetes","tag-763","tag-48"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>OpenEBS \u2014 \u4e91\u539f\u751f CNS \u9ad8\u6027\u80fd\u5b58\u50a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/73775.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OpenEBS \u2014 \u4e91\u539f\u751f CNS \u9ad8\u6027\u80fd\u5b58\u50a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001OpenEBS\u6982\u8ff01.1 OpenEBS\u7684\u6838\u5fc3\u6982\u5ff5OpenEBS \u662f\u4e00\u4e2a\u5b8c\u5168 Kubernetes \u539f\u751f&#xff08;Cloud Native Storage&#xff09; \u7684\u5f00\u6e90\u5b58\u50a8\u89e3\u51b3\u65b9\u6848&#xff0c;\u5b83\u80fd\u5c06 Kubernetes \u8282\u70b9\u4e0a\u7684\u53ef\u7528\u5b58\u50a8\u8d44\u6e90\u8f6c\u5316\u6210 Persistent Volumes&#xff08;\u6301\u4e45\u5377&#xff09; \u4f9b\u5bb9\u5668\u5316\u5e94\u7528\u4f7f\u7528\u3002\u5b83\u901a\u8fc7 Container Attached Storage (CAS) \u67b6\u6784\u76f4\u63a5\u628a\u5b58\u50a8\u5f15\u64ce\u4ee5\u5bb9\u5668\u65b9\u5f0f\u90e8\u7f72\u5728 K\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/73775.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-08T03:44:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208034401-6988068193c0d.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"35 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/73775.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/73775.html\",\"name\":\"OpenEBS \u2014 \u4e91\u539f\u751f CNS \u9ad8\u6027\u80fd\u5b58\u50a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-08T03:44:04+00:00\",\"dateModified\":\"2026-02-08T03:44:04+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/73775.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/73775.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/73775.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"OpenEBS \u2014 \u4e91\u539f\u751f CNS \u9ad8\u6027\u80fd\u5b58\u50a8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OpenEBS \u2014 \u4e91\u539f\u751f CNS \u9ad8\u6027\u80fd\u5b58\u50a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/73775.html","og_locale":"zh_CN","og_type":"article","og_title":"OpenEBS \u2014 \u4e91\u539f\u751f CNS \u9ad8\u6027\u80fd\u5b58\u50a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001OpenEBS\u6982\u8ff01.1 OpenEBS\u7684\u6838\u5fc3\u6982\u5ff5OpenEBS \u662f\u4e00\u4e2a\u5b8c\u5168 Kubernetes \u539f\u751f&#xff08;Cloud Native Storage&#xff09; \u7684\u5f00\u6e90\u5b58\u50a8\u89e3\u51b3\u65b9\u6848&#xff0c;\u5b83\u80fd\u5c06 Kubernetes \u8282\u70b9\u4e0a\u7684\u53ef\u7528\u5b58\u50a8\u8d44\u6e90\u8f6c\u5316\u6210 Persistent Volumes&#xff08;\u6301\u4e45\u5377&#xff09; \u4f9b\u5bb9\u5668\u5316\u5e94\u7528\u4f7f\u7528\u3002\u5b83\u901a\u8fc7 Container Attached Storage (CAS) \u67b6\u6784\u76f4\u63a5\u628a\u5b58\u50a8\u5f15\u64ce\u4ee5\u5bb9\u5668\u65b9\u5f0f\u90e8\u7f72\u5728 K","og_url":"https:\/\/www.wsisp.com\/helps\/73775.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-08T03:44:04+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260208034401-6988068193c0d.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"35 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/73775.html","url":"https:\/\/www.wsisp.com\/helps\/73775.html","name":"OpenEBS \u2014 \u4e91\u539f\u751f CNS \u9ad8\u6027\u80fd\u5b58\u50a8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-08T03:44:04+00:00","dateModified":"2026-02-08T03:44:04+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/73775.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/73775.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/73775.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"OpenEBS \u2014 \u4e91\u539f\u751f CNS \u9ad8\u6027\u80fd\u5b58\u50a8"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/73775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=73775"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/73775\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/73773"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=73775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=73775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=73775"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=73775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}