2016-07-09 19:17:18 +03:00
|
|
|
# Deploying the Cluster DNS Add-on
|
2016-07-09 18:16:09 +03:00
|
|
|
|
|
|
|
In this lab you will deploy the DNS add-on which is required for every Kubernetes cluster. Without the DNS add-on the following things will not work:
|
|
|
|
|
|
|
|
* DNS based service discovery
|
|
|
|
* DNS lookups from containers running in pods
|
|
|
|
|
2016-07-09 19:17:18 +03:00
|
|
|
## Cluster DNS Add-on
|
2016-07-09 18:21:35 +03:00
|
|
|
|
2017-03-24 18:31:17 +03:00
|
|
|
```
|
|
|
|
kubectl create clusterrolebinding serviceaccounts-cluster-admin \
|
|
|
|
--clusterrole=cluster-admin \
|
|
|
|
--group=system:serviceaccounts
|
|
|
|
```
|
|
|
|
|
2017-03-26 06:23:14 +03:00
|
|
|
Create the `kubedns` service:
|
2016-07-09 18:16:09 +03:00
|
|
|
|
|
|
|
```
|
2016-09-11 16:20:02 +03:00
|
|
|
kubectl create -f https://raw.githubusercontent.com/kelseyhightower/kubernetes-the-hard-way/master/services/kubedns.yaml
|
2016-07-09 18:16:09 +03:00
|
|
|
```
|
|
|
|
|
2016-07-09 18:21:35 +03:00
|
|
|
```
|
|
|
|
kubectl --namespace=kube-system get svc
|
|
|
|
```
|
2017-03-25 21:50:26 +03:00
|
|
|
|
2016-07-09 18:21:35 +03:00
|
|
|
```
|
|
|
|
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
2016-09-11 17:01:11 +03:00
|
|
|
kube-dns 10.32.0.10 <none> 53/UDP,53/TCP 5s
|
2016-07-09 18:21:35 +03:00
|
|
|
```
|
|
|
|
|
2017-03-26 06:23:14 +03:00
|
|
|
Create the `kubedns` deployment:
|
2016-07-09 18:21:35 +03:00
|
|
|
|
2016-07-09 18:16:09 +03:00
|
|
|
```
|
2016-09-11 16:20:02 +03:00
|
|
|
kubectl create -f https://raw.githubusercontent.com/kelseyhightower/kubernetes-the-hard-way/master/deployments/kubedns.yaml
|
2016-07-09 18:21:35 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
kubectl --namespace=kube-system get pods
|
|
|
|
```
|
2017-03-25 21:50:26 +03:00
|
|
|
|
2016-07-09 18:21:35 +03:00
|
|
|
```
|
2017-03-25 21:50:26 +03:00
|
|
|
NAME READY STATUS RESTARTS AGE
|
|
|
|
kube-dns-321336704-6749s 4/4 Running 0 10s
|
2016-09-11 16:20:02 +03:00
|
|
|
```
|