zh-trans: update static-pod.md#14824
Conversation
mysunshine92
commented
Jun 11, 2019
|
cc @tengqm |
|
/assign @jsafrane |
|
How did I become reviewer of static pods? |
| Kubelet automatically tries to create a *mirror pod* on the Kubernetes API server for each static pod. | ||
| This means that the pods are visible on the API server but cannot be controlled from there. | ||
| ---> | ||
| Kubelet 自动为每一个静态 pod 在 Kubernetes 的 API 服务器上创建一个镜像 Pod(*mirror pod*),因此可以在 API 服务器查询到该 pod,但是不被 API 服务器控制(例如不能删除)。 |
There was a problem hiding this comment.
| Kubelet 自动为每一个静态 pod 在 Kubernetes 的 API 服务器上创建一个镜像 Pod(*mirror pod*),因此可以在 API 服务器查询到该 pod,但是不被 API 服务器控制(例如不能删除)。 | |
| Kubelet 自动为每一个静态 pod 在 Kubernetes 的 API 服务器上创建一个*镜像 Pod* (*mirror pod*),因此可以在 API 服务器查询到该 pod,但是不被 API 服务器控制(例如不能删除)。 |
| ### 配置文件 | ||
|
|
||
| 配置文件就是放在特定目录下的标准的 JSON 或 YAML 格式的 pod 定义文件。用`kubelet --pod-manifest-path=<the directory>`来启动 kubelet 进程,kubelet 将会周期扫描<the directory>这个目录,根据这个目录下出现或消失的 YAML/JSON 文件来创建或删除静态 pod。 | ||
| 配置文件就是放在特定目录下的标准的 JSON 或 YAML 格式的 pod 定义文件。用`kubelet --pod-manifest-path=<the directory>`来启动 kubelet 进程或者在[KubeletConfiguration 文件](/docs/tasks/administer-cluster/kubelet-config-file)中添加`staticPodPath: <the directory>`字段,kubelet 将会周期扫描<the directory>这个目录,根据这个目录下出现或消失的 YAML/JSON 文件来创建或删除静态 pod。 |
There was a problem hiding this comment.
| 配置文件就是放在特定目录下的标准的 JSON 或 YAML 格式的 pod 定义文件。用`kubelet --pod-manifest-path=<the directory>`来启动 kubelet 进程或者在[KubeletConfiguration 文件](/docs/tasks/administer-cluster/kubelet-config-file)中添加`staticPodPath: <the directory>`字段,kubelet 将会周期扫描<the directory>这个目录,根据这个目录下出现或消失的 YAML/JSON 文件来创建或删除静态 pod。 | |
| 配置文件就是放在特定目录下的标准的 JSON 或 YAML 格式的 pod 定义文件。用 `kubelet --pod-manifest-path=<the directory>` 来启动 kubelet 进程或者在 [KubeletConfiguration 文件](/docs/tasks/administer-cluster/kubelet-config-file)中添加 `staticPodPath: <the directory>` 字段,kubelet 将会周期扫描 `<the directory>` 这个目录,根据这个目录下出现或消失的 YAML/JSON 文件来创建或删除静态 pod。 |
| ---> | ||
| 下面例子用静态 pod 的方式启动一个简单的 Web 服务器: | ||
|
|
||
| 1. 选择一个节点来运行静态 pod。这个例子中就是`my-node1`。 |
There was a problem hiding this comment.
| 1. 选择一个节点来运行静态 pod。这个例子中就是`my-node1`。 | |
| 1. 选择一个节点来运行静态 pod。这个例子中就是 `my-node1`。 |
| 下面例子用静态 pod 的方式启动一个 nginx 的 Web 服务器: | ||
| 2. Choose a directory, say `/etc/kubelet.d` and place a web server pod definition there, e.g. `/etc/kubelet.d/static-web.yaml`: | ||
| ---> | ||
| 下面例子用静态 pod 的方式启动一个简单的 Web 服务器: |
There was a problem hiding this comment.
| 下面例子用静态 pod 的方式启动一个简单的 Web 服务器: | |
| 下面例子用静态 pod 的方式启动一个简单的 web 服务器: |
|
|
||
| Instructions for other distributions or Kubernetes installations may vary. | ||
| ---> | ||
| 3.配置节点上的 kubelet 使用这个目录,kubelet 启动时增加`--pod-manifest-path=/etc/kubelet.d/`参数或者在[KubeletConfiguration 文件](/docs/tasks/administer-cluster/kubelet-config-file)中增加`staticPodPath: <the directory>`字段。如果是 Fedora 系统,在 Kubelet 配置文件 /etc/kubernetes/kubelet 中添加下面这行: |
There was a problem hiding this comment.
| 3.配置节点上的 kubelet 使用这个目录,kubelet 启动时增加`--pod-manifest-path=/etc/kubelet.d/`参数或者在[KubeletConfiguration 文件](/docs/tasks/administer-cluster/kubelet-config-file)中增加`staticPodPath: <the directory>`字段。如果是 Fedora 系统,在 Kubelet 配置文件 /etc/kubernetes/kubelet 中添加下面这行: | |
| 3.配置节点上的 kubelet 使用这个目录,kubelet 启动时增加`--pod-manifest-path=/etc/kubelet.d/`参数或者在 [KubeletConfiguration 文件](/docs/tasks/administer-cluster/kubelet-config-file)中增加 `staticPodPath: <the directory>` 字段。如果是 Fedora 系统,在 Kubelet 配置文件 /etc/kubernetes/kubelet 中添加下面这行配置代码: |
| role: myrole | ||
| spec: | ||
| containers: | ||
| ```shell |
There was a problem hiding this comment.
这里的代码可以不用修改。
也和其他地方的代码风格一致。:smile:
|
|
||
| When kubelet starts, it automatically starts all pods defined in directory specified in `--pod-manifest-path=` or `--manifest-url=` arguments or add the `staticPodPath: <the directory>` field in the [KubeletConfiguration file](/docs/tasks/administer-cluster/kubelet-config-file), i.e. our static-web. (It may take some time to pull nginx image, be patient…): | ||
| ---> | ||
| ## 静态 pods 的动作行为 |
There was a problem hiding this comment.
| ## 静态 pods 的动作行为 | |
| ## 静态 pods 的行为 |
| {{< /note >}} | ||
| ---> | ||
| {{< note >}} | ||
| 需要确保 kubelet 有权限在 API 服务器上创建镜像 pod。如果没有权限,API 服务器会拒绝创建请求,请参考[PodSecurityPolicy](/docs/concepts/policy/pod-security-policy/)。 |
There was a problem hiding this comment.
| 需要确保 kubelet 有权限在 API 服务器上创建镜像 pod。如果没有权限,API 服务器会拒绝创建请求,请参考[PodSecurityPolicy](/docs/concepts/policy/pod-security-policy/)。 | |
| 需要确保 kubelet 有权限在 API 服务器上创建镜像 pod。如果没有权限,API 服务器会拒绝创建请求,请参考 [PodSecurityPolicy](/docs/concepts/policy/pod-security-policy/)。 |
| <!-- | ||
| Back to our `my-node1` host, we can try to stop the container manually and see, that kubelet automatically restarts it in a while: | ||
| ---> | ||
| 返回`my-node1`主机,我们尝试手动终止容器,可以看到 kubelet 很快就会自动重启容器。 |
There was a problem hiding this comment.
| 返回`my-node1`主机,我们尝试手动终止容器,可以看到 kubelet 很快就会自动重启容器。 | |
| 返回 `my-node1` 主机,我们尝试手动终止容器,可以看到 kubelet 很快就会自动重启容器。 |
chenrui333
left a comment
There was a problem hiding this comment.
minor comments about article style, and some suggestions. Otherwise, lgtm!
|
Thanks for your contributions! |
28cffd6 to
cc3c229
Compare
cc3c229 to
9d28c8e
Compare
|
@chenrui333 thanks for your suggesstion, I have modified those. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chenrui333, jsafrane The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Thanks for the updates! Cheers! |