You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding entries to a Pod's `/etc/hosts` file provides Pod-level override of hostname resolution when DNS and other options are not applicable. You can add these custom entries with the HostAliases field in PodSpec.
22
21
23
-
Modification not using HostAliases is not suggested because the file is managed by the kubelet and can be overwritten on during Pod creation/restart.
22
+
The Kubernetes project recommends modifying DNS configuration using the `hostAliases` field
23
+
(part of the `.spec` for a Pod), and not by using an init container or other means to edit `/etc/hosts`
24
+
directly.
25
+
Change made in other ways may be overwritten by the kubelet during Pod creation or restart.
24
26
-->
25
27
当 DNS 配置以及其它选项不合理的时候,通过向 Pod 的 `/etc/hosts` 文件中添加条目,
26
28
可以在 Pod 级别覆盖对主机名的解析。你可以通过 PodSpec 的 HostAliases
27
29
字段来添加这些自定义条目。
28
30
29
-
建议通过使用 HostAliases 来进行修改,因为该文件由 Kubelet 管理,并且
30
-
可以在 Pod 创建/重启过程中被重写。
31
+
Kubernetes 项目建议使用 `hostAliases` 字段(Pod `.spec` 的一部分)来修改 DNS 配置,
32
+
而不是通过使用 Init 容器或其他方式直接编辑 `/etc/hosts`。
33
+
以其他方式所做的更改可能会在 Pod 创建或重启过程中被 kubelet 重写。
31
34
32
35
<!-- steps -->
33
36
@@ -36,7 +39,7 @@ Modification not using HostAliases is not suggested because the file is managed
0 commit comments