部署 DNS 擴展

本部分將部署 DNS 擴展,用於爲集群內的應用提供服務發現。

DNS 擴展

部屬 kube-dns 群集擴展:

kubectl apply -f https://storage.googleapis.com/kubernetes-the-hard-way/coredns-1.7.0.yaml

輸出爲

serviceaccount/coredns created
clusterrole.rbac.authorization.k8s.io/system:coredns created
clusterrolebinding.rbac.authorization.k8s.io/system:coredns created
configmap/coredns created
deployment.apps/coredns created
service/kube-dns created

列出 kube-dns 部署的 Pod 列表:

kubectl get pods -l k8s-app=kube-dns -n kube-system

輸出爲

NAME                       READY   STATUS    RESTARTS   AGE
coredns-5677dc4cdb-d8rtv   1/1     Running   0          30s
coredns-5677dc4cdb-m8n69   1/1     Running   0          30s

驗證

建立一個 busybox 部署:

列出 busybox 部署的 Pod:

輸出爲

查詢 busybox Pod 的全名:

busybox Pod 中查詢 DNS:

輸出爲

下一步:煙霧測試

Last updated