Merge master into dev-1.21 to keep in sync
This commit is contained in:
@@ -47,13 +47,13 @@ Nodes should be provisioned with the public root certificate for the cluster suc
|
||||
|
||||
<!--
|
||||
Pods that wish to connect to the apiserver can do so securely by leveraging a service account so that Kubernetes will automatically inject the public root certificate and a valid bearer token into the pod when it is instantiated.
|
||||
The `kubernetes` service (in all namespaces) is configured with a virtual IP address that is redirected (via kube-proxy) to the HTTPS endpoint on the apiserver.
|
||||
The `kubernetes` service (in `default` namespace) is configured with a virtual IP address that is redirected (via kube-proxy) to the HTTPS endpoint on the apiserver.
|
||||
|
||||
The control plane components also communicate with the cluster apiserver over the secure port.
|
||||
-->
|
||||
想要连接到 apiserver 的 Pod 可以使用服务账号安全地进行连接。
|
||||
当 Pod 被实例化时,Kubernetes 自动把公共根证书和一个有效的持有者令牌注入到 Pod 里。
|
||||
`kubernetes` 服务(位于所有名字空间中)配置了一个虚拟 IP 地址,用于(通过 kube-proxy)转发
|
||||
`kubernetes` 服务(位于 `default` 名字空间中)配置了一个虚拟 IP 地址,用于(通过 kube-proxy)转发
|
||||
请求到 apiserver 的 HTTPS 末端。
|
||||
|
||||
控制面组件也通过安全端口与集群的 apiserver 通信。
|
||||
|
||||
@@ -66,7 +66,7 @@ Kubernetes objects that have a `spec`, a ConfigMap has `data` and `binaryData`
|
||||
fields. These fields accept key-value pairs as their values. Both the `data`
|
||||
field and the `binaryData` are optional. The `data` field is designed to
|
||||
contain UTF-8 byte sequences while the `binaryData` field is designed to
|
||||
contain binary data.
|
||||
contain binary data as base64-encoded strings.
|
||||
|
||||
The name of a ConfigMap must be a valid
|
||||
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
|
||||
@@ -78,7 +78,7 @@ ConfigMap 是一个 API [对象](/zh/docs/concepts/overview/working-with-objects
|
||||
和其他 Kubernetes 对象都有一个 `spec` 不同的是,ConfigMap 使用 `data` 和
|
||||
`binaryData` 字段。这些字段能够接收键-值对作为其取值。`data` 和 `binaryData`
|
||||
字段都是可选的。`data` 字段设计用来保存 UTF-8 字节序列,而 `binaryData` 则
|
||||
被设计用来保存二进制数据。
|
||||
被设计用来保存二进制数据作为 base64 编码的字串。
|
||||
|
||||
ConfigMap 的名字必须是一个合法的
|
||||
[DNS 子域名](/zh/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)。
|
||||
@@ -361,7 +361,7 @@ kubelet 组件会在每次周期性同步时检查所挂载的 ConfigMap 是否
|
||||
的 `ConfigMapAndSecretChangeDetectionStrategy` 字段来配置。
|
||||
|
||||
<!--
|
||||
A ConfigMap can be either propagated by watch (default), ttl-based, or simply redirecting
|
||||
A ConfigMap can be either propagated by watch (default), ttl-based, or by redirecting
|
||||
all requests directly to the API server.
|
||||
As a result, the total delay from the moment when the ConfigMap is updated to the moment
|
||||
when new keys are projected to the Pod can be as long as the kubelet sync period + cache
|
||||
@@ -369,7 +369,7 @@ propagation delay, where the cache propagation delay depends on the chosen cache
|
||||
(it equals to watch propagation delay, ttl of cache, or zero correspondingly).
|
||||
-->
|
||||
ConfigMap 既可以通过 watch 操作实现内容传播(默认形式),也可实现基于 TTL
|
||||
的缓存,还可以直接将所有请求重定向到 API 服务器。
|
||||
的缓存,还可以直接经过所有请求重定向到 API 服务器。
|
||||
因此,从 ConfigMap 被更新的那一刻算起,到新的主键被投射到 Pod 中去,这一
|
||||
时间跨度可能与 kubelet 的同步周期加上高速缓存的传播延迟相等。
|
||||
这里的传播延迟取决于所选的高速缓存类型
|
||||
|
||||
@@ -185,57 +185,63 @@ kubectl edit SampleDB/example-database # 手动修改某些配置
|
||||
|
||||
<!--
|
||||
…and that's it! The Operator will take care of applying the changes as well as keeping the existing service in good shape.
|
||||
|
||||
## Writing your own Operator {#writing-operator}
|
||||
-->
|
||||
可以了!Operator 会负责应用所作的更改并保持现有服务处于良好的状态。
|
||||
|
||||
<!--
|
||||
## Writing your own Operator {#writing-operator}
|
||||
-->
|
||||
|
||||
## 编写你自己的 Operator {#writing-operator}
|
||||
|
||||
<!--
|
||||
If there isn't an Operator in the ecosystem that implements the behavior you
|
||||
want, you can code your own. In [What's next](#what-s-next) you'll find a few
|
||||
links to libraries and tools you can use to write your own cloud native
|
||||
Operator.
|
||||
want, you can code your own.
|
||||
|
||||
You also implement an Operator (that is, a Controller) using any language / runtime
|
||||
that can act as a [client for the Kubernetes API](/docs/reference/using-api/client-libraries/).
|
||||
|
||||
-->
|
||||
|
||||
如果生态系统中没可以实现你目标的 Operator,你可以自己编写代码。在
|
||||
[接下来](#what-s-next)一节中,你会找到编写自己的云原生 Operator
|
||||
需要的库和工具的链接。
|
||||
如果生态系统中没可以实现你目标的 Operator,你可以自己编写代码。
|
||||
|
||||
你还可以使用任何支持 [Kubernetes API 客户端](/zh/docs/reference/using-api/client-libraries/)
|
||||
的语言或运行时来实现 Operator(即控制器)。
|
||||
|
||||
<!--
|
||||
Following are a few libraries and tools you can use to write your own cloud native
|
||||
Operator.
|
||||
|
||||
{{% thirdparty-content %}}
|
||||
|
||||
* [kubebuilder](https://book.kubebuilder.io/)
|
||||
* [KUDO](https://kudo.dev/) (Kubernetes Universal Declarative Operator)
|
||||
* [Metacontroller](https://metacontroller.app/) along with WebHooks that
|
||||
you implement yourself
|
||||
* [Operator Framework](https://operatorframework.io)
|
||||
-->
|
||||
以下是一些库和工具,你可用于编写自己的云原生 Operator。
|
||||
|
||||
{{% thirdparty-content %}}
|
||||
|
||||
* [kubebuilder](https://book.kubebuilder.io/)
|
||||
* [KUDO](https://kudo.dev/) (Kubernetes 通用声明式 Operator)
|
||||
* [Metacontroller](https://metacontroller.app/),可与 Webhooks 结合使用,以实现自己的功能。
|
||||
* [Operator Framework](https://operatorframework.io)
|
||||
|
||||
## {{% heading "whatsnext" %}}
|
||||
|
||||
<!--
|
||||
* Learn more about [Custom Resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
|
||||
* Find ready-made operators on [OperatorHub.io](https://operatorhub.io/) to suit your use case
|
||||
* Use existing tools to write your own operator, eg:
|
||||
* using [KUDO](https://kudo.dev/) (Kubernetes Universal Declarative Operator)
|
||||
* using [kubebuilder](https://book.kubebuilder.io/)
|
||||
* using [Metacontroller](https://metacontroller.app/) along with WebHooks that
|
||||
you implement yourself
|
||||
* using the [Operator Framework](https://operatorframework.io)
|
||||
* [Publish](https://operatorhub.io/) your operator for other people to use
|
||||
* Read [CoreOS' original article](https://coreos.com/blog/introducing-operators.html) that introduced the Operator pattern
|
||||
* Read [CoreOS' original article](https://web.archive.org/web/20170129131616/https://coreos.com/blog/introducing-operators.html) that introduced the Operator pattern (this is an archived version of the original article).
|
||||
* Read an [article](https://cloud.google.com/blog/products/containers-kubernetes/best-practices-for-building-kubernetes-operators-and-stateful-apps) from Google Cloud about best practices for building Operators
|
||||
-->
|
||||
|
||||
* 详细了解[定制资源](/zh/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
|
||||
* 详细了解 [定制资源](/zh/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
|
||||
* 在 [OperatorHub.io](https://operatorhub.io/) 上找到现成的、适合你的 Operator
|
||||
* 借助已有的工具来编写你自己的 Operator,例如:
|
||||
* [KUDO](https://kudo.dev/) (Kubernetes 通用声明式 Operator)
|
||||
* [kubebuilder](https://book.kubebuilder.io/)
|
||||
* [Metacontroller](https://metacontroller.app/),可与 Webhook 结合使用,以实现自己的功能。
|
||||
* [Operator Framework](https://operatorframework.io)
|
||||
* [发布](https://operatorhub.io/)你的 Operator,让别人也可以使用
|
||||
* 阅读 [CoreOS 原文](https://coreos.com/blog/introducing-operators.html),其介绍了 Operator 介绍
|
||||
* 阅读 [CoreOS 原始文章](https://web.archive.org/web/20170129131616/https://coreos.com/blog/introducing-operators.html),它介绍了 Operator 模式(这是一个存档版本的原始文章)。
|
||||
* 阅读这篇来自谷歌云的关于构建 Operator 最佳实践的
|
||||
[文章](https://cloud.google.com/blog/products/containers-kubernetes/best-practices-for-building-kubernetes-operators-and-stateful-apps)
|
||||
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ DNS 子域名的定义可参见 [RFC 1123](https://tools.ietf.org/html/rfc1123)
|
||||
这一要求意味着名称必须满足如下规则:
|
||||
|
||||
- 不能超过253个字符
|
||||
- 只能包含字母数字,以及'-' 和 '.'
|
||||
- 只能包含小写字母、数字,以及'-' 和 '.'
|
||||
- 须以字母数字开头
|
||||
- 须以字母数字结尾
|
||||
|
||||
@@ -83,7 +83,7 @@ This means the name must:
|
||||
所定义的 DNS 标签标准。也就是命名必须满足如下规则:
|
||||
|
||||
- 最多63个字符
|
||||
- 只能包含字母数字,以及'-'
|
||||
- 只能包含小写字母、数字,以及'-'
|
||||
- 须以字母数字开头
|
||||
- 须以字母数字结尾
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@ kind: "Secret"
|
||||
metadata:
|
||||
name: "nginxsecret"
|
||||
namespace: "default"
|
||||
type: kubernetes.io/tls
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURIekNDQWdlZ0F3SUJBZ0lKQUp5M3lQK0pzMlpJTUEwR0NTcUdTSWIzRFFFQkJRVUFNQ1l4RVRBUEJnTlYKQkFNVENHNW5hVzU0YzNaak1SRXdEd1lEVlFRS0V3aHVaMmx1ZUhOMll6QWVGdzB4TnpFd01qWXdOekEzTVRKYQpGdzB4T0RFd01qWXdOekEzTVRKYU1DWXhFVEFQQmdOVkJBTVRDRzVuYVc1NGMzWmpNUkV3RHdZRFZRUUtFd2h1CloybHVlSE4yWXpDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBSjFxSU1SOVdWM0IKMlZIQlRMRmtobDRONXljMEJxYUhIQktMSnJMcy8vdzZhU3hRS29GbHlJSU94NGUrMlN5ajBFcndCLzlYTnBwbQppeW1CL3JkRldkOXg5UWhBQUxCZkVaTmNiV3NsTVFVcnhBZW50VWt1dk1vLzgvMHRpbGhjc3paenJEYVJ4NEo5Ci82UVRtVVI3a0ZTWUpOWTVQZkR3cGc3dlVvaDZmZ1Voam92VG42eHNVR0M2QURVODBpNXFlZWhNeVI1N2lmU2YKNHZpaXdIY3hnL3lZR1JBRS9mRTRqakxCdmdONjc2SU90S01rZXV3R0ljNDFhd05tNnNTSzRqYUNGeGpYSnZaZQp2by9kTlEybHhHWCtKT2l3SEhXbXNhdGp4WTRaNVk3R1ZoK0QrWnYvcW1mMFgvbVY0Rmo1NzV3ajFMWVBocWtsCmdhSXZYRyt4U1FVQ0F3RUFBYU5RTUU0d0hRWURWUjBPQkJZRUZPNG9OWkI3YXc1OUlsYkROMzhIYkduYnhFVjcKTUI4R0ExVWRJd1FZTUJhQUZPNG9OWkI3YXc1OUlsYkROMzhIYkduYnhFVjdNQXdHQTFVZEV3UUZNQU1CQWY4dwpEUVlKS29aSWh2Y05BUUVGQlFBRGdnRUJBRVhTMW9FU0lFaXdyMDhWcVA0K2NwTHI3TW5FMTducDBvMm14alFvCjRGb0RvRjdRZnZqeE04Tzd2TjB0clcxb2pGSW0vWDE4ZnZaL3k4ZzVaWG40Vm8zc3hKVmRBcStNZC9jTStzUGEKNmJjTkNUekZqeFpUV0UrKzE5NS9zb2dmOUZ3VDVDK3U2Q3B5N0M3MTZvUXRUakViV05VdEt4cXI0Nk1OZWNCMApwRFhWZmdWQTRadkR4NFo3S2RiZDY5eXM3OVFHYmg5ZW1PZ05NZFlsSUswSGt0ejF5WU4vbVpmK3FqTkJqbWZjCkNnMnlwbGQ0Wi8rUUNQZjl3SkoybFIrY2FnT0R4elBWcGxNSEcybzgvTHFDdnh6elZPUDUxeXdLZEtxaUMwSVEKQ0I5T2wwWW5scE9UNEh1b2hSUzBPOStlMm9KdFZsNUIyczRpbDlhZ3RTVXFxUlU9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"
|
||||
tls.key: "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQ2RhaURFZlZsZHdkbFIKd1V5eFpJWmVEZWNuTkFhbWh4d1NpeWF5N1AvOE9ta3NVQ3FCWmNpQ0RzZUh2dGtzbzlCSzhBZi9WemFhWm9zcApnZjYzUlZuZmNmVUlRQUN3WHhHVFhHMXJKVEVGSzhRSHA3VkpMcnpLUC9QOUxZcFlYTE0yYzZ3MmtjZUNmZitrCkU1bEVlNUJVbUNUV09UM3c4S1lPNzFLSWVuNEZJWTZMMDUrc2JGQmd1Z0ExUE5JdWFubm9UTWtlZTRuMG4rTDQKb3NCM01ZUDhtQmtRQlAzeE9JNHl3YjREZXUraURyU2pKSHJzQmlIT05Xc0RadXJFaXVJMmdoY1kxeWIyWHI2UAozVFVOcGNSbC9pVG9zQngxcHJHclk4V09HZVdPeGxZZmcvbWIvNnBuOUYvNWxlQlkrZStjSTlTMkQ0YXBKWUdpCkwxeHZzVWtGQWdNQkFBRUNnZ0VBZFhCK0xkbk8ySElOTGo5bWRsb25IUGlHWWVzZ294RGQwci9hQ1Zkank4dlEKTjIwL3FQWkUxek1yall6Ry9kVGhTMmMwc0QxaTBXSjdwR1lGb0xtdXlWTjltY0FXUTM5SjM0VHZaU2FFSWZWNgo5TE1jUHhNTmFsNjRLMFRVbUFQZytGam9QSFlhUUxLOERLOUtnNXNrSE5pOWNzMlY5ckd6VWlVZWtBL0RBUlBTClI3L2ZjUFBacDRuRWVBZmI3WTk1R1llb1p5V21SU3VKdlNyblBESGtUdW1vVlVWdkxMRHRzaG9reUxiTWVtN3oKMmJzVmpwSW1GTHJqbGtmQXlpNHg0WjJrV3YyMFRrdWtsZU1jaVlMbjk4QWxiRi9DSmRLM3QraTRoMTVlR2ZQegpoTnh3bk9QdlVTaDR2Q0o3c2Q5TmtEUGJvS2JneVVHOXBYamZhRGR2UVFLQmdRRFFLM01nUkhkQ1pKNVFqZWFKClFGdXF4cHdnNzhZTjQyL1NwenlUYmtGcVFoQWtyczJxWGx1MDZBRzhrZzIzQkswaHkzaE9zSGgxcXRVK3NHZVAKOWRERHBsUWV0ODZsY2FlR3hoc0V0L1R6cEdtNGFKSm5oNzVVaTVGZk9QTDhPTm1FZ3MxMVRhUldhNzZxelRyMgphRlpjQ2pWV1g0YnRSTHVwSkgrMjZnY0FhUUtCZ1FEQmxVSUUzTnNVOFBBZEYvL25sQVB5VWs1T3lDdWc3dmVyClUycXlrdXFzYnBkSi9hODViT1JhM05IVmpVM25uRGpHVHBWaE9JeXg5TEFrc2RwZEFjVmxvcG9HODhXYk9lMTAKMUdqbnkySmdDK3JVWUZiRGtpUGx1K09IYnRnOXFYcGJMSHBzUVpsMGhucDBYSFNYVm9CMUliQndnMGEyOFVadApCbFBtWmc2d1BRS0JnRHVIUVV2SDZHYTNDVUsxNFdmOFhIcFFnMU16M2VvWTBPQm5iSDRvZUZKZmcraEppSXlnCm9RN3hqWldVR3BIc3AyblRtcHErQWlSNzdyRVhsdlhtOElVU2FsbkNiRGlKY01Pc29RdFBZNS9NczJMRm5LQTQKaENmL0pWb2FtZm1nZEN0ZGtFMXNINE9MR2lJVHdEbTRpb0dWZGIwMllnbzFyb2htNUpLMUI3MkpBb0dBUW01UQpHNDhXOTVhL0w1eSt5dCsyZ3YvUHM2VnBvMjZlTzRNQ3lJazJVem9ZWE9IYnNkODJkaC8xT2sybGdHZlI2K3VuCnc1YytZUXRSTHlhQmd3MUtpbGhFZDBKTWU3cGpUSVpnQWJ0LzVPbnlDak9OVXN2aDJjS2lrQ1Z2dTZsZlBjNkQKckliT2ZIaHhxV0RZK2Q1TGN1YSt2NzJ0RkxhenJsSlBsRzlOZHhrQ2dZRUF5elIzT3UyMDNRVVV6bUlCRkwzZAp4Wm5XZ0JLSEo3TnNxcGFWb2RjL0d5aGVycjFDZzE2MmJaSjJDV2RsZkI0VEdtUjZZdmxTZEFOOFRwUWhFbUtKCnFBLzVzdHdxNWd0WGVLOVJmMWxXK29xNThRNTBxMmk1NVdUTThoSDZhTjlaMTltZ0FGdE5VdGNqQUx2dFYxdEYKWSs4WFJkSHJaRnBIWll2NWkwVW1VbGc9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K"
|
||||
|
||||
@@ -1485,13 +1485,13 @@ Quobyte 的 GitHub 项目包含以 CSI 形式部署 Quobyte 的
|
||||
|
||||
<!--
|
||||
An `rbd` volume allows a
|
||||
[Rados Block Device](https://ceph.com/docs/master/rbd/rbd/) volume to mount into your
|
||||
[Rados Block Device](https://docs.ceph.com/en/latest/rbd/) volume to mount into your
|
||||
Pod. Unlike `emptyDir`, which is erased when a Pod is removed, the contents of
|
||||
a `rbd` volume are preserved and the volume is merely unmounted. This
|
||||
means that a RBD volume can be pre-populated with data, and that data can
|
||||
be shared between pods.
|
||||
-->
|
||||
`rbd` 卷允许将 [Rados 块设备](https://ceph.com/docs/master/rbd/rbd/) 卷挂载到你的 Pod 中.
|
||||
`rbd` 卷允许将 [Rados 块设备](https://docs.ceph.com/en/latest/rbd/) 卷挂载到你的 Pod 中.
|
||||
不像 `emptyDir` 那样会在删除 Pod 的同时也会被删除,`rbd` 卷的内容在删除 Pod 时
|
||||
会被保存,卷只是被卸载。
|
||||
这意味着 `rbd` 卷可以被预先填充数据,并且这些数据可以在 Pod 之间共享。
|
||||
|
||||
@@ -9,7 +9,7 @@ reviewers:
|
||||
- bart0sh
|
||||
title: Container runtimes
|
||||
content_type: concept
|
||||
weight: 10
|
||||
weight: 20
|
||||
-->
|
||||
|
||||
<!-- overview -->
|
||||
@@ -108,7 +108,7 @@ configuration, or reinstall it using automation.
|
||||
### containerd
|
||||
|
||||
<!--
|
||||
This section contains the necessary steps to use `containerd` as CRI runtime.
|
||||
This section contains the necessary steps to use containerd as CRI runtime.
|
||||
|
||||
Use the following commands to install Containerd on your system:
|
||||
|
||||
@@ -134,7 +134,7 @@ EOF
|
||||
sudo sysctl --system
|
||||
```
|
||||
-->
|
||||
本节包含使用 `containerd` 作为 CRI 运行时的必要步骤。
|
||||
本节包含使用 containerd 作为 CRI 运行时的必要步骤。
|
||||
|
||||
使用以下命令在系统上安装容器:
|
||||
|
||||
@@ -156,7 +156,7 @@ net.ipv4.ip_forward = 1
|
||||
net.bridge.bridge-nf-call-ip6tables = 1
|
||||
EOF
|
||||
|
||||
# Apply sysctl params without reboot
|
||||
# 应用 sysctl 参数而无需重新启动
|
||||
sudo sysctl --system
|
||||
```
|
||||
|
||||
@@ -166,310 +166,85 @@ Install containerd:
|
||||
安装 containerd:
|
||||
|
||||
{{< tabs name="tab-cri-containerd-installation" >}}
|
||||
{{% tab name="Ubuntu 16.04" %}}
|
||||
{{% tab name="Linux" %}}
|
||||
|
||||
<!--
|
||||
```shell
|
||||
# (Install containerd)
|
||||
## Set up the repository
|
||||
### Install packages to allow apt to use a repository over HTTPS
|
||||
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
|
||||
```
|
||||
|
||||
```shell
|
||||
## Add Docker's official GPG key
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
|
||||
```
|
||||
|
||||
```shell
|
||||
## Add Docker apt repository.
|
||||
sudo add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
```
|
||||
|
||||
```shell
|
||||
## Install containerd
|
||||
sudo apt-get update && sudo apt-get install -y containerd.io
|
||||
```
|
||||
|
||||
```shell
|
||||
# Configure containerd
|
||||
sudo mkdir -p /etc/containerd
|
||||
sudo containerd config default | sudo tee /etc/containerd/config.toml
|
||||
```
|
||||
|
||||
```shell
|
||||
# Restart containerd
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
1. Install the `containerd.io` package from the official Docker repositories. Instructions for setting up the Docker repository for your respective Linux distribution and installing the `containerd.io` package can be found at [Install Docker Engine](https://docs.docker.com/engine/install/#server).
|
||||
-->
|
||||
```shell
|
||||
# (安装 containerd)
|
||||
## (设置仓库)
|
||||
### (安装软件包以允许 apt 通过 HTTPS 使用存储库)
|
||||
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
|
||||
```
|
||||
|
||||
```shell
|
||||
## 安装 Docker 的官方 GPG 密钥
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
|
||||
```
|
||||
|
||||
```shell
|
||||
## 新增 Docker apt 仓库。
|
||||
sudo add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
```
|
||||
|
||||
```shell
|
||||
## 安装 containerd
|
||||
sudo apt-get update && sudo apt-get install -y containerd.io
|
||||
```
|
||||
|
||||
```shell
|
||||
# 配置 containerd
|
||||
sudo mkdir -p /etc/containerd
|
||||
sudo containerd config default | sudo tee /etc/containerd/config.toml
|
||||
```
|
||||
|
||||
```shell
|
||||
# 重启 containerd
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
{{< /tab >}}
|
||||
{{% tab name="Ubuntu 18.04/20.04" %}}
|
||||
1. 从官方Docker仓库安装 `containerd.io` 软件包。可以在 [安装 Docker 引擎](https://docs.docker.com/engine/install/#server) 中找到有关为各自的 Linux 发行版设置 Docker 存储库和安装 `containerd.io` 软件包的说明。
|
||||
|
||||
<!--
|
||||
```shell
|
||||
# (Install containerd)
|
||||
sudo apt-get update && sudo apt-get install -y containerd
|
||||
```
|
||||
|
||||
```shell
|
||||
# Configure containerd
|
||||
sudo mkdir -p /etc/containerd
|
||||
sudo containerd config default | sudo tee /etc/containerd/config.toml
|
||||
```
|
||||
|
||||
```shell
|
||||
# Restart containerd
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
2. Configure containerd:
|
||||
-->
|
||||
```shell
|
||||
# 安装 containerd
|
||||
sudo apt-get update && sudo apt-get install -y containerd
|
||||
```
|
||||
2. 配置 containerd:
|
||||
|
||||
```shell
|
||||
# 配置 containerd
|
||||
sudo mkdir -p /etc/containerd
|
||||
sudo containerd config default | sudo tee /etc/containerd/config.toml
|
||||
```
|
||||
|
||||
```shell
|
||||
# 重启 containerd
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{% tab name="Debian 9+" %}}
|
||||
```shell
|
||||
sudo mkdir -p /etc/containerd
|
||||
containerd config default | sudo tee /etc/containerd/config.toml
|
||||
```
|
||||
|
||||
<!--
|
||||
```shell
|
||||
# (Install containerd)
|
||||
## Set up the repository
|
||||
### Install packages to allow apt to use a repository over HTTPS
|
||||
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
|
||||
```
|
||||
|
||||
```shell
|
||||
## Add Docker's official GPG key
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
|
||||
```
|
||||
|
||||
```shell
|
||||
## Add Docker apt repository.
|
||||
sudo add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
```
|
||||
3. Restart containerd:
|
||||
-->
|
||||
```shell
|
||||
# 安装 containerd
|
||||
## 配置仓库
|
||||
### 安装软件包以使 apt 能够使用 HTTPS 访问仓库
|
||||
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
|
||||
```
|
||||
3. 重新启动 containerd:
|
||||
|
||||
```shell
|
||||
## 添加 Docker 的官方 GPG 密钥
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
|
||||
```
|
||||
```shell
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
|
||||
```shell
|
||||
## 添加 Docker apt 仓库
|
||||
sudo add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
```
|
||||
|
||||
<!--
|
||||
```shell
|
||||
## Install containerd
|
||||
sudo apt-get update && sudo apt-get install -y containerd.io
|
||||
```
|
||||
|
||||
```shell
|
||||
# Set default containerd configuration
|
||||
sudo mkdir -p /etc/containerd
|
||||
containerd config default | sudo tee /etc/containerd/config.toml
|
||||
```
|
||||
|
||||
```shell
|
||||
# Restart containerd
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
-->
|
||||
```shell
|
||||
## 安装 containerd
|
||||
sudo apt-get update && sudo apt-get install -y containerd.io
|
||||
```
|
||||
|
||||
```shell
|
||||
# 设置 containerd 的默认配置
|
||||
sudo mkdir -p /etc/containerd
|
||||
containerd config default | sudo tee /etc/containerd/config.toml
|
||||
```
|
||||
|
||||
```shell
|
||||
# 重启 containerd
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS/RHEL 7.4+" %}}
|
||||
|
||||
<!--
|
||||
```shell
|
||||
# (Install containerd)
|
||||
## Set up the repository
|
||||
### Install required packages
|
||||
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
|
||||
```
|
||||
|
||||
```shell
|
||||
## Add docker repository
|
||||
sudo yum-config-manager \
|
||||
--add-repo \
|
||||
https://download.docker.com/linux/centos/docker-ce.repo
|
||||
```
|
||||
|
||||
```shell
|
||||
## Install containerd
|
||||
sudo yum update -y && sudo yum install -y containerd.io
|
||||
```
|
||||
|
||||
```shell
|
||||
## Configure containerd
|
||||
sudo mkdir -p /etc/containerd
|
||||
containerd config default | sudo tee /etc/containerd/config.toml
|
||||
```
|
||||
|
||||
```shell
|
||||
# Restart containerd
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
-->
|
||||
```shell
|
||||
# 安装 containerd
|
||||
## 设置仓库
|
||||
### 安装所需包
|
||||
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
|
||||
```
|
||||
|
||||
```shell
|
||||
### 添加 Docker 仓库
|
||||
sudo yum-config-manager \
|
||||
--add-repo \
|
||||
https://download.docker.com/linux/centos/docker-ce.repo
|
||||
```
|
||||
|
||||
```shell
|
||||
## 安装 containerd
|
||||
sudo yum update -y && sudo yum install -y containerd.io
|
||||
```
|
||||
|
||||
```shell
|
||||
# 配置 containerd
|
||||
sudo mkdir -p /etc/containerd
|
||||
containerd config default | sudo tee /etc/containerd/config.toml
|
||||
```
|
||||
|
||||
```shell
|
||||
# 重启 containerd
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{% tab name="Windows (PowerShell)" %}}
|
||||
<!--
|
||||
```powershell
|
||||
# (Install containerd)
|
||||
# download containerd
|
||||
cmd /c curl -OL https://github.com/containerd/containerd/releases/download/v1.4.1/containerd-1.4.1-windows-amd64.tar.gz
|
||||
cmd /c tar xvf .\containerd-1.4.1-windows-amd64.tar.gz
|
||||
```
|
||||
<!--
|
||||
Start a Powershell session, set `$Version` to the desired version (ex: `$Version=1.4.3`), and then run the following commands:
|
||||
-->
|
||||
启动 Powershell 会话,将 `$Version` 设置为所需的版本(例如:`$ Version=1.4.3`),然后运行以下命令:
|
||||
|
||||
```powershell
|
||||
# extract and configure
|
||||
Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force
|
||||
cd $Env:ProgramFiles\containerd\
|
||||
.\containerd.exe config default | Out-File config.toml -Encoding ascii
|
||||
<!--
|
||||
1. Download containerd:
|
||||
-->
|
||||
1. 下载 containerd:
|
||||
|
||||
# review the configuration. depending on setup you may want to adjust:
|
||||
# - the sandbox_image (kubernetes pause image)
|
||||
# - cni bin_dir and conf_dir locations
|
||||
Get-Content config.toml
|
||||
```
|
||||
```powershell
|
||||
curl.exe -L https://github.com/containerd/containerd/releases/download/v$Version/containerd-$Version-windows-amd64.tar.gz -o containerd-windows-amd64.tar.gz
|
||||
tar.exe xvf .\containerd-windows-amd64.tar.gz
|
||||
```
|
||||
<!--
|
||||
2. Extract and configure:
|
||||
-->
|
||||
2. 提取并配置:
|
||||
|
||||
```powershell
|
||||
# start containerd
|
||||
.\containerd.exe --register-service
|
||||
Start-Service containerd
|
||||
```
|
||||
-->
|
||||
```powershell
|
||||
# 安装 containerd
|
||||
# 下载 containerd
|
||||
cmd /c curl -OL https://github.com/containerd/containerd/releases/download/v1.4.1/containerd-1.4.1-windows-amd64.tar.gz
|
||||
cmd /c tar xvf .\containerd-1.4.1-windows-amd64.tar.gz
|
||||
```
|
||||
```powershell
|
||||
Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force
|
||||
cd $Env:ProgramFiles\containerd\
|
||||
.\containerd.exe config default | Out-File config.toml -Encoding ascii
|
||||
|
||||
```powershell
|
||||
# 解压并配置
|
||||
Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force
|
||||
cd $Env:ProgramFiles\containerd\
|
||||
.\containerd.exe config default | Out-File config.toml -Encoding ascii
|
||||
# Review the configuration. Depending on setup you may want to adjust:
|
||||
# - the sandbox_image (Kubernetes pause image)
|
||||
# - cni bin_dir and conf_dir locations
|
||||
Get-Content config.toml
|
||||
|
||||
# 检查配置文件,基于你可能想要调整的设置:
|
||||
# - sandbox_image (kubernetes pause 镜像)
|
||||
# - CNI 的 bin_dir 和 conf_dir 路径
|
||||
Get-Content config.toml
|
||||
```
|
||||
# (Optional - but highly recommended) Exclude containerd from Windows Defender Scans
|
||||
Add-MpPreference -ExclusionProcess "$Env:ProgramFiles\containerd\containerd.exe"
|
||||
```
|
||||
<!--
|
||||
3. Start containerd:
|
||||
-->
|
||||
|
||||
3. 启动 containerd:
|
||||
|
||||
```powershell
|
||||
.\containerd.exe --register-service
|
||||
Start-Service containerd
|
||||
```
|
||||
|
||||
```powershell
|
||||
# 启动 containerd
|
||||
.\containerd.exe --register-service
|
||||
Start-Service containerd
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
|
||||
#### systemd {#containerd-systemd}
|
||||
<!--
|
||||
#### Using the `systemd` cgroup driver {#containerd-systemd}
|
||||
-->
|
||||
|
||||
#### 使用 `systemd` cgroup 驱动程序 {#containerd-systemd}
|
||||
|
||||
<!--
|
||||
To use the `systemd` cgroup driver in `/etc/containerd/config.toml` with `runc`, set
|
||||
@@ -480,10 +255,8 @@ To use the `systemd` cgroup driver in `/etc/containerd/config.toml` with `runc`,
|
||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
||||
SystemdCgroup = true
|
||||
```
|
||||
|
||||
When using kubeadm, manually configure the
|
||||
[cgroup driver for kubelet](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node).
|
||||
-->
|
||||
|
||||
结合 `runc` 使用 `systemd` cgroup 驱动,在 `/etc/containerd/config.toml` 中设置
|
||||
|
||||
```
|
||||
@@ -493,6 +266,19 @@ When using kubeadm, manually configure the
|
||||
SystemdCgroup = true
|
||||
```
|
||||
|
||||
<!--
|
||||
If you apply this change make sure to restart containerd again:
|
||||
-->
|
||||
如果您应用此更改,请确保再次重新启动 containerd:
|
||||
|
||||
```shell
|
||||
sudo systemctl restart containerd
|
||||
```
|
||||
|
||||
<!--
|
||||
When using kubeadm, manually configure the
|
||||
[cgroup driver for kubelet](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node).
|
||||
-->
|
||||
当使用 kubeadm 时,请手动配置
|
||||
[kubelet 的 cgroup 驱动](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node).
|
||||
|
||||
@@ -505,7 +291,7 @@ Use the following commands to install CRI-O on your system:
|
||||
|
||||
{{< note >}}
|
||||
The CRI-O major and minor versions must match the Kubernetes major and minor versions.
|
||||
For more information, see the [CRI-O compatibility matrix](https://github.com/cri-o/cri-o).
|
||||
For more information, see the [CRI-O compatibility matrix](https://github.com/cri-o/cri-o#compatibility-matrix-cri-o--kubernetes).
|
||||
{{< /note >}}
|
||||
|
||||
Install and configure prerequisites:
|
||||
@@ -536,7 +322,7 @@ sudo sysctl --system
|
||||
使用以下命令在系统中安装 CRI-O:
|
||||
|
||||
提示:CRI-O 的主要以及次要版本必须与 Kubernetes 的主要和次要版本相匹配。
|
||||
更多信息请查阅 [CRI-O 兼容性列表](https://github.com/cri-o/cri-o).
|
||||
更多信息请查阅 [CRI-O 兼容性列表](https://github.com/cri-o/cri-o#compatibility-matrix-cri-o--kubernetes)。
|
||||
|
||||
安装以及配置的先决条件:
|
||||
|
||||
@@ -569,31 +355,31 @@ To install CRI-O on the following operating systems, set the environment variabl
|
||||
to the appropriate value from the following table:
|
||||
|
||||
| Operating system | `$OS` |
|
||||
|------------------|-------------------|
|
||||
| ---------------- | ----------------- |
|
||||
| Debian Unstable | `Debian_Unstable` |
|
||||
| Debian Testing | `Debian_Testing` |
|
||||
|
||||
<br />
|
||||
Then, set `$VERSION` to the CRI-O version that matches your Kubernetes version.
|
||||
For instance, if you want to install CRI-O 1.18, set `VERSION=1.18`.
|
||||
For instance, if you want to install CRI-O 1.20, set `VERSION=1.20`.
|
||||
You can pin your installation to a specific release.
|
||||
To install version 1.18.3, set `VERSION=1.18:1.18.3`.
|
||||
To install version 1.20.0, set `VERSION=1.20:1.20.0`.
|
||||
<br />
|
||||
|
||||
Then run
|
||||
-->
|
||||
在下列操作系统上安装 CRI-O, 使用下表中合适的值设置环境变量 `OS`:
|
||||
|
||||
| 操作系统 | `$OS` |
|
||||
|-----------------|-------------------|
|
||||
| Debian Unstable | `Debian_Unstable` |
|
||||
| Debian Testing | `Debian_Testing` |
|
||||
| 操作系统 | `$OS` |
|
||||
| ---------------- | ----------------- |
|
||||
| Debian Unstable | `Debian_Unstable` |
|
||||
| Debian Testing | `Debian_Testing` |
|
||||
|
||||
<br />
|
||||
然后,将 `$VERSION` 设置为与你的 Kubernetes 相匹配的 CRI-O 版本。
|
||||
例如,如果你要安装 CRI-O 1.18, 请设置 `VERSION=1.18`.
|
||||
例如,如果你要安装 CRI-O 1.20, 请设置 `VERSION=1.20`.
|
||||
你也可以安装一个特定的发行版本。
|
||||
例如要安装 1.18.3 版本,设置 `VERSION=1.18:1.18.3`.
|
||||
例如要安装 1.20.0 版本,设置 `VERSION=1.20.0:1.20.0`.
|
||||
<br />
|
||||
|
||||
然后执行
|
||||
@@ -605,8 +391,8 @@ cat <<EOF | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cr
|
||||
deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/ /
|
||||
EOF
|
||||
|
||||
curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg -
|
||||
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg -
|
||||
curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add -
|
||||
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add -
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install cri-o cri-o-runc
|
||||
@@ -619,36 +405,36 @@ sudo apt-get install cri-o cri-o-runc
|
||||
<!--
|
||||
To install on the following operating systems, set the environment variable `OS` to the appropriate field in the following table:
|
||||
|
||||
| Operating system | `$OS` |
|
||||
|------------------|-----------------|
|
||||
| Ubuntu 20.04 | `xUbuntu_20.04` |
|
||||
| Ubuntu 19.10 | `xUbuntu_19.10` |
|
||||
| Ubuntu 19.04 | `xUbuntu_19.04` |
|
||||
| Ubuntu 18.04 | `xUbuntu_18.04` |
|
||||
| Operating system | `$OS` |
|
||||
| ---------------- | ----------------- |
|
||||
| Ubuntu 20.04 | `xUbuntu_20.04` |
|
||||
| Ubuntu 19.10 | `xUbuntu_19.10` |
|
||||
| Ubuntu 19.04 | `xUbuntu_19.04` |
|
||||
| Ubuntu 18.04 | `xUbuntu_18.04` |
|
||||
|
||||
<br />
|
||||
Then, set `$VERSION` to the CRI-O version that matches your Kubernetes version.
|
||||
For instance, if you want to install CRI-O 1.18, set `VERSION=1.18`.
|
||||
For instance, if you want to install CRI-O 1.20, set `VERSION=1.20`.
|
||||
You can pin your installation to a specific release.
|
||||
To install version 1.18.3, set `VERSION=1.18:1.18.3`.
|
||||
To install version 1.20.0, set `VERSION=1.20:1.20.0`.
|
||||
<br />
|
||||
|
||||
Then run
|
||||
-->
|
||||
在下列操作系统上安装 CRI-O, 使用下表中合适的值设置环境变量 `OS`:
|
||||
|
||||
| 操作系统 | `$OS` |
|
||||
|--------------|-----------------|
|
||||
| Ubuntu 20.04 | `xUbuntu_20.04` |
|
||||
| Ubuntu 19.10 | `xUbuntu_19.10` |
|
||||
| Ubuntu 19.04 | `xUbuntu_19.04` |
|
||||
| Ubuntu 18.04 | `xUbuntu_18.04` |
|
||||
| 操作系统 | `$OS` |
|
||||
| ---------------- | ----------------- |
|
||||
| Ubuntu 20.04 | `xUbuntu_20.04` |
|
||||
| Ubuntu 19.10 | `xUbuntu_19.10` |
|
||||
| Ubuntu 19.04 | `xUbuntu_19.04` |
|
||||
| Ubuntu 18.04 | `xUbuntu_18.04` |
|
||||
|
||||
<br />
|
||||
然后,将 `$VERSION` 设置为与你的 Kubernetes 相匹配的 CRI-O 版本。
|
||||
例如,如果你要安装 CRI-O 1.18, 请设置 `VERSION=1.18`.
|
||||
例如,如果你要安装 CRI-O 1.20, 请设置 `VERSION=1.20`.
|
||||
你也可以安装一个特定的发行版本。
|
||||
例如要安装 1.18.3 版本,设置 `VERSION=1.18:1.18.3`.
|
||||
例如要安装 1.20.0 版本,设置 `VERSION=1.20:1.20.0`.
|
||||
<br />
|
||||
|
||||
然后执行
|
||||
@@ -661,8 +447,8 @@ cat <<EOF | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cr
|
||||
deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/ /
|
||||
EOF
|
||||
|
||||
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg
|
||||
curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/libcontainers-cri-o.gpg -
|
||||
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add -
|
||||
curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers-cri-o.gpg add -
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install cri-o cri-o-runc
|
||||
@@ -676,33 +462,33 @@ sudo apt-get install cri-o cri-o-runc
|
||||
To install on the following operating systems, set the environment variable `OS` to the appropriate field in the following table:
|
||||
|
||||
| Operating system | `$OS` |
|
||||
|------------------|-------------------|
|
||||
| ---------------- | ----------------- |
|
||||
| Centos 8 | `CentOS_8` |
|
||||
| Centos 8 Stream | `CentOS_8_Stream` |
|
||||
| Centos 7 | `CentOS_7` |
|
||||
|
||||
<br />
|
||||
Then, set `$VERSION` to the CRI-O version that matches your Kubernetes version.
|
||||
For instance, if you want to install CRI-O 1.18, set `VERSION=1.18`.
|
||||
For instance, if you want to install CRI-O 1.20, set `VERSION=1.20`.
|
||||
You can pin your installation to a specific release.
|
||||
To install version 1.18.3, set `VERSION=1.18:1.18.3`.
|
||||
To install version 1.20.0, set `VERSION=1.20:1.20.0`.
|
||||
<br />
|
||||
|
||||
Then run
|
||||
-->
|
||||
在下列操作系统上安装 CRI-O, 使用下表中合适的值设置环境变量 `OS`:
|
||||
|
||||
| 操作系统 | `$OS` |
|
||||
|-----------------|-------------------|
|
||||
| Centos 8 | `CentOS_8` |
|
||||
| Centos 8 Stream | `CentOS_8_Stream` |
|
||||
| Centos 7 | `CentOS_7` |
|
||||
| 操作系统 | `$OS` |
|
||||
| ---------------- | ----------------- |
|
||||
| Centos 8 | `CentOS_8` |
|
||||
| Centos 8 Stream | `CentOS_8_Stream` |
|
||||
| Centos 7 | `CentOS_7` |
|
||||
|
||||
<br />
|
||||
然后,将 `$VERSION` 设置为与你的 Kubernetes 相匹配的 CRI-O 版本。
|
||||
例如,如果你要安装 CRI-O 1.18, 请设置 `VERSION=1.18`.
|
||||
例如,如果你要安装 CRI-O 1.20, 请设置 `VERSION=1.20`.
|
||||
你也可以安装一个特定的发行版本。
|
||||
例如要安装 1.18.3 版本,设置 `VERSION=1.18:1.18.3`.
|
||||
例如要安装 1.20.0 版本,设置 `VERSION=1.20:1.20.0`.
|
||||
<br />
|
||||
|
||||
然后执行
|
||||
@@ -725,7 +511,7 @@ sudo zypper install cri-o
|
||||
|
||||
<!--
|
||||
Set `$VERSION` to the CRI-O version that matches your Kubernetes version.
|
||||
For instance, if you want to install CRI-O 1.18, `VERSION=1.18`.
|
||||
For instance, if you want to install CRI-O 1.20, `VERSION=1.20`.
|
||||
|
||||
You can find available versions with:
|
||||
```shell
|
||||
@@ -740,7 +526,7 @@ sudo dnf install cri-o
|
||||
```
|
||||
-->
|
||||
将 `$VERSION` 设置为与你的 Kubernetes 相匹配的 CRI-O 版本。
|
||||
例如,如果要安装 CRI-O 1.18,请设置 `VERSION=1.18`。
|
||||
例如,如果要安装 CRI-O 1.20,请设置 `VERSION=1.20`。
|
||||
你可以用下列命令查找可用的版本:
|
||||
|
||||
```shell
|
||||
@@ -751,7 +537,7 @@ CRI-O 不支持在 Fedora 上固定到特定的版本。
|
||||
然后执行
|
||||
```shell
|
||||
sudo dnf module enable cri-o:$VERSION
|
||||
sudo dnf install cri-o
|
||||
sudo dnf install cri-o --now
|
||||
```
|
||||
|
||||
{{% /tab %}}
|
||||
@@ -762,272 +548,90 @@ Start CRI-O:
|
||||
|
||||
```shell
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl start crio
|
||||
sudo systemctl enable crio --no
|
||||
```
|
||||
|
||||
Refer to the [CRI-O installation guide](https://github.com/kubernetes-sigs/cri-o#getting-started)
|
||||
Refer to the [CRI-O installation guide](https://github.com/cri-o/cri-o/blob/master/install.md)
|
||||
for more information.
|
||||
-->
|
||||
启动 CRI-O:
|
||||
#### cgroup driver
|
||||
<!--
|
||||
CRI-O uses the systemd cgroup driver per default. To switch to the `cgroupfs`
|
||||
cgroup driver, either edit `/etc/crio/crio.conf` or place a drop-in
|
||||
configuration in `/etc/crio/crio.conf.d/02-cgroup-manager.conf`, for example:
|
||||
-->
|
||||
默认情况下,CRI-O 使用 systemd cgroup 驱动程序。切换到`
|
||||
`cgroupfs`
|
||||
cgroup 驱动程序,或者编辑 `/ etc / crio / crio.conf` 或放置一个插件
|
||||
在 `/etc/crio/crio.conf.d/02-cgroup-manager.conf` 中的配置,例如:
|
||||
|
||||
```shell
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl start crio
|
||||
```toml
|
||||
[crio.runtime]
|
||||
conmon_cgroup = "pod"
|
||||
cgroup_manager = "cgroupfs"
|
||||
```
|
||||
|
||||
更多信息请参阅 [CRI-O 安装指南](https://github.com/kubernetes-sigs/cri-o#getting-started)。
|
||||
<!--
|
||||
Please also note the changed `conmon_cgroup`, which has to be set to the value
|
||||
`pod` when using CRI-O with `cgroupfs`. It is generally necessary to keep the
|
||||
cgroup driver configuration of the kubelet (usually done via kubeadm) and CRI-O
|
||||
in sync.
|
||||
-->
|
||||
另请注意更改后的 `conmon_cgroup` ,必须将其设置为
|
||||
`pod`将 CRI-O 与 `cgroupfs` 一起使用时。通常有必要保持
|
||||
kubelet 的 cgroup 驱动程序配置(通常透过 kubeadm 完成)和CRI-O 同步中。
|
||||
|
||||
### Docker
|
||||
|
||||
<!--
|
||||
On each of your nodes, install Docker CE.
|
||||
|
||||
The Kubernetes release notes list which versions of Docker are compatible
|
||||
with that version of Kubernetes.
|
||||
|
||||
Use the following commands to install Docker on your system:
|
||||
<!--
|
||||
1. On each of your nodes, install the Docker for your Linux distribution as per [Install Docker Engine](https://docs.docker.com/engine/install/#server). You can find the latest validated version of Docker in this [dependencies](https://git.k8s.io/kubernetes/build/dependencies.yaml) file.
|
||||
-->
|
||||
在你的所有节点上安装 Docker CE.
|
||||
|
||||
Kubernetes 发布说明中列出了 Docker 的哪些版本与该版本的 Kubernetes 相兼容。
|
||||
|
||||
在你的操作系统上使用如下命令安装 Docker:
|
||||
|
||||
{{< tabs name="tab-cri-docker-installation" >}}
|
||||
{{% tab name="Ubuntu 16.04+" %}}
|
||||
1. 在每个节点上,根据[安装 Docker 引擎](https://docs.docker.com/engine/install/#server) 为你的 Linux 发行版安装 Docker。
|
||||
你可以在此文件中找到最新的经过验证的 Docker 版本[依赖关系](https://git.k8s.io/kubernetes/build/dependencies.yaml)。
|
||||
|
||||
<!--
|
||||
```shell
|
||||
# (Install Docker CE)
|
||||
## Set up the repository:
|
||||
### Install packages to allow apt to use a repository over HTTPS
|
||||
sudo apt-get update && sudo apt-get install -y \
|
||||
apt-transport-https ca-certificates curl software-properties-common gnupg2
|
||||
```
|
||||
2. Configure the Docker daemon, in particular to use systemd for the management of the container’s cgroups.
|
||||
-->
|
||||
2. 配置 Docker 守护程序,尤其是使用 systemd 来管理容器的cgroup。
|
||||
|
||||
```shell
|
||||
# Add Docker's official GPG key:
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/docker.gpg -
|
||||
```
|
||||
-->
|
||||
|
||||
```shell
|
||||
# (安装 Docker CE)
|
||||
## 设置仓库:
|
||||
### 安装软件包以允许 apt 通过 HTTPS 使用存储库
|
||||
sudo apt-get update && sudo apt-get install -y \
|
||||
apt-transport-https ca-certificates curl software-properties-common gnupg2
|
||||
```
|
||||
|
||||
```shell
|
||||
### 新增 Docker 的 官方 GPG 秘钥:
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/docker.gpg -
|
||||
```
|
||||
```shell
|
||||
sudo mkdir /etc/docker
|
||||
cat <<EOF | sudo tee /etc/docker/daemon.json
|
||||
{
|
||||
"exec-opts": ["native.cgroupdriver=systemd"],
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "100m"
|
||||
},
|
||||
"storage-driver": "overlay2"
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
<!--
|
||||
`overlay2` is the preferred storage driver for systems running Linux kernel version 4.0 or higher, or RHEL or CentOS using version 3.10.0-514 and above.
|
||||
-->
|
||||
|
||||
对于运行 Linux 内核版本 4.0 或更高版本,或使用 3.10.0-51 及更高版本的 RHEL 或 CentOS 的系统,`overlay2`是首选的存储驱动程序。
|
||||
{{< /note >}}
|
||||
<!--
|
||||
```shell
|
||||
# Add the Docker apt repository:
|
||||
sudo add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
```
|
||||
|
||||
```shell
|
||||
# Install Docker CE
|
||||
sudo apt-get update && sudo apt-get install -y \
|
||||
containerd.io=1.2.13-2 \
|
||||
docker-ce=5:19.03.11~3-0~ubuntu-$(lsb_release -cs) \
|
||||
docker-ce-cli=5:19.03.11~3-0~ubuntu-$(lsb_release -cs)
|
||||
```
|
||||
|
||||
```shell
|
||||
# Set up the Docker daemon
|
||||
cat <<EOF | sudo tee /etc/docker/daemon.json
|
||||
{
|
||||
"exec-opts": ["native.cgroupdriver=systemd"],
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "100m"
|
||||
},
|
||||
"storage-driver": "overlay2"
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
```shell
|
||||
# Create /etc/systemd/system/docker.service.d
|
||||
sudo mkdir -p /etc/systemd/system/docker.service.d
|
||||
```
|
||||
3. Restart Docker and enable on boot:
|
||||
-->
|
||||
```shell
|
||||
### 添加 Docker apt 仓库:
|
||||
sudo add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
```
|
||||
3. 重新启动 Docker 并在启动时启用:
|
||||
```shell
|
||||
sudo systemctl enable docker
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
```shell
|
||||
## 安装 Docker CE
|
||||
sudo apt-get update && sudo apt-get install -y \
|
||||
containerd.io=1.2.13-2 \
|
||||
docker-ce=5:19.03.11~3-0~ubuntu-$(lsb_release -cs) \
|
||||
docker-ce-cli=5:19.03.11~3-0~ubuntu-$(lsb_release -cs)
|
||||
```
|
||||
|
||||
```shell
|
||||
# 设置 Docker daemon
|
||||
cat <<EOF | sudo tee /etc/docker/daemon.json
|
||||
{
|
||||
"exec-opts": ["native.cgroupdriver=systemd"],
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "100m"
|
||||
},
|
||||
"storage-driver": "overlay2"
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
```shell
|
||||
# Create /etc/systemd/system/docker.service.d
|
||||
sudo mkdir -p /etc/systemd/system/docker.service.d
|
||||
```
|
||||
{{< note >}}
|
||||
<!--
|
||||
# Restart docker.
|
||||
systemctl daemon-reload
|
||||
systemctl restart docker
|
||||
For more information refer to
|
||||
- [Configure the Docker daemon](https://docs.docker.com/config/daemon/)
|
||||
- [Control Docker with systemd](https://docs.docker.com/config/daemon/systemd/)
|
||||
-->
|
||||
```shell
|
||||
# 重启 docker.
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{% tab name="CentOS/RHEL 7.4+" %}}
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
```shell
|
||||
# (Install Docker CE)
|
||||
## Set up the repository
|
||||
### Install required packages
|
||||
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
|
||||
```
|
||||
|
||||
```shell
|
||||
## Add the Docker repository
|
||||
sudo yum-config-manager --add-repo \
|
||||
https://download.docker.com/linux/centos/docker-ce.repo
|
||||
```
|
||||
|
||||
```shell
|
||||
# Install Docker CE
|
||||
sudo yum update -y && sudo yum install -y \
|
||||
containerd.io-1.2.13 \
|
||||
docker-ce-19.03.11 \
|
||||
docker-ce-cli-19.03.11
|
||||
```
|
||||
|
||||
```shell
|
||||
## Create /etc/docker
|
||||
sudo mkdir /etc/docker
|
||||
```
|
||||
|
||||
```shell
|
||||
# Set up the Docker daemon
|
||||
cat <<EOF | sudo tee /etc/docker/daemon.json
|
||||
{
|
||||
"exec-opts": ["native.cgroupdriver=systemd"],
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "100m"
|
||||
},
|
||||
"storage-driver": "overlay2",
|
||||
"storage-opts": [
|
||||
"overlay2.override_kernel_check=true"
|
||||
]
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
```shell
|
||||
# Create /etc/systemd/system/docker.service.d
|
||||
sudo mkdir -p /etc/systemd/system/docker.service.d
|
||||
```
|
||||
-->
|
||||
```shell
|
||||
# (安装 Docker CE)
|
||||
## 设置仓库
|
||||
### 安装所需包
|
||||
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
|
||||
```
|
||||
|
||||
```shell
|
||||
### 新增 Docker 仓库
|
||||
sudo yum-config-manager --add-repo \
|
||||
https://download.docker.com/linux/centos/docker-ce.repo
|
||||
```
|
||||
|
||||
```shell
|
||||
## 安装 Docker CE
|
||||
sudo yum update -y && sudo yum install -y \
|
||||
containerd.io-1.2.13 \
|
||||
docker-ce-19.03.11 \
|
||||
docker-ce-cli-19.03.11
|
||||
```
|
||||
|
||||
```shell
|
||||
## 创建 /etc/docker 目录
|
||||
sudo mkdir /etc/docker
|
||||
```
|
||||
|
||||
```shell
|
||||
# 设置 Docker daemon
|
||||
cat <<EOF | sudo tee /etc/docker/daemon.json
|
||||
{
|
||||
"exec-opts": ["native.cgroupdriver=systemd"],
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "100m"
|
||||
},
|
||||
"storage-driver": "overlay2",
|
||||
"storage-opts": [
|
||||
"overlay2.override_kernel_check=true"
|
||||
]
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
```shell
|
||||
# Create /etc/systemd/system/docker.service.d
|
||||
sudo mkdir -p /etc/systemd/system/docker.service.d
|
||||
```
|
||||
<!--
|
||||
# Restart Docker
|
||||
systemctl daemon-reload
|
||||
systemctl restart docker
|
||||
-->
|
||||
```shell
|
||||
# 重启 Docker
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
{{% /tab %}}
|
||||
{{% /tabs %}}
|
||||
|
||||
<!--
|
||||
If you want the `docker` service to start on boot, run the following command:
|
||||
-->
|
||||
如果你想开机即启动 `docker` 服务,执行以下命令:
|
||||
|
||||
```shell
|
||||
sudo systemctl enable docker
|
||||
```
|
||||
|
||||
<!--
|
||||
Refer to the [official Docker installation guides](https://docs.docker.com/engine/installation/)
|
||||
for more information.
|
||||
-->
|
||||
请参阅[官方 Docker 安装指南](https://docs.docker.com/engine/installation/)
|
||||
获取更多的信息。
|
||||
有关更多信息,请参阅
|
||||
- [配置 Docker 守护程序](https://docs.docker.com/config/daemon/)
|
||||
- [使用 systemd 控制 Docker](https://docs.docker.com/config/daemon/systemd/)
|
||||
|
||||
@@ -43,11 +43,11 @@ dynamic provisioning of storage.
|
||||
如果是这样的话,你可以改变默认 StorageClass,或者完全禁用它以防止动态配置存储。
|
||||
|
||||
<!--
|
||||
Simply deleting the default StorageClass may not work, as it may be re-created
|
||||
Deleting the default StorageClass may not work, as it may be re-created
|
||||
automatically by the addon manager running in your cluster. Please consult the docs for your installation
|
||||
for details about addon manager and how to disable individual addons.
|
||||
-->
|
||||
简单的删除默认 StorageClass 可能行不通,因为它可能会被你集群中的扩展管理器自动重建。
|
||||
删除默认 StorageClass 可能行不通,因为它可能会被你集群中的扩展管理器自动重建。
|
||||
请查阅你的安装文档中关于扩展管理器的细节,以及如何禁用单个扩展。
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ for details about addon manager and how to disable individual addons.
|
||||
3. 标记一个 StorageClass 为默认的:
|
||||
|
||||
<!--
|
||||
Similarly to the previous step, you need to add/set the annotation
|
||||
Similar to the previous step, you need to add/set the annotation
|
||||
`storageclass.kubernetes.io/is-default-class=true`.
|
||||
-->
|
||||
和前面的步骤类似,你需要添加/设置注解 `storageclass.kubernetes.io/is-default-class=true`。
|
||||
|
||||
@@ -33,8 +33,6 @@ explains how to use `kubeadm` to migrate from `kube-dns`.
|
||||
文档[迁移到 CoreDNS](/zh/docs/tasks/administer-cluster/coredns/#migrating-to-coredns)
|
||||
解释了如何使用 `kubeadm` 从 `kube-dns` 迁移到 CoreDNS。
|
||||
|
||||
{{% version-check %}}
|
||||
|
||||
<!-- steps -->
|
||||
|
||||
<!--
|
||||
|
||||
@@ -324,69 +324,14 @@ controllerManager:
|
||||
|
||||
<!--
|
||||
### Create certificate signing requests (CSR)
|
||||
|
||||
You can create the certificate signing requests for the Kubernetes certificates API with `kubeadm alpha certs renew --use-api`.
|
||||
-->
|
||||
### 创建证书签名请求 (CSR)
|
||||
|
||||
你可以用 `kubeadm alpha certs renew --use-api` 为 Kubernetes 证书 API 创建一个证书签名请求。
|
||||
|
||||
<!--
|
||||
If you set up an external signer such as [cert-manager](https://github.com/jetstack/cert-manager), certificate signing requests (CSRs) are automatically approved.
|
||||
Otherwise, you must manually approve certificates with the [`kubectl certificate`](/docs/setup/best-practices/certificates/) command.
|
||||
The following kubeadm command outputs the name of the certificate to approve, then blocks and waits for approval to occur:
|
||||
See [Create CertificateSigningRequest](/docs/reference/access-authn-authz/certificate-signing-requests/#create-certificatesigningrequest) for creating CSRs with the Kubernetes API.
|
||||
-->
|
||||
如果你设置例如 [cert-manager](https://github.com/jetstack/cert-manager)
|
||||
等外部签名者,证书签名请求(CSRs)会被自动批准。
|
||||
否则,你必须使用 [`kubectl certificate`](/zh/docs/setup/best-practices/certificates/)
|
||||
命令手动批准证书。
|
||||
以下 kubeadm 命令输出要批准的证书名称,然后阻塞等待批准发生:
|
||||
|
||||
```shell
|
||||
sudo kubeadm alpha certs renew apiserver --use-api &
|
||||
```
|
||||
|
||||
<!--
|
||||
The output is similar to this:
|
||||
-->
|
||||
输出类似于以下内容:
|
||||
```
|
||||
[1] 2890
|
||||
[certs] certificate request "kubeadm-cert-kube-apiserver-ld526" created
|
||||
```
|
||||
|
||||
<!--
|
||||
### Approve certificate signing requests (CSR)
|
||||
|
||||
If you set up an external signer, certificate signing requests (CSRs) are automatically approved.
|
||||
|
||||
Otherwise, you must manually approve certificates with the [`kubectl certificate`](/docs/setup/best-practices/certificates/) command. e.g.
|
||||
-->
|
||||
|
||||
### 批准证书签名请求 (CSR)
|
||||
|
||||
如果你设置了一个外部签名者, 证书签名请求 (CSRs) 会自动被批准。
|
||||
|
||||
否则,你必须用 [`kubectl certificate`](/zh/docs/setup/best-practices/certificates/)
|
||||
命令手动批准证书,例如:
|
||||
|
||||
```shell
|
||||
kubectl certificate approve kubeadm-cert-kube-apiserver-ld526
|
||||
```
|
||||
|
||||
<!--
|
||||
The output is similar to this:
|
||||
-->
|
||||
输出类似于以下内容:
|
||||
|
||||
```
|
||||
certificatesigningrequest.certificates.k8s.io/kubeadm-cert-kube-apiserver-ld526 approved
|
||||
```
|
||||
|
||||
<!--
|
||||
You can view a list of pending certificates with `kubectl get csr`.
|
||||
-->
|
||||
你可以使用 `kubectl get csr` 查看待处理证书列表。
|
||||
有关使用 Kubernetes API 创建 CSR 的信息,
|
||||
请参见[创建 CertificateSigningRequest](/zh/docs/reference/access-authn-authz/certificate-signing-requests/#create-certificatesigningrequest)。
|
||||
|
||||
<!--
|
||||
## Renew certificates with external CA
|
||||
|
||||
@@ -74,13 +74,13 @@ The upgrade workflow at high level is the following:
|
||||
<!--
|
||||
### Additional information
|
||||
|
||||
- [Draining nodes](https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/) before kubelet MINOR version
|
||||
- [Draining nodes](/docs/tasks/administer-cluster/safely-drain-node/) before kubelet MINOR version
|
||||
upgrades is required. In the case of control plane nodes, they could be running CoreDNS Pods or other critical workloads.
|
||||
- All containers are restarted after upgrade, because the container spec hash value is changed.
|
||||
-->
|
||||
### 附加信息
|
||||
|
||||
- 在对 kubelet 作次版本升级时需要[腾空节点](/zh/docs/tasks/administer-cluster/safely-drain-node/)。
|
||||
- 在对 kubelet 作次版本升版时需要[腾空节点](/zh/docs/tasks/administer-cluster/safely-drain-node/)。
|
||||
对于控制面节点,其上可能运行着 CoreDNS Pods 或者其它非常重要的负载。
|
||||
- 升级后,因为容器规约的哈希值已更改,所有容器都会被重新启动。
|
||||
|
||||
|
||||
@@ -173,11 +173,13 @@ kubectl get secret db-user-pass -o jsonpath='{.data}'
|
||||
输出类似于:
|
||||
|
||||
```json
|
||||
{"password.txt":"MWYyZDFlMmU2N2Rm","username.txt":"YWRtaW4="}
|
||||
{"password":"MWYyZDFlMmU2N2Rm","username":"YWRtaW4="}
|
||||
```
|
||||
|
||||
<!-- Now you can decode the `password.txt` data: -->
|
||||
现在你可以解码 `password.txt` 的数据:
|
||||
<!--
|
||||
Now you can decode the `password` data:
|
||||
-->
|
||||
现在你可以解码 `password` 的数据:
|
||||
|
||||
```shell
|
||||
echo 'MWYyZDFlMmU2N2Rm' | base64 --decode
|
||||
|
||||
@@ -55,6 +55,7 @@ on general patterns for running stateful applications in Kubernetes.
|
||||
[ConfigMaps](/docs/tasks/configure-pod-container/configure-pod-configmap/).
|
||||
* Some familiarity with MySQL helps, but this tutorial aims to present
|
||||
general patterns that should be useful for other systems.
|
||||
* You are using the default namespace or another namespace that does not contain any conflicting objects.
|
||||
-->
|
||||
* 本教程假定你熟悉
|
||||
[PersistentVolumes](/zh/docs/concepts/storage/persistent-volumes/)
|
||||
@@ -63,6 +64,7 @@ on general patterns for running stateful applications in Kubernetes.
|
||||
[服务](/zh/docs/concepts/services-networking/service/) 与
|
||||
[ConfigMap](/zh/docs/tasks/configure-pod-container/configure-pod-configmap/).
|
||||
* 熟悉 MySQL 会有所帮助,但是本教程旨在介绍对其他系统应该有用的常规模式。
|
||||
* 您正在使用默认命名空间或不包含任何冲突对象的另一个命名空间。
|
||||
|
||||
## {{% heading "objectives" %}}
|
||||
|
||||
@@ -280,21 +282,20 @@ properties.
|
||||
The script in the `init-mysql` container also applies either `primary.cnf` or
|
||||
`replica.cnf` from the ConfigMap by copying the contents into `conf.d`.
|
||||
Because the example topology consists of a single primary MySQL server and any number of
|
||||
replicas, the script simply assigns ordinal `0` to be the primary server, and everyone
|
||||
replicas, the script assigns ordinal `0` to be the primary server, and everyone
|
||||
else to be replicas.
|
||||
|
||||
Combined with the StatefulSet controller's
|
||||
[deployment order guarantee](/docs/concepts/workloads/controllers/statefulset/#deployment-and-scaling-guarantees/),
|
||||
[deployment order guarantee](/docs/concepts/workloads/controllers/statefulset/#deployment-and-scaling-guarantees),
|
||||
this ensures the primary MySQL server is Ready before creating replicas, so they can begin
|
||||
replicating.
|
||||
-->
|
||||
通过将内容复制到 conf.d 中,`init-mysql` 容器中的脚本也可以应用 ConfigMap 中的
|
||||
`primary.cnf` 或 `replica.cnf`。
|
||||
由于示例部署结构由单个 MySQL 主节点和任意数量的副本节点组成,因此脚本仅将序数
|
||||
`0` 指定为主节点,而将其他所有节点指定为副本节点。
|
||||
通过将内容复制到 conf.d 中,`init-mysql` 容器中的脚本也可以应用 ConfigMap 中的 `primary.cnf` 或 `replica.cnf`。
|
||||
由于示例部署结构由单个 MySQL 主节点和任意数量的副本节点组成,
|
||||
因此脚本仅将序数 `0` 指定为主节点,而将其他所有节点指定为副本节点。
|
||||
|
||||
与 StatefulSet 控制器的
|
||||
[部署顺序保证](/zh/docs/concepts/workloads/controllers/statefulset/#deployment-and-scaling-guarantees/)
|
||||
[部署顺序保证](/zh/docs/concepts/workloads/controllers/statefulset/#deployment-and-scaling-guarantees)
|
||||
相结合,
|
||||
可以确保 MySQL 主服务器在创建副本服务器之前已准备就绪,以便它们可以开始复制。
|
||||
|
||||
|
||||
@@ -15,34 +15,34 @@ no_list: true
|
||||
<!--
|
||||
## kubectl
|
||||
|
||||
The Kubernetes command-line tool, `kubectl`, allows you to run commands against
|
||||
Kubernetes clusters. You can use `kubectl` to deploy applications, inspect and
|
||||
manage cluster resources, and view logs.
|
||||
|
||||
See [Install and Set Up `kubectl`](/docs/tasks/tools/install-kubectl/) for
|
||||
information about how to download and install `kubectl` and set it up for
|
||||
accessing your cluster.
|
||||
The Kubernetes command-line tool, [kubectl](/docs/reference/kubectl/kubectl/), allows
|
||||
you to run commands against Kubernetes clusters.
|
||||
You can use kubectl to deploy applications, inspect and manage cluster resources,
|
||||
and view logs. For more information including a complete list of kubectl operations, see the
|
||||
[`kubectl` reference documentation](/docs/reference/kubectl/).
|
||||
-->
|
||||
## kubectl
|
||||
|
||||
Kubernetes 命令行工具,`kubectl`,使得你可以对 Kubernetes 集群运行命令。
|
||||
你可以使用 `kubectl` 来部署应用、监测和管理集群资源以及查看日志。
|
||||
Kubernetes 命令行工具,[kubectl](/docs/reference/kubectl/kubectl/),使得你可以对 Kubernetes 集群运行命令。
|
||||
你可以使用 kubectl 来部署应用、监测和管理集群资源以及查看日志。
|
||||
|
||||
关于如何下载和安装 `kubectl` 并配置其访问你的集群,可参阅
|
||||
[安装和配置 `kubectl`](/zh/docs/tasks/tools/install-kubectl/)。
|
||||
有关更多信息,包括 kubectl 操作的完整列表,请参见[`kubectl`
|
||||
参考文件](/zh/docs/reference/kubectl/)。
|
||||
|
||||
<!--
|
||||
a class="btn btn-primary" href="/docs/tasks/tools/install-kubectl/" role="button" aria-label="View kubectl Install and Set Up Guide">View kubectl Install and Set Up Guide</a>
|
||||
kubectl is installable on a variety of Linux platforms, macOS and Windows.
|
||||
Find your preferred operating system below.
|
||||
|
||||
You can also read the
|
||||
[`kubectl` reference documentation](/docs/reference/kubectl/).
|
||||
- [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux)
|
||||
- [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos)
|
||||
- [Install kubectl on Windows](/docs/tasks/tools/install-kubectl-windows)
|
||||
-->
|
||||
<a class="btn btn-primary" href="/zh/docs/tasks/tools/install-kubectl/"
|
||||
role="button" aria-label="查看 kubectl 安装和配置指南">
|
||||
查看 kubectl 安装和配置指南
|
||||
</a>
|
||||
kubectl 可安装在各种 Linux 平台、 macOS 和 Windows 上。
|
||||
在下面找到你喜欢的操作系统。
|
||||
|
||||
你也可以阅读 [`kubectl` 参考文档](/zh/docs/reference/kubectl/).
|
||||
- [在 Linux 上安装 kubectl](/zh/docs/tasks/tools/install-kubectl-linux)
|
||||
- [在 macOS 上安装 kubectl](/zh/docs/tasks/tools/install-kubectl-macos)
|
||||
- [在 Windows 上安装 kubectl](/zh/docs/tasks/tools/install-kubectl-windows)
|
||||
|
||||
<!--
|
||||
## kind
|
||||
|
||||
@@ -81,9 +81,13 @@ This tutorial provides a container image that uses NGINX to echo back all the re
|
||||
|
||||
{{< kat-button >}}
|
||||
|
||||
<!-- If you installed Minikube locally, run `minikube start`.-->
|
||||
<!--
|
||||
If you installed minikube locally, run `minikube start`. Before you run `minikube dashboard`, you should open a new terminal, start `minikube dashboard` there, and then switch back to the main terminal.
|
||||
-->
|
||||
{{< note >}}
|
||||
如果你在本地安装了 Minikube,运行 `minikube start`。
|
||||
如果你在本地安装了 Minikube,运行 `minikube start`。
|
||||
在运行 `minikube dashboard` 之前,你应该打开一个新终端,
|
||||
在此启动 `minikube dashboard` ,然后切换回主终端。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
@@ -97,13 +101,44 @@ This tutorial provides a container image that uses NGINX to echo back all the re
|
||||
|
||||
<!--
|
||||
3. Katacoda environment only: At the top of the terminal pane, click the plus sign, and then click **Select port to view on Host 1**.
|
||||
|
||||
4. Katacoda environment only: Type `30000`, and then click **Display Port**.
|
||||
-->
|
||||
3. 仅限 Katacoda 环境:在终端窗口的顶部,单击加号,然后单击 **选择要在主机 1 上查看的端口**。
|
||||
|
||||
<!--
|
||||
4. Katacoda environment only: Type `30000`, and then click **Display Port**.
|
||||
-->
|
||||
4. 仅限 Katacoda 环境:输入“30000”,然后单击 **显示端口**。
|
||||
|
||||
<!--
|
||||
The `dashboard` command enables the dashboard add-on and opens the proxy in the default web browser. You can create Kubernetes resources on the dashboard such as Deployment and Service.
|
||||
|
||||
If you are running in an environment as root, see [Open Dashboard with URL](/docs/tutorials/hello-minikube#open-dashboard-with-url).
|
||||
|
||||
To stop the proxy, run `Ctrl+C` to exit the process. The dashboard remains running.
|
||||
-->
|
||||
{{< note >}}
|
||||
`dashboard` 命令启用仪表板插件,并在默认的 Web 浏览器中打开代理。你可以在仪表板上创建 Kubernetes 资源,例如 Deployment 和 Service。
|
||||
|
||||
如果你以 root 用户身份在环境中运行,
|
||||
请参见[使用 URL 打开仪表板](/zh/docs/tutorials/hello-minikube#open-dashboard-with-url)。
|
||||
|
||||
要停止代理,请运行 `Ctrl+C` 退出该进程。仪表板仍在运行中。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
## Open Dashboard with URL
|
||||
-->
|
||||
## 使用 URL 打开仪表板
|
||||
|
||||
<!--
|
||||
If you don't want to open a web browser, run the dashboard command with the url flag to emit a URL:
|
||||
-->
|
||||
如果你不想打开 Web 浏览器,请使用 url 标志运行显示板命令以得到 URL:
|
||||
|
||||
```shell
|
||||
minikube dashboard --url
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
## Create a Deployment
|
||||
|
||||
Reference in New Issue
Block a user