diff --git a/.vuepress/config.js b/.vuepress/config.js
index c5c0314..2cc8d24 100644
--- a/.vuepress/config.js
+++ b/.vuepress/config.js
@@ -345,6 +345,7 @@ module.exports = {
'k8s-intermediate/service/service-details',
'k8s-intermediate/service/service-types',
'k8s-intermediate/service/dns',
+ 'k8s-intermediate/service/host-alias',
'k8s-intermediate/service/connecting',
'k8s-intermediate/service/ingress',
'k8s-intermediate/service/cni',
@@ -418,7 +419,6 @@ module.exports = {
{
title: 'Kubernetes 高级',
collapsable: true,
- path: '/learning/k8s-advanced/index',
children: [
{
title: '问题诊断',
diff --git a/.vuepress/public/statics/learning/svc/host-aliases-pod.yaml b/.vuepress/public/statics/learning/svc/host-aliases-pod.yaml
new file mode 100644
index 0000000..643813b
--- /dev/null
+++ b/.vuepress/public/statics/learning/svc/host-aliases-pod.yaml
@@ -0,0 +1,22 @@
+apiVersion: v1
+kind: Pod
+metadata:
+ name: hostaliases-pod
+spec:
+ restartPolicy: Never
+ hostAliases:
+ - ip: "127.0.0.1"
+ hostnames:
+ - "foo.local"
+ - "bar.local"
+ - ip: "10.1.2.3"
+ hostnames:
+ - "foo.remote"
+ - "bar.remote"
+ containers:
+ - name: cat-hosts
+ image: busybox
+ command:
+ - cat
+ args:
+ - "/etc/hosts"
diff --git a/README.md b/README.md
index e2dd552..a1d3e5a 100644
--- a/README.md
+++ b/README.md
@@ -80,6 +80,7 @@ Kubernetes教程的主要依据是:Kubernetes 官网文档,以及使用 Kubo
* Service 详细描述
* Service 类型
* Service/Pod 的 DNS
+ * 配置Pod的 /etc/hosts
* Service 连接应用程序
* Ingress 通过互联网访问您的应用
* 存储
@@ -97,11 +98,18 @@ Kubernetes教程的主要依据是:Kubernetes 官网文档,以及使用 Kubo
### Kubernetes高级
- * 问题诊断
- * 日志
- * Kubernetes 日志可视化
- * Kubernetes 监控
- * Kubernetes 联邦
+ * 问题诊断
+ * 诊断应用程序
+ * 诊断集群问题
+ * 日志
+ * 日志
+ * 调度
+ * 调度
+ * 调度调优
+ * 调度框架
+ * 安全
+ * 监控
+ * 联邦
### Kubernetes实战
diff --git a/learning/README.md b/learning/README.md
index d14e836..c558939 100644
--- a/learning/README.md
+++ b/learning/README.md
@@ -72,6 +72,7 @@ meta:
* [Service 详细描述](/learning/k8s-intermediate/service/service-details.html)
* [Service 类型](/learning/k8s-intermediate/service/service-types.html)
* [Service/Pod 的 DNS](/learning/k8s-intermediate/service/dns.html)
+ * [配置Pod的 /etc/hosts](/learning/k8s-intermediate/service/host-alias.html)
* [Service 连接应用程序](/learning/k8s-intermediate/service/connecting.html)
* [Ingress 通过互联网访问您的应用](/learning/k8s-intermediate/service/ingress.html)
* [如何选择网络插件](/learning/k8s-intermediate/service/cni.html)
@@ -91,9 +92,15 @@ meta:
## **Kubernetes 高级**
- * [问题诊断](/learning/k8s-advanced/ts/application.html)
- * [日志](/learning/k8s-advanced/logs/)
- * [调度](/learning/k8s-advanced/schedule)
+ * 问题诊断
+ * [诊断应用程序](/learning/k8s-advanced/ts/application.html)
+ * [诊断集群问题](/learning/k8s-advanced/ts/cluster.html)
+ * 日志
+ * [日志](/learning/k8s-advanced/logs/)
+ * 调度
+ * [调度](/learning/k8s-advanced/schedule/)
+ * [调度调优](/learning/k8s-advanced/schedule/tuning.html)
+ * [调度框架](/learning/k8s-advanced/schedule/framework.html)
* 安全
* 监控
* 联邦
diff --git a/learning/k8s-intermediate/service/host-alias.md b/learning/k8s-intermediate/service/host-alias.md
new file mode 100644
index 0000000..e0a5939
--- /dev/null
+++ b/learning/k8s-intermediate/service/host-alias.md
@@ -0,0 +1,117 @@
+---
+vssueId: 132=
+layout: LearningLayout
+description: Kubernetes教程_某些情况下_DNS或者其他的域名解析方法可能不太适用_您需要配置_/etc/hosts文件_在Linux下是比较容易做到的_在Kubernetes中_可以通过Pod定义中的_`hostAliases`_字段向Pod的/etc/hosts添加条目。
+meta:
+ - name: keywords
+ content: Kubernetes Ingress,Ingress
+---
+
+# 配置Pod的 /etc/hosts
+
+
+
+> 参考文档:[Adding entries to Pod /etc/hosts with HostAliases](https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/)
+
+某些情况下,DNS 或者其他的域名解析方法可能不太适用,您需要配置 /etc/hosts 文件,在Linux下是比较容易做到的,在 Kubernetes 中,可以通过 Pod 定义中的 `hostAliases` 字段向 Pod 的 /etc/hosts 添加条目。
+
+适用其他方法修改 Pod 的 /etc/hosts 文件是不被推荐的,因为 kubelet 可能在重新创建 Pod 时,就会覆盖这些修改。
+
+
+
+## 默认hosts文件内容
+
+通过创建一个 Nginx Pod,我们可以查看Pod创建后,/etc/hosts 文件的默认内容,执行命令:
+
+``` sh
+kubectl run nginx --image nginx --generator=run-pod/v1
+```
+
+执行命令查看 Pod 的IP:
+
+``` sh
+kubectl get pods -o wide
+```
+输出结果如下所示:
+```
+NAME READY STATUS RESTARTS AGE IP NODE
+nginx 1/1 Running 0 13s 10.200.0.4 worker0
+```
+
+执行命令查看hosts文件的内容
+``` sh
+kubectl exec nginx -- cat /etc/hosts
+```
+
+输出结果如下所示:
+
+```
+# Kubernetes-managed hosts file.
+127.0.0.1 localhost
+::1 localhost ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+fe00::0 ip6-mcastprefix
+fe00::1 ip6-allnodes
+fe00::2 ip6-allrouters
+10.200.0.4 nginx
+```
+
+默认情况下, `hosts` 文件只包含 IPv4 和 IPv6 的基本配置,例如 `localhost` 和该 Pod 自己的 hostname。
+
+## 使用hostAliases添加额外的条目
+
+通过 Pod 定义中的 `.spec.hostAliases` 字段,我们可以向 Pod 的 `/etc/hosts` 文件中添加额外的条目,用来解析 `foo.local`、`bar.local` 到 `127.0.0.1 和` `foo.remote`、`bar.remote` 到 `10.1.2.3`,如下所示:
+
+<<< @/.vuepress/public/statics/learning/svc/host-aliases-pod.yaml
+
+执行一下命令可创建该 Pod:
+``` sh
+kubectl apply -f https://kuboard.cn/statics/learning/svc/host-aliases-pod.yaml
+```
+
+执行命令查看 Pod 的 IP 和状态:
+``` sh
+kubectl get pod --output=wide
+```
+
+输出结果如下所示:
+
+```
+NAME READY STATUS RESTARTS AGE IP NODE
+hostaliases-pod 0/1 Completed 0 6s 10.200.0.5 worker0
+```
+
+执行命令查看 hosts 文件内容:
+
+``` sh
+kubectl logs hostaliases-pod
+```
+
+输出结果如下所示:
+
+```
+# Kubernetes-managed hosts file.
+127.0.0.1 localhost
+::1 localhost ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+fe00::0 ip6-mcastprefix
+fe00::1 ip6-allnodes
+fe00::2 ip6-allrouters
+10.200.0.5 hostaliases-pod
+
+# Entries added by HostAliases.
+127.0.0.1 foo.local bar.local
+10.1.2.3 foo.remote bar.remote
+```
+
+从结果中,我们可以看到,配置的条目被添加在 `/etc/hosts` 文件的末尾。
+
+## 为什么kubelet要管理hosts文件
+
+Kubelet [管理](https://github.com/kubernetes/kubernetes/issues/14633) `hosts` Pod 中每个容器的 hosts 文件,以便可以阻止 Docker 在容器启动以后 [修改](https://github.com/moby/moby/issues/17190) 该文件。
+
+细节情况请参考两个 github issue:
+[https://github.com/kubernetes/kubernetes/issues/14633](https://github.com/kubernetes/kubernetes/issues/14633)
+[https://github.com/moby/moby/issues/17190](https://github.com/moby/moby/issues/17190)
+
+由于该文件已经被 Kubelet 管理起来,任何对该文件手工修改的内容,都将在 Kubelet 重启容器或者 Pod 重新调度时被覆盖。因此,最好是通过 `hostAliases` 修改 Pod 的 /etc/hosts 文件,而不是手工修改。
diff --git a/learning/k8s-intermediate/workload/wl-deployment/canary.md b/learning/k8s-intermediate/workload/wl-deployment/canary.md
index 3a14b73..a86d0a3 100644
--- a/learning/k8s-intermediate/workload/wl-deployment/canary.md
+++ b/learning/k8s-intermediate/workload/wl-deployment/canary.md
@@ -1,13 +1,13 @@
---
vssueId: 41
layout: LearningLayout
-description: 本文描述了如何通过 Deployment 执行灰度发布(金丝雀发布)
+description: 本文描述了如何通过 Deployment 执行灰度发布(金丝雀发布)如果您想使用 Deployment 将最新的应用程序版本发布给一部分用户(或服务器),您可以为每个版本创建一个 Deployment,此时,应用程序的新旧两个版本都可以同时获得生产上的流量。
meta:
- name: keywords
content: Kubernetes教程,K8S教程,金丝雀发布,灰度发布
---
-# 金丝雀发布
+# 金丝雀发布(灰度发布)