commit
de4903de04
|
@ -48,7 +48,6 @@ T --> X[样式<br>与标题]
|
|||
X --> V[提示]
|
||||
|
||||
|
||||
|
||||
classDef box fill:#fff,stroke:#000,stroke-width:1px,color:#000;
|
||||
classDef spacewhite fill:#ffffff,stroke:#fff,stroke-width:0px,color:#000
|
||||
class A,C,D,N,X,m,T,V box
|
||||
|
@ -57,11 +56,17 @@ X --> V[提示]
|
|||
%% you can hyperlink Mermaid diagram nodes to a URL using click statements
|
||||
|
||||
click A "https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgc3ViZ3JhcGggbVtNZXJtYWlkLmpzXVxuICAgIGRpcmVjdGlvbiBUQlxuICAgICAgICBTWyBdLS4tXG4gICAgICAgIENbYnVpbGQ8YnI-ZGlhZ3JhbXM8YnI-d2l0aCBtYXJrZG93bl0gLS0-XG4gICAgICAgIERbb24tbGluZTxicj5saXZlIGVkaXRvcl1cbiAgICBlbmRcbiAgICBBW1doeSBhcmUgZGlhZ3JhbXM8YnI-dXNlZnVsP10gLS0-IG1cbiAgICBtIC0tPiBOWzMgeCBtZXRob2RzPGJyPmZvciBjcmVhdGluZzxicj5kaWFncmFtc11cbiAgICBOIC0tPiBUW0V4YW1wbGVzXVxuICAgIFQgLS0-IFhbU3R5bGluZzxicj5hbmQ8YnI-Y2FwdGlvbnNdXG4gICAgWCAtLT4gVltUaXBzXVxuICAgIFxuIFxuICAgIGNsYXNzRGVmIGJveCBmaWxsOiNmZmYsc3Ryb2tlOiMwMDAsc3Ryb2tlLXdpZHRoOjFweCxjb2xvcjojMDAwO1xuICAgIGNsYXNzRGVmIHNwYWNld2hpdGUgZmlsbDojZmZmZmZmLHN0cm9rZTojZmZmLHN0cm9rZS13aWR0aDowcHgsY29sb3I6IzAwMFxuICAgIGNsYXNzIEEsQyxELE4sWCxtLFQsViBib3hcbiAgICBjbGFzcyBTIHNwYWNld2hpdGUiLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOnRydWV9" _blank
|
||||
|
||||
click C "https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgc3ViZ3JhcGggbVtNZXJtYWlkLmpzXVxuICAgIGRpcmVjdGlvbiBUQlxuICAgICAgICBTWyBdLS4tXG4gICAgICAgIENbYnVpbGQ8YnI-ZGlhZ3JhbXM8YnI-d2l0aCBtYXJrZG93bl0gLS0-XG4gICAgICAgIERbb24tbGluZTxicj5saXZlIGVkaXRvcl1cbiAgICBlbmRcbiAgICBBW1doeSBhcmUgZGlhZ3JhbXM8YnI-dXNlZnVsP10gLS0-IG1cbiAgICBtIC0tPiBOWzMgeCBtZXRob2RzPGJyPmZvciBjcmVhdGluZzxicj5kaWFncmFtc11cbiAgICBOIC0tPiBUW0V4YW1wbGVzXVxuICAgIFQgLS0-IFhbU3R5bGluZzxicj5hbmQ8YnI-Y2FwdGlvbnNdXG4gICAgWCAtLT4gVltUaXBzXVxuICAgIFxuIFxuICAgIGNsYXNzRGVmIGJveCBmaWxsOiNmZmYsc3Ryb2tlOiMwMDAsc3Ryb2tlLXdpZHRoOjFweCxjb2xvcjojMDAwO1xuICAgIGNsYXNzRGVmIHNwYWNld2hpdGUgZmlsbDojZmZmZmZmLHN0cm9rZTojZmZmLHN0cm9rZS13aWR0aDowcHgsY29sb3I6IzAwMFxuICAgIGNsYXNzIEEsQyxELE4sWCxtLFQsViBib3hcbiAgICBjbGFzcyBTIHNwYWNld2hpdGUiLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOnRydWV9" _blank
|
||||
|
||||
click D "https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgc3ViZ3JhcGggbVtNZXJtYWlkLmpzXVxuICAgIGRpcmVjdGlvbiBUQlxuICAgICAgICBTWyBdLS4tXG4gICAgICAgIENbYnVpbGQ8YnI-ZGlhZ3JhbXM8YnI-d2l0aCBtYXJrZG93bl0gLS0-XG4gICAgICAgIERbb24tbGluZTxicj5saXZlIGVkaXRvcl1cbiAgICBlbmRcbiAgICBBW1doeSBhcmUgZGlhZ3JhbXM8YnI-dXNlZnVsP10gLS0-IG1cbiAgICBtIC0tPiBOWzMgeCBtZXRob2RzPGJyPmZvciBjcmVhdGluZzxicj5kaWFncmFtc11cbiAgICBOIC0tPiBUW0V4YW1wbGVzXVxuICAgIFQgLS0-IFhbU3R5bGluZzxicj5hbmQ8YnI-Y2FwdGlvbnNdXG4gICAgWCAtLT4gVltUaXBzXVxuICAgIFxuIFxuICAgIGNsYXNzRGVmIGJveCBmaWxsOiNmZmYsc3Ryb2tlOiMwMDAsc3Ryb2tlLXdpZHRoOjFweCxjb2xvcjojMDAwO1xuICAgIGNsYXNzRGVmIHNwYWNld2hpdGUgZmlsbDojZmZmZmZmLHN0cm9rZTojZmZmLHN0cm9rZS13aWR0aDowcHgsY29sb3I6IzAwMFxuICAgIGNsYXNzIEEsQyxELE4sWCxtLFQsViBib3hcbiAgICBjbGFzcyBTIHNwYWNld2hpdGUiLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOnRydWV9" _blank
|
||||
|
||||
click N "https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgc3ViZ3JhcGggbVtNZXJtYWlkLmpzXVxuICAgIGRpcmVjdGlvbiBUQlxuICAgICAgICBTWyBdLS4tXG4gICAgICAgIENbYn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8YnI-dXNlZnVsP10gLS0-IG1cbiAgICBtIC0tPiBOWzMgeCBtZXRob2RzPGJyPmZvciBjcmVhdGluZzxicj5kaWFncmFtc11cbiAgICBOIC0tPiBUW0V4YW1wbGVzXVxuICAgIFQgLS0-IFhbU3R5bGluZzxicj5hbmQ8YnI-Y2FwdGlvbnNdXG4gICAgWCAtLT4gVltUaXBzXVxuICAgIFxuIFxuICAgIGNsYXNzRGVmIGJveCBmaWxsOiNmZmYsc3Ryb2tlOiMwMDAsc3Ryb2tlLXdpZHRoOjFweCxjb2xvcjojMDAwO1xuICAgIGNsYXNzRGVmIHNwYWNld2hpdGUgZmlsbDojZmZmZmZmLHN0cm9rZTojZmZmLHN0cm9rZS13aWR0aDowcHgsY29sb3I6IzAwMFxuICAgIGNsYXNzIEEsQyxELE4sWCxtLFQsViBib3hcbiAgICBjbGFzcyBTIHNwYWNld2hpdGUiLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOnRydWV9" _blank
|
||||
|
||||
click X "https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgc3ViZ3JhcGggbVtNZXJtYWlkLmpzXVxuICAgIGRpcmVjdGlvbiBUQlxuICAgICAgICBTWyBdLS4tXG4gICAgICAgIENbYnVpbGQ8YnI-ZGlhZ3JhbXM8YnI-d2l0aCBtYXJrZG93bl0gLS0-XG4gICAgICAgIERbb24tbGluZTxicj5saXZlIGVkaXRvcl1cbiAgICBlbmRcbiAgICBBW1doeSBhcmUgZGlhZ3JhbXM8YnI-dXNlZnVsP10gLS0-IG1cbiAgICBtIC0tPiBOWzMgeCBtZXRob2RzPGJyPmZvciBjcmVhdGluZzxicj5kaWFncmFtc11cbiAgICBOIC0tPiBUW0V4YW1wbGVzXVxuICAgIFQgLS0-IFh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LXdpZHRoOjFweCxjb2xvcjojMDAwO1xuICAgIGNsYXNzRGVmIHNwYWNld2hpdGUgZmlsbDojZmZmZmZmLHN0cm9rZTojZmZmLHN0cm9rZS13aWR0aDowcHgsY29sb3I6IzAwMFxuICAgIGNsYXNzIEEsQyxELE4sWCxtLFQsViBib3hcbiAgICBjbGFzcyBTIHNwYWNld2hpdGUiLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOnRydWV9" _blank
|
||||
|
||||
{{< /mermaid >}}
|
||||
|
@ -120,6 +125,7 @@ The user benefits include:
|
|||
* __Better retention__. For some, it is easier to recall pictures rather than text.
|
||||
-->
|
||||
用户获得的好处有:
|
||||
|
||||
* **较为友好的初次体验**:非常详尽的、只包含文本的欢迎页面对用户而言是蛮恐怖的,
|
||||
尤其是初次接触 Kubernetes 的用户。
|
||||
* **快速理解概念**:图表可以帮助用户理解复杂主题下的要点。
|
||||
|
@ -192,9 +198,9 @@ The following lists advantages of using Mermaid:
|
|||
-->
|
||||
使用 Mermaid 的一些好处如下:
|
||||
|
||||
* 不需要使用另外的、非 Mermaid 的图表工具
|
||||
* 不需要使用另外的、非 Mermaid 的图表工具。
|
||||
* 与现有的 PR 工作流结合的很好。你可以将 Mermaid 代码视为你的 PR 中所包含的
|
||||
Markdown 文本
|
||||
Markdown 文本。
|
||||
* 简单的工具生成简单的图表。你不需要精心制作或雕琢过于复杂或详尽的图片。
|
||||
保持简单就好。
|
||||
|
||||
|
@ -221,7 +227,7 @@ below.
|
|||
The [Mermaid live editor](https://mermaid-js.github.io/mermaid-live-editor) is
|
||||
a web-based tool that enables you to create, edit and review diagrams.
|
||||
-->
|
||||
### 在线编辑器
|
||||
### 在线编辑器 {#live-editor}
|
||||
|
||||
[Mermaid 在线编辑器](https://mermaid-js.github.io/mermaid-live-editor)是一个基于
|
||||
Web 的工具,允许你创建、编辑和审阅图表。
|
||||
|
@ -242,7 +248,6 @@ The following lists live editor functions:
|
|||
你可以将 URL 分享给同事,便于他人访问和更改图表。
|
||||
* 提供将图表下载为 `.svg` 或 `.png` 文件的选项。
|
||||
|
||||
|
||||
{{< note >}}
|
||||
<!--
|
||||
The live editor is the easiest and fastest way to create and edit Mermaid diagrams.
|
||||
|
@ -296,7 +301,7 @@ Figure 2. Methods to create diagrams.
|
|||
Figure 3 outlines the steps to follow for adding a diagram using the Inline
|
||||
method.
|
||||
-->
|
||||
### 内嵌(Inline)
|
||||
### 内嵌(Inline) {#inline}
|
||||
|
||||
图 3 给出的是使用内嵌方法来添加图表所遵循的步骤。
|
||||
|
||||
|
@ -364,7 +369,19 @@ Here is a sample code snippet contained in an `.md` file:
|
|||
-->
|
||||
下面是一段包含在某 `.md` 文件中的示例代码片段:
|
||||
|
||||
```
|
||||
|
||||
<!--
|
||||
---
|
||||
title: My PR
|
||||
---
|
||||
Figure 17 shows a simple A to B process.
|
||||
some markdown text
|
||||
...
|
||||
|
||||
Figure 17. A to B
|
||||
more text
|
||||
-->
|
||||
```text
|
||||
---
|
||||
title: 我的文档
|
||||
---
|
||||
|
@ -509,11 +526,11 @@ the `.svg` image file and add a caption.
|
|||
`.svg` 图片文件,并为之添加标题。
|
||||
|
||||
<!--
|
||||
```json
|
||||
```text
|
||||
{{</* figure src="/static/images/boxnet.svg" alt="Boxnet figure" class="diagram-large" caption="Figure 14. Boxnet caption" */>}}
|
||||
```
|
||||
-->
|
||||
```json
|
||||
```text
|
||||
{{</* figure src="/static/images/boxnet.svg" alt="Boxnet 示意图" class="diagram-large" caption="图 14. Boxnet 标题" */>}}
|
||||
```
|
||||
|
||||
|
@ -524,12 +541,12 @@ For more details on diagram captions, see [How to use captions](#how-to-use-capt
|
|||
|
||||
{{< note >}}
|
||||
<!--
|
||||
The `{{</* figure */>}}` shortcode is the preferred method for adding `.svg` image files
|
||||
The figure shortcode is the preferred method for adding `.svg` image files
|
||||
to your documentation. You can also use the standard markdown image syntax like so:
|
||||
`![my boxnet diagram](static/images/boxnet.svg)`.
|
||||
And you will need to add a caption below the diagram.
|
||||
-->
|
||||
使用 `{{</* figure */>}}` 短代码是向你的文档中添加 `.svg` 图片文件的优选方法。
|
||||
使用插图短代码是向你的文档中添加 `.svg` 图片文件的优选方法。
|
||||
你也可以使用标准的 markdown 图片语法,即
|
||||
`![my boxnet diagram](static/images/boxnet.svg)`。
|
||||
如果是后面这种,则需要在图表下面为其添加标题。
|
||||
|
@ -542,7 +559,7 @@ For example, you would include the following at the beginning of the `.svg` imag
|
|||
你应该使用文本编辑器以注释块的形式在 `.svg` 图片文件中添加在线编辑器的 URL。
|
||||
例如,你应该在 `.svg` 图片文件的开头部分包含下面的内容:
|
||||
|
||||
```
|
||||
```text
|
||||
<!-- 要查看或者编辑 Mermaid 代码,可访问下面的 URL:-->
|
||||
<!-- https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb ... <URL 的其余部分> -->
|
||||
```
|
||||
|
@ -580,7 +597,7 @@ First, use your external tool to create the diagram and save it as an `.svg`
|
|||
or `.png` image file. After that, use the same steps as the __Mermaid+SVG__
|
||||
method for adding `.svg` image files.
|
||||
-->
|
||||
### 外部工具
|
||||
### 外部工具 {#external-tool}
|
||||
|
||||
图 5 给出使用外部工具来添加图表时所遵循的步骤。
|
||||
|
||||
|
@ -616,7 +633,6 @@ click D "https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxv
|
|||
|
||||
click E "https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgQVsxLiBVc2UgZXh0ZXJuYWw8YnI-dG9vbCB0byBjcmVhdGUvZWRpdDxicj5kaWFncmFtXVxuICAgIEJbMi4gSWYgcG9zc2libGUsIHNhdmU8YnI-ZGlhZ3JhbSBjb29yZGluYXRlczxicj5mb3IgY29udHJpYnV0b3I8YnI-YWNjZXNzXVxuICAgIENbMy4gR2VuZXJhdGUgLnN2ZyA8YnI-b3IucG5nIGZpbGU8YnI-YW5kIGRvd25sb2FkIHRvPGJyPmFwcHJvcHJpYXRlPGJyPmltYWdlcy8gZm9sZGVyXVxuICAgIHN1YmdyYXBoIHdbIF1cbiAgICBkaXJlY3Rpb24gVEJcbiAgICBEWzQuIFVzZSBmaWd1cmUgc2hvcnRjb2RlPGJyPnRvIHJlZmVyZW5jZSBzdmcgb3I8YnI-cG5nIGZpbGUgaW48YnI-cGFnZSAubWQgZmlsZV0gLS0-XG4gICAgRVs1LiBBZGQgY2FwdGlvbl1cbiAgICBlbmRcbiAgICBBIC0tPiBCXG4gICAgQiAtLT4gQ1xuICAgIEMgLS0-IHdcbiAgICBjbGFzc0RlZiBib3ggZmlsbDojZmZmLHN0cm9rZTojMDAwLHN0cm9rZS13aWR0aDoxcHgsY29sb3I6IzAwMDtcbiAgICBjbGFzcyBBLEIsQyxELEUsdyBib3hcbiAgICAiLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOmZhbHNlfQ"
|
||||
|
||||
|
||||
{{< /mermaid >}}
|
||||
|
||||
<!--
|
||||
|
@ -657,7 +673,7 @@ Here is the `{{</* figure */>}}` shortcode for the `images/apple.svg` diagram:
|
|||
```
|
||||
-->
|
||||
```text
|
||||
{{</* figure src="/static/images/apple.svg" alt="red-apple-figure" class="diagram-large" caption="图 9. 一个大红苹果" */>}}
|
||||
{{</* figure src="/static/images/apple.svg" alt="红苹果图" class="diagram-large" caption="图 9. 一个大红苹果" */>}}
|
||||
```
|
||||
|
||||
<!--
|
||||
|
@ -707,7 +723,7 @@ Netlify 预览来检查你的图表可以正常渲染。
|
|||
|
||||
This section shows several examples of Mermaid diagrams.
|
||||
-->
|
||||
## 示例
|
||||
## 示例 {#examples}
|
||||
|
||||
本节给出 Mermaid 的若干样例。
|
||||
|
||||
|
@ -732,8 +748,8 @@ page.
|
|||
-->
|
||||
### 示例 1 - Pod 拓扑分布约束
|
||||
|
||||
图 6 展示的是 [Pod 拓扑分布约束](/zh-cn/docs/concepts/scheduling-eviction/topology-spread-constraints/#node-labels)
|
||||
页面所出现的图表。
|
||||
图 6 展示的是
|
||||
[Pod 拓扑分布约束](/zh-cn/docs/concepts/scheduling-eviction/topology-spread-constraints/#node-labels)页面所出现的图表。
|
||||
|
||||
{{< mermaid >}}
|
||||
graph TB
|
||||
|
@ -771,7 +787,7 @@ Code block:
|
|||
|
||||
代码块:
|
||||
|
||||
```
|
||||
```text
|
||||
graph TB
|
||||
subgraph "zoneB"
|
||||
n3(Node3)
|
||||
|
@ -796,8 +812,8 @@ Figure 7 shows the diagram appearing in the [What is Ingress](/docs/concepts/ser
|
|||
-->
|
||||
### 示例 2 - Ingress
|
||||
|
||||
图 7 显示的是 [Ingress 是什么](/zh-cn/docs/concepts/services-networking/ingress/#what-is-ingress)
|
||||
页面所出现的图表。
|
||||
图 7 显示的是
|
||||
[Ingress 是什么](/zh-cn/docs/concepts/services-networking/ingress/#what-is-ingress)页面所出现的图表。
|
||||
|
||||
{{< mermaid >}}
|
||||
graph LR;
|
||||
|
@ -837,7 +853,7 @@ Code block:
|
|||
|
||||
代码块:
|
||||
|
||||
```mermaid
|
||||
```text
|
||||
graph LR;
|
||||
client([客户端])-. Ingress 所管理的<br>负载均衡器 .->ingress[Ingress];
|
||||
ingress-->|路由规则|service[服务];
|
||||
|
@ -864,14 +880,42 @@ K8s components to start a container.
|
|||
|
||||
图 8 给出的是一个 Mermaid 时序图,展示启动容器时 K8s 组件间的控制流。
|
||||
|
||||
{{< figure src="/zh-cn/docs/images/diagram-guide-example-3.svg" alt="K8s system flow diagram" class="diagram-large" caption="图 8. K8s 系统流程图" link="https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiJSV7aW5pdDp7XCJ0aGVtZVwiOlwibm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ZCBwb2QgdG8gbm9kZVxuICAgIGt1YmVsZXQtPj5jb250YWluZXI6IDEwLiBzdGFydCBjb250YWluZXJcbiAgICBrdWJlbGV0LT4-YXBpU3J2OiAxMS4gdXBkYXRlIHBvZCBzdGF0dXNcbiAgICBhcGlTcnYtLT4-ZXRjZDogMTIuIHNhdmUgbmV3IHN0YXRlIiwibWVybWFpZCI6IntcbiAgXCJ0aGVtZVwiOiBcImRlZmF1bHRcIlxufSIsInVwZGF0ZUVkaXRvciI6ZmFsc2UsImF1dG9TeW5jIjp0cnVlLCJ1cGRhdGVEaWFncmFtIjp0cnVlfQ" >}}
|
||||
<!--
|
||||
{{< figure src="/docs/images/diagram-guide-example-3.svg" alt="K8s system flow diagram" class="diagram-large" caption="Figure 8. K8s system flow diagram" link="https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiJSV7aW5pdDp7XCJ0aGVtZVwiOlwibmV1dHJhbFwifX0lJVxuc2VxdWVuY2VEaWFncmFtXG4gICAgYWN0b3IgbWVcbiAgICBwYXJ0aWNpcGFudCBhcGlTcnYgYXMgY29udHJvbCBwbGFuZTxicj48YnI-YXBpLXNlcnZlclxuICAgIHBhcnRpY2lwYW50IGV0Y2QgYXMgY29udHJvbCBwbGFuZTxicj48YnI-ZXRjZCBkYXRhc3RvcmVcbiAgICBwYXJ0aWNpcGFudCBjbnRybE1nciBhcyBjb250cm9sIHBsYW5lPGJyPjxicj5jb250cm9sbGVyPGJyPm1hbmFnZXJcbiAgICBwYXJ0aWNpcGFudCBzY2hlZCBhcyBjb250cm9sIHBsYW5lPGJyPjxicj5zY2hlZHVsZXJcbiAgICBwYXJ0aWNpcGFudCBrdWJlbGV0IGFzIG5vZGU8YnI-PGJyPmt1YmVsZXRcbiAgICBwYXJ0aWNpcGFudCBjb250YWluZXIgYXMgbm9kZTxicj48YnI-Y29udGFpbmVyPGJyPnJ1bnRpbWVcbiAgICBtZS0-PmFwaVNydjogMS4ga3ViZWN0bCBjcmVhdGUgLWYgcG9kLnlhbWxcbiAgICBhcGlTcnYtLT4-ZXRjZDogMi4gc2F2ZSBuZXcgc3RhdGVcbiAgICBjbnRybE1nci0-PmFwaVNydjogMy4gY2hlY2sgZm9yIGNoYW5nZXNcbiAgICBzY2hlZC0-PmFwaVNydjogNC4gd2F0Y2ggZm9yIHVuYXNzaWduZWQgcG9kcyhzKVxuICAgIGFwaVNydi0-PnNjaGVkOiA1LiBub3RpZnkgYWJvdXQgcG9kIHcgbm9kZW5hbWU9XCIgXCJcbiAgICBzY2hlZC0-PmFwaVNydjogNi4gYXNzaWduIHBvZCB0byBub2RlXG4gICAgYXBpU3J2LS0-PmV0Y2Q6IDcuIHNhdmUgbmV3IHN0YXRlXG4gICAga3ViZWxldC0-PmFwaVNydjogOC4gbG9vayBmb3IgbmV3bHkgYXNzaWduZWQgcG9kKHMpXG4gICAgYXBpU3J2LT4-a3ViZWxldDogOS4gYmluZCBwb2QgdG8gbm9kZVxuICAgIGt1YmVsZXQtPj5jb250YWluZXI6IDEwLiBzdGFydCBjb250YWluZXJcbiAgICBrdWJlbGV0LT4-YXBpU3J2OiAxMS4gdXBkYXRlIHBvZCBzdGF0dXNcbiAgICBhcGlTcnYtLT4-ZXRjZDogMTIuIHNhdmUgbmV3IHN0YXRlIiwibWVybWFpZCI6IntcbiAgXCJ0aGVtZVwiOiBcImRlZmF1bHRcIlxufSIsInVwZGF0ZUVkaXRvciI6ZmFsc2UsImF1dG9TeW5jIjp0cnVlLCJ1cGRhdGVEaWFncmFtIjp0cnVlfQ" >}}
|
||||
-->
|
||||
{{< figure src="/zh-cn/docs/images/diagram-guide-example-3.svg" alt="K8s 系统流程图" class="diagram-large" caption="图 8. K8s 系统流程图" link="https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiJSV7aW5pdDp7XCJ0aGVtZVwiOlwibmV1dHJhbFwifX0lJVxuc2VxdWVuY2VEaWFncmFtXG4gICAgYWN0b3IgbWVcbiAgICBwYXJ0aWNpcGFud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gICBrdWJlbGV0LT4-YXBpU3J2OiAxMS4gdXBkYXRlIHBvZCBzdGF0dXNcbiAgICBhcGlTcnYtLT4-ZXRjZDogMTIuIHNhdmUgbmV3IHN0YXRlIiwibWVybWFpZCI6IntcbiAgXCJ0aGVtZVwiOiBcImRlZmF1bHRcIlxufSIsInVwZGF0ZUVkaXRvciI6ZmFsc2UsImF1dG9TeW5jIjp0cnVlLCJ1cGRhdGVEaWFncmFtIjp0cnVlfQ" >}}
|
||||
|
||||
<!--
|
||||
Code block:
|
||||
-->
|
||||
代码段:
|
||||
|
||||
<!--
|
||||
```text
|
||||
%%{init:{"theme":"neutral"}}%%
|
||||
sequenceDiagram
|
||||
actor me
|
||||
participant apiSrv as control plane<br><br>api-server
|
||||
participant etcd as control plane<br><br>etcd datastore
|
||||
participant cntrlMgr as control plane<br><br>controller<br>manager
|
||||
participant sched as control plane<br><br>scheduler
|
||||
participant kubelet as node<br><br>kubelet
|
||||
participant container as node<br><br>container<br>runtime
|
||||
me>>apiSrv: 1. kubectl create -f pod.yaml
|
||||
apiSrv->>etcd: 2. save new state
|
||||
cntrlMgr>>apiSrv: 3. check for changes
|
||||
sched>>apiSrv: 4. watch for unassigned pods(s)
|
||||
apiSrv>>sched: 5. notify about pod w nodename=" "
|
||||
sched>>apiSrv: 6. assign pod to node
|
||||
apiSrv->>etcd: 7. save new state
|
||||
kubelet>>apiSrv: 8. look for newly assigned pod(s)
|
||||
apiSrv>>kubelet: 9. bind pod to node
|
||||
kubelet>>container: 10. start container
|
||||
kubelet>>apiSrv: 11. update pod status
|
||||
apiSrv>>etcd: 12. save new state
|
||||
```
|
||||
-->
|
||||
```text
|
||||
%%{init:{"theme":"neutral"}}%%
|
||||
sequenceDiagram
|
||||
actor me
|
||||
|
@ -898,7 +942,7 @@ sequenceDiagram
|
|||
<!--
|
||||
## How to style diagrams
|
||||
-->
|
||||
## 如何设置图表样式
|
||||
## 如何设置图表样式 {#how-to-style-diagrams}
|
||||
|
||||
<!--
|
||||
You can style one or more diagram elements using well-known CSS nomenclature.
|
||||
|
@ -922,12 +966,12 @@ you can see examples of both.
|
|||
中,你可以看到这两种示例。
|
||||
|
||||
<!--
|
||||
```
|
||||
```text
|
||||
classDef k8s fill:#326ce5,stroke:#fff,stroke-width:4px,color:#fff; // defines style for the k8s class
|
||||
class ingress,service,pod1,pod2 k8s; // k8s class is applied to elements ingress, service, pod1 and pod2.
|
||||
```
|
||||
-->
|
||||
```
|
||||
```text
|
||||
classDef k8s fill:#326ce5,stroke:#fff,stroke-width:4px,color:#fff; // 定义 k8s 类的样式
|
||||
class ingress,service,pod1,pod2 k8s; // k8s 类会应用到 ingress、service、pod1 和 pod2 这些元素之上
|
||||
```
|
||||
|
@ -943,7 +987,7 @@ For more information on styling and classes, see
|
|||
你也可以在你的图表中为 k8s 组件使用官方的 K8s `#326ce5` 十六进制颜色代码。
|
||||
|
||||
关于样式设置和类的更多信息,可参阅
|
||||
[Mermaid Styling and classes docs](https://mermaid-js.github.io/mermaid/#/flowchart?id=styling-and-classes)。
|
||||
[Mermaid Styling and classes 文档](https://mermaid-js.github.io/mermaid/#/flowchart?id=styling-and-classes)。
|
||||
|
||||
<!--
|
||||
## How to use captions
|
||||
|
@ -1040,10 +1084,10 @@ You should pass the `src`, `alt`, `class` and `caption` values into the
|
|||
|
||||
{{< note >}}
|
||||
<!--
|
||||
Diagrams created using the `Inline` method don't use the `{{</* figure */>}}`
|
||||
Diagrams created using the `Inline` method don't use the figure
|
||||
shortcode. The Mermaid code defines how the diagram will render on your page.
|
||||
-->
|
||||
使用内嵌方法来创建的图表不使用 `{{</* figure */>}}` 短代码。
|
||||
使用内嵌方法来创建的图表不使用插图短代码。
|
||||
Mermaid 代码定义该图表将如何在页面上渲染。
|
||||
{{< /note >}}
|
||||
|
||||
|
@ -1125,7 +1169,7 @@ match.
|
|||
**图表引用**
|
||||
|
||||
最后,你可以添加图表引用。图表引用位于你的文档正文中,并且应该出现在图表之前。
|
||||
这样,用户可以将你的文字与对应的图表关联起来。引用时所给的 `图 <编号>`
|
||||
这样,用户可以将你的文字与对应的图表关联起来。引用时所给的`图 <编号>`
|
||||
部分要与图表标题中对应部分一致。
|
||||
|
||||
<!--
|
||||
|
@ -1181,7 +1225,7 @@ Here is the `{{</* figure */>}}` shortcode for this diagram:
|
|||
{{</* figure src="/images/docs/components-of-kubernetes.svg" alt="Kubernetes pod running inside a cluster" class="diagram-large" caption="Figure 10. Kubernetes Architecture." link="https://kubernetes.io/docs/concepts/overview/components/" */>}}
|
||||
```
|
||||
-->
|
||||
```
|
||||
```text
|
||||
{{</* figure src="/images/docs/components-of-kubernetes.svg" alt="运行在集群中的 Kubernetes Pod" class="diagram-large" caption="图 10. Kubernetes 架构" link="https://kubernetes.io/zh-cn/docs/concepts/overview/components/" */>}}
|
||||
```
|
||||
|
||||
|
@ -1232,6 +1276,8 @@ Here is the `{{</* figure */>}}` shortcode for this diagram:
|
|||
|
||||
* 对于 `.svg` 文件的最佳实践是将其加载到一个 SVG 编辑工具中,并使用
|
||||
“将文字转换为路径”功能完成转换。
|
||||
这样可以确保图表渲染在所有系统上都一样,与字体的可用性及字体的渲染支持无关。
|
||||
|
||||
<!--
|
||||
* No Mermaid support for additional icons or artwork.
|
||||
|
||||
|
@ -1243,13 +1289,14 @@ Here is the `{{</* figure */>}}` shortcode for this diagram:
|
|||
* Click on the diagrams in this section to view the code and diagram rendering
|
||||
in the live editor.
|
||||
-->
|
||||
* Mermaid 不支持额外的图表或艺术形式。
|
||||
* Mermaid 不支持额外的图标或艺术形式。
|
||||
|
||||
* Hugo Mermaid 短代码在在线编辑器中无法显示。
|
||||
|
||||
* 如果想要在在线编辑器中更改图表,你**必须**保存它以便为图表生成新的 URL。
|
||||
|
||||
* 点击本节中的图表,你可以查看其源代码及其在在线编辑器中的渲染效果。
|
||||
|
||||
<!--
|
||||
* Look over the source code of this page, `diagram-guide.md`, for more examples.
|
||||
|
||||
|
|
Loading…
Reference in New Issue