From c847d01b74b390cfd78e9ac83ff5c1f4f8ece3f2 Mon Sep 17 00:00:00 2001 From: Nemo Date: Sat, 27 Jun 2020 20:57:27 +0200 Subject: [PATCH] Add pods DNS resolution for external names --- deployments/coredns.yaml | 1 + docs/09-bootstrapping-kubernetes-workers.md | 2 +- docs/12-dns-addon.md | 14 +++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/deployments/coredns.yaml b/deployments/coredns.yaml index 4c0dbc0..bf1a258 100644 --- a/deployments/coredns.yaml +++ b/deployments/coredns.yaml @@ -61,6 +61,7 @@ data: fallthrough in-addr.arpa ip6.arpa } prometheus :9153 + forward . /etc/resolv.conf cache 30 loop reload diff --git a/docs/09-bootstrapping-kubernetes-workers.md b/docs/09-bootstrapping-kubernetes-workers.md index fe205bf..7891fcf 100644 --- a/docs/09-bootstrapping-kubernetes-workers.md +++ b/docs/09-bootstrapping-kubernetes-workers.md @@ -35,7 +35,7 @@ Verify if swap is enabled: sudo swapon --show ``` -If output is empthy then swap is not enabled. If swap is enabled run the following command to disable swap immediately: +If output is empty then swap is not enabled. If swap is enabled run the following command to disable swap immediately: ```bash sudo swapoff -a diff --git a/docs/12-dns-addon.md b/docs/12-dns-addon.md index a3c871a..332eecb 100644 --- a/docs/12-dns-addon.md +++ b/docs/12-dns-addon.md @@ -4,10 +4,22 @@ In this lab you will deploy the [DNS add-on](https://kubernetes.io/docs/concepts ## The DNS Cluster Add-on +Get the CoreDNS yaml: + +```bash +wget https://storage.googleapis.com/kubernetes-the-hard-way/coredns.yaml +``` + +Edit the `coredns.yaml` file to change CoreDNS configuration to enable DNS resolution for external name: + +```bash +sed '/.*prometheus :9153/a \ \ \ \ \ \ \ \ forward . /etc/resolv.conf' coredns.yaml +``` + Deploy the `coredns` cluster add-on: ```bash -kubectl apply -f https://storage.googleapis.com/kubernetes-the-hard-way/coredns.yaml +kubectl apply -f coredns.yaml ``` > Output: