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
| 在Pod中发起访问
root@kube-node-1:~ NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES deathstar-86f85ffb4d-4ldsj 1/1 Running 0 4m1s 172.16.1.231 kube-node-2 <none> <none> deathstar-86f85ffb4d-dbzft 1/1 Running 0 4m1s 172.16.3.161 kube-node-3 <none> <none> tiefighter 1/1 Running 0 4m1s 172.16.3.247 kube-node-3 <none> <none> xwing 1/1 Running 0 4m1s 172.16.3.155 kube-node-3 <none> <none> root@kube-node-1:~ 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 11: eth0@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether f2:2a:b8:da:e7:d2 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 172.16.3.155/32 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::f02a:b8ff:feda:e7d2/64 scope link valid_lft forever preferred_lft forever root@kube-node-1:~ error: Internal error occurred: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "1b1120795a5b60f35bac5a4056a1714a5c0df32762e2a79f272cf2c82089e970": OCI runtime exec failed: exec failed: unable to start container process: exec: "ping": executable file not found in $PATH: unknown root@kube-node-1:~ { "name": "Death Star", "hostname": "deathstar-86f85ffb4d-4ldsj", "model": "DS-1 Orbital Battle Station", "manufacturer": "Imperial Department of Military Research, Sienar Fleet Systems", "cost_in_credits": "1000000000000", "length": "120000", "crew": "342953", "passengers": "843342", "cargo_capacity": "1000000000000", "hyperdrive_rating": "4.0", "starship_class": "Deep Space Mobile Battlestation", "api": [ "GET /v1", "GET /v1/healthz", "POST /v1/request-landing", "PUT /v1/cargobay", "GET /v1/hyper-matter-reactor/status", "PUT /v1/exhaust-port" ] }
在宿主机上进行抓包,可以看到两者之间是直接路由的。
root@ois:/home/ois/data/k8s tcpdump: listening on vnet92, link-type EN10MB (Ethernet), snapshot length 262144 bytes 11:11:11.478887 IP (tos 0x0, ttl 63, id 25688, offset 0, flags [DF], proto TCP (6), length 60) 172.16.3.155.37162 > 172.16.1.231.80: Flags [S], cksum 0x5dd1 (incorrect -> 0xdb07), seq 542023762, win 64240, options [mss 1460,sackOK,TS val 1624400247 ecr 0,nop,wscale 7], length 0 11:11:11.479178 IP (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto TCP (6), length 60) 172.16.1.231.80 > 172.16.3.155.37162: Flags [S.], cksum 0x5dd1 (incorrect -> 0x7b14), seq 3892089835, ack 542023763, win 65160, options [mss 1460,sackOK,TS val 727758081 ecr 1624400247,nop,wscale 7], length 0 11:11:11.479479 IP (tos 0x0, ttl 63, id 25689, offset 0, flags [DF], proto TCP (6), length 52) 172.16.3.155.37162 > 172.16.1.231.80: Flags [.], cksum 0x5dc9 (incorrect -> 0xa673), ack 1, win 502, options [nop,nop,TS val 1624400247 ecr 727758081], length 0 11:11:11.479552 IP (tos 0x0, ttl 63, id 25690, offset 0, flags [DF], proto TCP (6), length 130) 172.16.3.155.37162 > 172.16.1.231.80: Flags [P.], cksum 0x5e17 (incorrect -> 0x366d), seq 1:79, ack 1, win 502, options [nop,nop,TS val 1624400247 ecr 727758081], length 78: HTTP, length: 78 GET /v1 HTTP/1.1 Host: 172.16.1.231 User-Agent: curl/7.88.1 Accept: */*
11:11:11.479684 IP (tos 0x0, ttl 63, id 13836, offset 0, flags [DF], proto TCP (6), length 52) 172.16.1.231.80 > 172.16.3.155.37162: Flags [.], cksum 0x5dc9 (incorrect -> 0xa61e), ack 79, win 509, options [nop,nop,TS val 727758081 ecr 1624400247], length 0 11:11:11.480420 IP (tos 0x0, ttl 63, id 13837, offset 0, flags [DF], proto TCP (6), length 746) 172.16.1.231.80 > 172.16.3.155.37162: Flags [P.], cksum 0x607f (incorrect -> 0xc657), seq 1:695, ack 79, win 509, options [nop,nop,TS val 727758082 ecr 1624400247], length 694: HTTP, length: 694 HTTP/1.1 200 OK Content-Type: text/plain Date: Fri, 01 Aug 2025 03:11:11 GMT Content-Length: 591
{ "name": "Death Star", "hostname": "deathstar-86f85ffb4d-4ldsj", "model": "DS-1 Orbital Battle Station", "manufacturer": "Imperial Department of Military Research, Sienar Fleet Systems", "cost_in_credits": "1000000000000", "length": "120000", "crew": "342953", "passengers": "843342", "cargo_capacity": "1000000000000", "hyperdrive_rating": "4.0", "starship_class": "Deep Space Mobile Battlestation", "api": [ "GET /v1", "GET /v1/healthz", "POST /v1/request-landing", "PUT /v1/cargobay", "GET /v1/hyper-matter-reactor/status", "PUT /v1/exhaust-port" ] }
|