# cat busybox.yaml
apiVersion: v1
kind: Pod
metadata:
name: busybox
spec:
containers:
- name: busybox
image: docker.io/busybox
command:
- sleep
- "3600"# cat curl.yaml
apiVersion: v1
kind: Pod
metadata:
name: curl
spec:
containers:
- name: curl
image: docker.io/webwurst/curl-utils
command:
- sleep
- "3600"# kubectl create -f busybox.yaml
# kubectl create -f curl.yaml
通过busybox容器对kubernetes的service进行解析,发现service被自动解析成了对应的集群ip地址,而并不是172.16网段的docker地址
# kubectl get svc
# kubectl exec busybox -- nslookup frontend
# kubectl exec busybox -- nslookup Redis-master
# kubectl exec busybox -- nslookup redis-slave
通过curl容器访问前面创建的php留言板
# kubectl exec curl -- curl frontend