https://github.com/kelseyhightower/kubernetes-the-hard-way/blob/master/docs/12-dns-addon.md


CoreDNS 설치가 정상적으로 잘되는지 체크해보자


[root@master01 ~]# 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


## CoreDNS 가 설치되는 중간에 Error 가 발생하며 systemd-resolved 가 설치 안되어 있어서 CoreDNS 가 resolv 파일의 Path 를 찾지 못하는 이슈이다. 

yum install -y systemd-resolved

systemctl start systemd-resolved

systemctl enable systemd-resolved


[root@master01 ~]# kubectl get pods -l k8s-app=kube-dns -n kube-system

NAME                       READY   STATUS    RESTARTS   AGE

coredns-5677dc4cdb-6xgqj   1/1     Running   0          10m

coredns-5677dc4cdb-rh946   1/1     Running   0          10m



[root@master01 ~]# kubectl run busybox --image=busybox:1.28 --command -- sleep 3600

pod/busybox created

[root@master01 ~]# kubectl get pods -l run=busybox

NAME      READY   STATUS    RESTARTS   AGE

busybox   1/1     Running   0          7s

[root@master01 ~]# POD_NAME=$(kubectl get pods -l run=busybox -o jsonpath="{.items[0].metadata.name}")

[root@master01 ~]# kubectl exec -ti $POD_NAME -- nslookup kubernetes

Server:    10.32.0.10

Address 1: 10.32.0.10




+ Recent posts