|
apiVersion: v1 kind: Pod
metadata:
name: webapp
labels:
app: webapp
spec:
hostNetwork: true
containers:
- name: webapp
image: tomcat
ports:
- containerPort: 8080
$ kubectl get po --all-namespaces -o wide --show-labels
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE LABELS
default webapp 1/1 Running 0 36s 192.168.x.x n2.ma.com app=webapp
查看该pod的网卡, 发现和宿主机一致
$ docker exec -it b8a1e1e35c3e ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
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
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:50:56:33:13:b6 brd ff:ff:ff:ff:ff:ff
inet 192.168.14.133/24 brd 192.168.14.255 scope global dynamic eth0
valid_lft 5356021sec preferred_lft 5356021sec
inet6 fe80::250:56ff:fe33:13b6/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default
link/ether 02:42:41:e8:f5:22 brd ff:ff:ff:ff:ff:ff
inet 10.2.100.1/24 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:41ff:fee8:f522/64 scope link
valid_lft forever preferred_lft forever
4: flannel.1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN group default
link/ether ae:4a:e1:f9:52:ea brd ff:ff:ff:ff:ff:ff
inet 10.2.100.0/32 scope global flannel.1
valid_lft forever preferred_lft forever
inet6 fe80::ac4a:e1ff:fef9:52ea/64 scope link
valid_lft forever preferred_lft forever
244: veth007dbe6@if243: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue master docker0 state UP group default
link/ether f2:02:e1:a2:9f:8a brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::f002:e1ff:fea2:9f8a/64 scope link
valid_lft forever preferred_lft forever |
|
|