首先参考这个配置部署nodelocaldns(参考)
apiVersion: apps/v1 kind: Deployment metadata: name: busybox-dns namespace: default spec: replicas: 2 selector: matchLabels: app: busybox-dns template: metadata: labels: app: busybox-dns spec: dnsPolicy: None dnsConfig: nameservers: - 169.254.20.10 searches: - svc.cluster.local - cluster.local options: - name: ndots value: "5" - name: single-request-reopen containers: - name: busybox-dns image: opcache/busybox:dns-go1.16
查询容器
kubectl get pods -o wide --all-namespaces |grep busy
进入容器,验证
kubectl exec -it busybox-795d5fc9dd-9ptcv -n default -- sh cat /etc/resolv.conf cd /usr/local/bin ./hello-dns -host kubernetes.default -c 200 -d 30 request count:239187 error count:0 request time:min(1ms) max(317ms) avg(23ms) timeout(0n)
k8s部署nodelocaldns监控模板参考
[…] k8s部署nodelocaldns监控采用kube-prometheus,验证方法参考,Grafana监控如下 […]