Kubernetes集群配置DNS服务(5)

# 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

kubernetes集群配置dns服务

通过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

kubernetes集群配置dns服务

通过curl容器访问前面创建的php留言板

# kubectl exec curl -- curl frontend

kubernetes集群配置dns服务

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/d6feea4ad2b981dbd021bedf1b332502.html