mirror of
https://github.com/kelseyhightower/kubernetes-the-hard-way.git
synced 2025-12-15 17:28:58 +03:00
Update to Kubernetes 1.12.0 and add CoreDNS support
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
# Deploying the DNS Cluster Add-on
|
||||
|
||||
In this lab you will deploy the [DNS add-on](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/) which provides DNS based service discovery to applications running inside the Kubernetes cluster.
|
||||
In this lab you will deploy the [DNS add-on](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/) which provides DNS based service discovery, backed by [CoreDNS](https://coredns.io/), to applications running inside the Kubernetes cluster.
|
||||
|
||||
## The DNS Cluster Add-on
|
||||
|
||||
Deploy the `kube-dns` cluster add-on:
|
||||
Deploy the `coredns` cluster add-on:
|
||||
|
||||
```
|
||||
kubectl create -f https://storage.googleapis.com/kubernetes-the-hard-way/kube-dns.yaml
|
||||
kubectl apply -f https://storage.googleapis.com/kubernetes-the-hard-way/coredns.yaml
|
||||
```
|
||||
|
||||
> output
|
||||
|
||||
```
|
||||
service "kube-dns" created
|
||||
serviceaccount "kube-dns" created
|
||||
configmap "kube-dns" created
|
||||
deployment.extensions "kube-dns" created
|
||||
serviceaccount/coredns created
|
||||
clusterrole.rbac.authorization.k8s.io/system:coredns created
|
||||
clusterrolebinding.rbac.authorization.k8s.io/system:coredns created
|
||||
configmap/coredns created
|
||||
deployment.extensions/coredns created
|
||||
service/kube-dns created
|
||||
```
|
||||
|
||||
List the pods created by the `kube-dns` deployment:
|
||||
@@ -28,8 +30,9 @@ kubectl get pods -l k8s-app=kube-dns -n kube-system
|
||||
> output
|
||||
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
kube-dns-3097350089-gq015 3/3 Running 0 20s
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
coredns-699f8ddd77-94qv9 1/1 Running 0 20s
|
||||
coredns-699f8ddd77-gtcgb 1/1 Running 0 20s
|
||||
```
|
||||
|
||||
## Verification
|
||||
@@ -37,7 +40,7 @@ kube-dns-3097350089-gq015 3/3 Running 0 20s
|
||||
Create a `busybox` deployment:
|
||||
|
||||
```
|
||||
kubectl run busybox --image=busybox --command -- sleep 3600
|
||||
kubectl run busybox --image=busybox:1.28 --command -- sleep 3600
|
||||
```
|
||||
|
||||
List the pod created by the `busybox` deployment:
|
||||
@@ -49,8 +52,8 @@ kubectl get pods -l run=busybox
|
||||
> output
|
||||
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
busybox-2125412808-mt2vb 1/1 Running 0 15s
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
busybox-bd8fb7cbd-vflm9 1/1 Running 0 10s
|
||||
```
|
||||
|
||||
Retrieve the full name of the `busybox` pod:
|
||||
|
||||
Reference in New Issue
Block a user