Wednesday, October 23, 2019

coredns: debugging - See logs

1. First open configmap from coredns
$ kubectl -n kube-system edit configmap coredns

2. Add log keyword
apiVersion: v1
data:
    Corefile: |
        .:53 {
        log
        errors
        health
       .........

3. Wait a little bit to propagate the change

4. Execute the DSN query 5. Look for the logs
$ for p in $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name); do kubectl logs --namespace=kube-system $p; done

You can also use dnstools:

$ kubectl exec -it -n default dnstools-74dd77498d-r8klc /bin/sh
dnstools# nslookup
> server 10.233.0.3
Default server: 10.233.0.3
Address: 10.233.0.3#53
> postgres.default.svc.cluster.local
Server: 10.233.0.3
Address: 10.233.0.3#53

Name: postgres.default.svc.cluster.local
Address: 10.233.59.55

More info: https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/

No comments:

Post a Comment