mirror of
https://github.com/kelseyhightower/kubernetes-the-hard-way.git
synced 2025-12-16 01:38:58 +03:00
Still somewhat of a k8s n00b, so sorry if I'm out of line here, but I'd like to propose a small amendment to the output of the get pods command confirming the deployment of the kube-dns add-on. This seems like a deployment creating a single replicaset by default, the output should then list a single RS. From the deployment's YAML file: spec: # replicas: not specified here: # 1. In order to make Addon Manager do not reconcile this replicas parameter. # 2. Default is 1. # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on. Output of a describe of the resulting deployment: kubectl describe deployment kube-dns -n kube-system | grep ReplicaSet OldReplicaSets: <none> NewReplicaSet: kube-dns-6c857864fb (1/1 replicas created)
1.6 KiB
1.6 KiB
Deploying the DNS Cluster Add-on
In this lab you will deploy the DNS add-on which provides DNS based service discovery to applications running inside the Kubernetes cluster.
The DNS Cluster Add-on
Deploy the kube-dns cluster add-on:
kubectl create -f https://storage.googleapis.com/kubernetes-the-hard-way/kube-dns.yaml
output
serviceaccount "kube-dns" created
configmap "kube-dns" created
service "kube-dns" created
deployment "kube-dns" created
List the pods created by the kube-dns deployment:
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
Verification
Create a busybox deployment:
kubectl run busybox --image=busybox --command -- sleep 3600
List the pod created by the busybox deployment:
kubectl get pods -l run=busybox
output
NAME READY STATUS RESTARTS AGE
busybox-2125412808-mt2vb 1/1 Running 0 15s
Retrieve the full name of the busybox pod:
POD_NAME=$(kubectl get pods -l run=busybox -o jsonpath="{.items[0].metadata.name}")
Execute a DNS lookup for the kubernetes service inside the busybox pod:
kubectl exec -ti $POD_NAME -- nslookup kubernetes
output
Server: 10.32.0.10
Address 1: 10.32.0.10 kube-dns.kube-system.svc.cluster.local
Name: kubernetes
Address 1: 10.32.0.1 kubernetes.default.svc.cluster.local
Next: Smoke Test