1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| cat <<EOF | kubectl create -f - --- apiVersion: apps/v1 kind: DaemonSet metadata: name: net-tools labels: k8s-app: net-tools spec: selector: matchLabels: k8s-app: net-tools template: metadata: labels: k8s-app: net-tools spec: tolerations: - effect: NoSchedule operator: Exists - key: CriticalAddonsOnly operator: Exists - effect: NoExecute operator: Exists containers: - name: net-tools image: juestnow/net-tools command: - /bin/sh - "-c" - set -e -x; tail -f /dev/null resources: limits: memory: 30Mi requests: cpu: 50m memory: 20Mi dnsConfig: options: - name: single-request-reopen
EOF
root@Qist:/tmp# kubectl -n default get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES net-tools-29chz 1/1 Running 2 (5d18h ago) 14d 10.80.3.70 k8s-node-3 <none> <none> net-tools-2ngh4 1/1 Running 2 (5d16h ago) 14d 10.80.1.74 k8s-master-3 <none> <none> net-tools-7lsf2 1/1 Running 2 (5d16h ago) 14d 10.80.2.20 k8s-master-2 <none> <none> net-tools-lpnfk 1/1 Running 2 (5d16h ago) 14d 10.80.6.251 k8s-node-1 <none> <none> net-tools-p4bbq 1/1 Running 2 (5d16h ago) 14d 10.80.0.63 k8s-master-1 <none> <none> net-tools-sdkhr 1/1 Running 2 (5d18h ago) 14d 10.80.5.232 k8s-node-4 <none> <none> net-tools-sgjm2 1/1 Running 2 (5d16h ago) 14d 10.80.4.229 k8s-node-2 <none> <none>
kubectl -n default exec -ti net-tools-29chz /bin/sh / PING 10.80.1.74 (10.80.1.74): 56 data bytes 64 bytes from 10.80.1.74: seq=0 ttl=62 time=1.399 ms --- 10.80.1.74 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 1.399/1.399/1.399 ms
/
; <<>> DiG 9.14.8 <<>> www.qq.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8279 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ; COOKIE: e8e82d67cca18f90 (echoed) ;; QUESTION SECTION: ;www.qq.com. IN A
;; ANSWER SECTION: www.qq.com. 30 IN CNAME ins-r23tsuuf.ias.tencent-cloud.net. ins-r23tsuuf.ias.tencent-cloud.net. 30 IN A 121.14.77.221 ins-r23tsuuf.ias.tencent-cloud.net. 30 IN A 121.14.77.201
;; Query time: 30 msec ;; SERVER: 10.66.0.2 ;; WHEN: Wed Jan 17 02:21:42 UTC 2024 ;; MSG SIZE rcvd: 209
/ PING www.baidu.com (183.2.172.42): 56 data bytes 64 bytes from 183.2.172.42: seq=0 ttl=50 time=7.681 ms 64 bytes from 183.2.172.42: seq=1 ttl=50 time=7.655 ms 64 bytes from 183.2.172.42: seq=2 ttl=50 time=7.747 ms
--- www.baidu.com ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 7.655/7.694/7.747 ms
|