1. namespace: isv-demo里的所有pod可以互相访问
# 2. namespace: isv-demo里的所有pod可以访问namespace: kube-system里的coredns的53端口
# 3. namespace: kube-system里的所有pod可以访问namespace: isv-demo里的所有pod
# 4. 访问外网限制: namespace: isv-demo里的所有pod可以访问除172.20.0.0/16(物理机)和172.23.0.0/16(calico)网段外的所有网段的80和443端口
web=$(kubectl get svc web -o jsonpath='{.spec.clusterIP}'):8800
#======在namespace:isv-demo里测试=======
kubectl run curl-$RANDOM --image=radial/busyboxplus:curl --rm -it --generator=run-pod/v1 -n isv-demo
# --> 访问isv-demo的web服务
[ root@curl-24497:/ ]$ curl web:8800
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
# --> 访问isv-demo的db服务
[ root@curl-24497:/ ]$ curl http://db:15984
{"couchdb":"Welcome","version":"3.0.0","git_sha":"03a77db6c","uuid":"05616a1b6f1eccbed4f24d3e6d5526d2","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
# --> 访问外网baidu
[ root@curl-24497:/ ]$ curl www.baidu.com
<!DOCTYPE html>
<!--STATUS OK--><html>
# --> ping外网baidu
[ root@curl-24497:/ ]$ ping www.baidu.com -c3 -W2
PING www.baidu.com (61.135.169.125): 56 data bytes
--- www.baidu.com ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss
# --> 访问开发者中心的web地址
[ root@curl-24497:/ ]$ curl 172.20.58.132 --connect-timeout 5
curl: (28) Connection timed out after 5001 milliseconds
# --> 访问kube-system的某Pod的calico的IP
[ root@curl-24497:/ ]$ ping 172.23.166.156 -c3 -W2
PING 172.23.166.156 (172.23.166.156): 56 data bytes
--- 172.23.166.156 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss
# --> 访问isv-demo里的pod的calico ip
[ root@curl-24497:/ ]$ ping 172.23.166.151
PING 172.23.166.151 (172.23.166.151): 56 data bytes
64 bytes from 172.23.166.151: seq=0 ttl=63 time=0.243 ms
[ root@curl-24497:/ ]$ exit
#======在namespace:kube-system里测试=======
kubectl run curl-$RANDOM --image=radial/busyboxplus:curl --rm -it --generator=run-pod/v1 -n kube-system
[ root@curl-23248:/ ]$ curl web.isv-demo:8800
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
[ root@curl-23248:/ ]$ curl web.isv-demo:8800
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
[ root@curl-23248:/ ]$ curl http://db.isv-demo:15984
{"couchdb":"Welcome","version":"3.0.0","git_sha":"03a77db6c","uuid":"05616a1b6f1eccbed4f24d3e6d5526d2","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
[ root@curl-23248:/ ]$ # exit