[zh-cn] Update customize-hosts-file-for-pods.md
parent
4135f1ec3e
commit
67e9a06c8e
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: 使用 HostAliases 向 Pod /etc/hosts 文件添加条目
|
||||
content_type: concept
|
||||
content_type: task
|
||||
weight: 60
|
||||
min-kubernetes-server-version: 1.7
|
||||
---
|
||||
|
@ -22,7 +22,7 @@ Adding entries to a Pod's /etc/hosts file provides Pod-level override of hostnam
|
|||
|
||||
Modification not using HostAliases is not suggested because the file is managed by Kubelet and can be overwritten on during Pod creation/restart.
|
||||
-->
|
||||
当 DNS 配置以及其它选项不合理的时候,通过向 Pod 的 /etc/hosts 文件中添加条目,
|
||||
当 DNS 配置以及其它选项不合理的时候,通过向 Pod 的 `/etc/hosts` 文件中添加条目,
|
||||
可以在 Pod 级别覆盖对主机名的解析。你可以通过 PodSpec 的 HostAliases
|
||||
字段来添加这些自定义条目。
|
||||
|
||||
|
@ -86,7 +86,7 @@ fe00::2 ip6-allrouters
|
|||
By default, the `hosts` file only includes IPv4 and IPv6 boilerplates like
|
||||
`localhost` and its own hostname.
|
||||
-->
|
||||
默认情况下,hosts 文件只包含 IPv4 和 IPv6 的样板内容,像 `localhost` 和主机名称。
|
||||
默认情况下,`hosts` 文件只包含 IPv4 和 IPv6 的样板内容,像 `localhost` 和主机名称。
|
||||
|
||||
<!--
|
||||
## Adding Additional Entries with HostAliases
|
||||
|
@ -99,7 +99,7 @@ For example: to resolve `foo.local`, `bar.local` to `127.0.0.1` and `foo.remote`
|
|||
-->
|
||||
## 通过 HostAliases 增加额外条目
|
||||
|
||||
除了默认的样板内容,我们可以向 hosts 文件添加额外的条目。
|
||||
除了默认的样板内容,我们可以向 `hosts` 文件添加额外的条目。
|
||||
例如,要将 `foo.local`、`bar.local` 解析为 `127.0.0.1`,
|
||||
将 `foo.remote`、 `bar.remote` 解析为 `10.1.2.3`,我们可以在
|
||||
`.spec.hostAliases` 下为 Pod 配置 HostAliases。
|
||||
|
@ -136,7 +136,7 @@ hostaliases-pod 0/1 Completed 0 6s 10.200.0.5 w
|
|||
<!--
|
||||
The `hosts` file content looks like this:
|
||||
-->
|
||||
hosts 文件的内容看起来类似如下这样:
|
||||
`hosts` 文件的内容看起来类似如下所示:
|
||||
|
||||
```shell
|
||||
kubectl logs hostaliases-pod
|
||||
|
|
Loading…
Reference in New Issue