kubernetes 中排查dns解析问题

参考官方:https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/

文档中提供的dnsutils镜像下载不到,修改镜像地址

wget https://k8s.io/examples/admin/dns/dnsutils.yaml

# cat dnsutils.yaml
apiVersion: v1
kind: Pod
metadata:
  name: dnsutils
  namespace: default
spec:
  containers:
  - name: dnsutils
    image: tutum/dnsutils
    command:
      - sleep
      - "infinity"
    imagePullPolicy: IfNotPresent
  restartPolicy: Always
# kubectl apply -f dnsutils.yaml
# kubectl get pod
NAME                     READY   STATUS    RESTARTS   AGE
dnsutils                 1/1     Running   0          27s
# kubectl exec -i -t dnsutils -- nslookup kubernetes.default
Server:         10.43.0.10
Address:        10.43.0.10#53

Name:   kubernetes.default.svc.cluster.local
Address: 10.43.0.1

 

posted @ 2023-04-13 16:15  晴天的柱子  阅读(48)  评论(0编辑  收藏  举报