Skip to content

Commit

Permalink
Merge pull request #43485 from my-git9/install-kubeadm
Browse files Browse the repository at this point in the history
[zh-cn] sync kubeadm/install-kubeadm.md kubelet-integration.md write-new-topic.md
  • Loading branch information
k8s-ci-robot authored Oct 15, 2023
2 parents 84bed71 + de272f1 commit 0f9e81b
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 34 deletions.
21 changes: 10 additions & 11 deletions content/zh-cn/docs/contribute/style/write-new-topic.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ that you write. The docs site provides templates or
new content pages. To create a new type of page, run `hugo new` with the path to the file
you want to create. For example:
-->
### 创建一个新页面{#creating-a-new-page}
### 创建一个新页面 {#creating-a-new-page}

为每个新页面选择其[内容类型](/zh-cn/docs/contribute/style/page-content-types/)
文档站提供了模板或 [Hugo Archetypes](https://gohugo.io/content-management/archetypes/) 来创建新的内容页面。
Expand Down Expand Up @@ -225,13 +225,13 @@ reusable, and you want the reader to try it out themselves.
<!--
When adding a new standalone sample file, such as a YAML file, place the code in
one of the `<LANG>/examples/` subdirectories where `<LANG>` is the language for
the topic. In your topic file, use the `codenew` shortcode:
the topic. In your topic file, use the `code_sample` shortcode:
-->
添加新的独立示例文件(如 YAML 文件)时,将代码放在 `<LANG>/examples/` 的某个子目录中,
其中 `<LANG>` 是该主题的语言。在主题文件中使用 `codenew` 短代码:
其中 `<LANG>` 是该主题的语言。在主题文件中使用 `code_sample` 短代码:

```none
{{%/* codenew file="<RELPATH>/my-example-yaml>" */%}}
{{%/* code_sample file="<RELPATH>/my-example-yaml>" */%}}
```

<!--
Expand All @@ -245,7 +245,7 @@ file located at `/content/en/examples/pods/storage/gce-volume.yaml`.
文件。

```none
{{%/* codenew file="pods/storage/gce-volume.yaml" */%}}
{{%/* code_sample file="pods/storage/gce-volume.yaml" */%}}
```

<!--
Expand All @@ -268,13 +268,13 @@ In your topic, show this command:
kubectl create -f https://k8s.io/examples/pods/storage/gce-volume.yaml
```

{{< note >}}
<!--
When adding new YAML files to the `<LANG>/examples` directory, make
sure the file is also included into the `<LANG>/examples_test.go` file. The
Travis CI for the Website automatically runs this test case when PRs are
submitted to ensure all examples pass the tests.
-->
{{< note >}}
将新的 YAML 文件添加到 `<LANG>/examples` 目录时,请确保该文件也在
`<LANG>/examples_test.go` 文件中被引用。
当提交拉取请求时,网站的 Travis CI 会自动运行此测试用例,以确保所有示例都通过测试。
Expand All @@ -284,8 +284,8 @@ submitted to ensure all examples pass the tests.
For an example of a topic that uses this technique, see
[Running a Single-Instance Stateful Application](/docs/tasks/run-application/run-single-instance-stateful-application/).
-->
有关使用此技术的主题的示例,请参见
[运行单实例有状态的应用](/zh-cn/docs/tasks/run-application/run-single-instance-stateful-application/)
有关使用此技术的主题的示例,
请参见[运行单实例有状态的应用](/zh-cn/docs/tasks/run-application/run-single-instance-stateful-application/)

<!--
## Adding images to a topic
Expand All @@ -302,6 +302,5 @@ Put image files in the `/images` directory. The preferred image format is SVG.
* Learn about [using page content types](/docs/contribute/style/page-content-types/).
* Learn about [creating a pull request](/docs/contribute/new-content/open-a-pr/).
-->
* 了解[使用页面内容类型](/zh-cn/docs/contribute/style/page-content-types/).
* 了解[创建 PR](/zh-cn/docs/contribute/new-content/open-a-pr/).

* 了解[使用页面内容类型](/zh-cn/docs/contribute/style/page-content-types/)
* 了解[创建 PR](/zh-cn/docs/contribute/new-content/open-a-pr/)
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@ see the [Creating a cluster with kubeadm](/docs/setup/production-environment/too
有关在执行此安装过程后如何使用 kubeadm 创建集群的信息,
请参见[使用 kubeadm 创建集群](/zh-cn/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/)

<!--
This installation guide is for Kubernetes {{< skew currentVersion >}}. If you want to use a different
Kubernetes version, please refer to the following pages instead:
-->
本安装指南适用于 Kubernetes {{< skew currentVersion >}}。
如果你想使用不同版本的 Kubernetes,请参阅以下页面:

<!--
- [Installing kubeadm for Kubernetes {{< skew currentVersionAddMinor -1 "." >}}](https://v{{< skew currentVersionAddMinor -1 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- [Installing kubeadm for Kubernetes {{< skew currentVersionAddMinor -2 "." >}}](https://v{{< skew currentVersionAddMinor -2 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- [Installing kubeadm for Kubernetes {{< skew currentVersionAddMinor -3 "." >}}](https://v{{< skew currentVersionAddMinor -3 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- [Installing kubeadm for Kubernetes {{< skew currentVersionAddMinor -4 "." >}}](https://v{{< skew currentVersionAddMinor -4 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
-->
- [为 Kubernetes {{< skew currentVersionAddMinor -1 "." >}} 安装 kubeadm](https://v{{< skew currentVersionAddMinor -1 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- [为 Kubernetes {{< skew currentVersionAddMinor -2 "." >}} 安装 kubeadm](https://v{{< skew currentVersionAddMinor -2 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- [为 Kubernetes {{< skew currentVersionAddMinor -3 "." >}} 安装 kubeadm](https://v{{< skew currentVersionAddMinor -3 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
- [为 Kubernetes {{< skew currentVersionAddMinor -4 "." >}} 安装 kubeadm](https://v{{< skew currentVersionAddMinor -4 "-" >}}.docs.kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)

## {{% heading "prerequisites" %}}

<!--
Expand Down Expand Up @@ -305,6 +323,18 @@ Kubernetes 从 2023 年 8 月开始使用托管在 `pkgs.k8s.io`
更多细节参阅[弃用和冻结公告](/zh-cn/blog/2023/08/31/legacy-package-repository-deprecation/)
{{< /note >}}

{{< note >}}
<!--
There's a dedicated package repository for each Kubernetes minor version. If you want to install
a minor version other than {{< skew currentVersion >}}, please see the installation guide for
your desired minor version. The official Kubernetes package repositories provide downloads for
Kubernetes versions starting with v1.24.0.
-->
每个 Kubernetes 小版本都有一个专用的软件包仓库。
如果你想安装 {{< skew currentVersion >}} 以外的次要版本,请参阅所需次要版本的安装指南。
官方 Kubernetes 软件包仓库提供 Kubernetes v1.24.0 及更高版本软件包的下载。
{{< /note >}}

{{< tabs name="k8s_install" >}}
{{% tab name="基于 Debian 的发行版" %}}

Expand Down Expand Up @@ -335,9 +365,16 @@ These instructions are for Kubernetes {{< skew currentVersion >}}.
```

<!--
3. Add the Kubernetes `apt` repository:
3. Add the appropriate Kubernetes `apt` repository. Please note that this repository have packages
only for Kubernetes {{< skew currentVersion >}}; for other Kubernetes minor versions, you need to
change the Kubernetes minor version in the URL to match your desired minor version
(you should also check that you are reading the documentation for the version of Kubernetes
that you plan to install).
-->
3. 添加 Kubernetes `apt` 仓库:
3. 添加 Kubernetes `apt` 仓库。
请注意,此仓库仅包含适用于 Kubernetes {{< skew currentVersion >}} 的软件包;
对于其他 Kubernetes 次要版本,则需要更改 URL 中的 Kubernetes 次要版本以匹配你所需的次要版本
(你还应该检查正在阅读的安装文档是否为你计划安装的 Kubernetes 版本的文档)。

```shell
# 此操作会覆盖 /etc/apt/sources.list.d/kubernetes.list 中现存的所有配置。
Expand Down Expand Up @@ -379,7 +416,7 @@ you can create it by running `sudo mkdir -m 755 /etc/apt/keyrings`
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
```
-->
1. 将 SELinux 设置为 `permissive` 模式:
1. 将 SELinux 设置为 `permissive` 模式

以下指令适用于 Kubernetes {{< skew currentVersion >}}。

Expand Down Expand Up @@ -408,11 +445,19 @@ you can create it by running `sudo mkdir -m 755 /etc/apt/keyrings`
2. Add the Kubernetes `yum` repository. The `exclude` parameter in the
repository definition ensures that the packages related to Kubernetes are
not upgraded upon running `yum update` as there's a special procedure that
must be followed for upgrading Kubernetes.
must be followed for upgrading Kubernetes. Please note that this repository
have packages only for Kubernetes {{< skew currentVersion >}}; for other
Kubernetes minor versions, you need to change the Kubernetes minor version
in the URL to match your desired minor version (you should also check that
you are reading the documentation for the version of Kubernetes that you
plan to install).
-->
2. 添加 Kubernetes 的 `yum` 仓库。在仓库定义中的 `exclude` 参数确保了与
Kubernetes 相关的软件包在运行 `yum update` 时不会升级,因为升级
Kubernetes 需要遵循特定的过程。
Kubernetes 需要遵循特定的过程。请注意,此仓库仅包含适用于
Kubernetes {{< skew currentVersion >}} 的软件包;
对于其他 Kubernetes 次要版本,则需要更改 URL 中的 Kubernetes 次要版本以匹配你所需的次要版本
(你还应该检查正在阅读的安装文档是否为你计划安装的 Kubernetes 版本的文档)。

```shell
# 此操作会覆盖 /etc/yum.repos.d/kubernetes.repo 中现存的所有配置
Expand Down Expand Up @@ -494,10 +539,10 @@ cd $DOWNLOAD_DIR
sudo curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/${ARCH}/{kubeadm,kubelet}
sudo chmod +x {kubeadm,kubelet}
RELEASE_VERSION="v0.15.1"
curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service" | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service
RELEASE_VERSION="v0.16.2"
curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/krel/templates/latest/kubelet/kubelet.service" | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service
sudo mkdir -p /etc/systemd/system/kubelet.service.d
curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf" | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/krel/templates/latest/kubeadm/10-kubeadm.conf" | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
```
{{< note >}}
Expand Down Expand Up @@ -574,8 +619,8 @@ If you are running into difficulties with kubeadm, please consult our
-->
## 故障排查 {#troubleshooting}
如果你在使用 kubeadm 时遇到困难,请参阅我们的
[故障排查文档](/zh-cn/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/)。
如果你在使用 kubeadm 时遇到困难,
请参阅我们的[故障排查文档](/zh-cn/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/)。
## {{% heading "whatsnext" %}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ In addition to the flags used when starting the kubelet, the file also contains
parameters such as the cgroup driver and whether to use a different container runtime socket
(`--cri-socket`).
-->
除了启动 kubelet 时所使用的标志外,该文件还包含动态参数,例如 cgroup 驱动程序以及是否使用其他容器运行时套接字(`--cri-socket`)。
除了启动 kubelet 时所使用的标志外,该文件还包含动态参数,例如 cgroup
驱动程序以及是否使用其他容器运行时套接字(`--cri-socket`)。

<!--
After marshalling these two files to disk, kubeadm attempts to run the following two
Expand Down Expand Up @@ -277,7 +278,7 @@ When the `/etc/kubernetes/kubelet.conf` file is written, the kubelet has finishe
Kubeadm deletes the `/etc/kubernetes/bootstrap-kubelet.conf` file after completing the TLS Bootstrap.
-->
当 `/etc/kubernetes/kubelet.conf` 文件被写入后,kubelet 就完成了 TLS 引导过程。
Kubeadm 在完成 TLS 引导过程后将删除 `/etc/kubernetes/bootstrap-kubelet.conf` 文件。
kubeadm 在完成 TLS 引导过程后将删除 `/etc/kubernetes/bootstrap-kubelet.conf` 文件。

<!--
## The kubelet drop-in file for systemd
Expand All @@ -293,19 +294,15 @@ Note that the kubeadm CLI command never touches this drop-in file.

<!--
This configuration file installed by the `kubeadm`
[DEB](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf) or
[RPM package](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/rpm/kubeadm/10-kubeadm.conf) is written to
[package](https://github.com/kubernetes/release/blob/cd53840/cmd/krel/templates/latest/kubeadm/10-kubeadm.conf) is written to
`/etc/systemd/system/kubelet.service.d/10-kubeadm.conf` and is used by systemd.
It augments the basic
[`kubelet.service` for RPM](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.service) or
[`kubelet.service` for DEB](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service):
[`kubelet.service`](https://github.com/kubernetes/release/blob/cd53840/cmd/krel/templates/latest/kubelet/kubelet.service):
-->
通过 `kubeadm` [DEB 包](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf)
或者 [RPM 包](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/rpm/kubeadm/10-kubeadm.conf)
安装的配置文件被写入 `/etc/systemd/system/kubelet.service.d/10-kubeadm.conf` 并由 systemd 使用。
它对原来的 [RPM 版本 `kubelet.service`](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.service)
或者 [DEB 版本 `kubelet.service`](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service)
作了增强:
通过 `kubeadm` [包](https://github.com/kubernetes/release/blob/cd53840/cmd/krel/templates/latest/kubeadm/10-kubeadm.conf)
安装的配置文件被写入 `/etc/systemd/system/kubelet.service.d/10-kubeadm.conf`
并由 systemd 使用。它对原来的
[`kubelet.service`](https://github.com/kubernetes/release/blob/cd53840/cmd/krel/templates/latest/kubelet/kubelet.service) 作了增强:

{{< note >}}
<!--
Expand All @@ -314,7 +311,7 @@ follow the guide outlined in the ([Without a package manager](/docs/setup/produc
section.
-->
下面的内容只是一个例子。如果你不想使用包管理器,
请遵循([没有包管理器](/zh-cn/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#k8s-install-2))
请遵循[没有包管理器](/zh-cn/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#k8s-install-2)
章节的指南。
{{< /note >}}

Expand Down

0 comments on commit 0f9e81b

Please sign in to comment.