Getting ready

Since Kubernetes version 1.3, kube-dns has come with Kubernetes and is enabled by default. To check whether kube-dns is working or not, check the kube-system namespace with the following command:

$ kubectl get deploy kube-dns --namespace=kube-system
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
kube-dns 1 1 1 1 1d

If you are using minikube, type the following command to see the addon's status:

$ minikube addons list |grep kube-dns
- kube-dns: enabled

If it shows as disabled, you need to enable it using the following command:

$ minikube addons enable kube-dns

In addition, prepare two namespaces, chap8-domain1 and chap8-domain2, to demonstrate how kube-dns assigns domain names:

$ kubectl create namespace chap8-domain1
namespace "chap8-domain1" created

$ kubectl create namespace chap8-domain2
namespace "chap8-domain2" created

//check chap8-domain1 and chap8-domain2
$ kubectl get namespaces
NAME STATUS AGE
chap8-domain1 Active 16s
chap8-domain2
Active 14s
default Active 4h
kube-public Active 4h
kube-system Active 4h
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.166.97