2

使用 Kube-Sky 插件运行 Guestbook Kubernetes 应用程序。在留言簿应用程序页面上,我在 JavaScript 控制台中收到此错误:

Fatal error:  Uncaught exception 'Predis\Connection\ConnectionException' with message 'php_network_getaddresses: getaddrinfo failed: Name or service not known [tcp://redis-slave:6379]' in /vendor/predis/predis/lib/Predis/Connection/AbstractConnection.php:141

以下是我可以在我的设置中找到的与 DNS 相关的所有更改(与提供的模板相比):

diff -r sample-configs/unmodified/cloud-init/node.yaml sample-configs/defaults/cloud-init/node.yaml
88a91,92
>         --cluster_dns=10.100.88.88 \
>         --cluster_domain=cluster.local \

diff -r sample-configs/unmodified/skydns-controller.yaml sample-configs/defaults/skydns-controller.yaml
11c11
<   replicas: {{ pillar['dns_replicas'] }}
---
>   replicas: 3
50c50,51
<         - -domain={{ pillar['dns_domain'] }}
---
>         - -domain=cluster.local
>         - -kube_master_url=http://$(KUBERNETES_MASTER_IPV4):8080
62c63
<         - -domain={{ pillar['dns_domain'] }}.
---
>         - -domain=cluster.local.
91c92
<         - -cmd=nslookup kubernetes.default.svc.{{ pillar['dns_domain'] }} 127.0.0.1 >/dev/null
---
>         - -cmd=nslookup kubernetes.default.svc.cluster.local 127.0.0.1 >/dev/null
diff -r sample-configs/unmodified/skydns-service.yaml sample-configs/defaults/skydns-service.yaml
13c13,14
<   clusterIP:  {{ pillar['dns_server'] }}
---
>   clusterIP:  10.100.88.88
>   type: NodePort
17a19
>     nodePort: 
20a23
>     nodePort: 
\ No newline at end of file

./sample-configs/unmodified/cloud-init/master.yaml:        --service-cluster-ip-range=10.100.0.0/16 \

NAMESPACE     NAME                 READY     STATUS    RESTARTS   AGE       NODE
default       frontend-jw0ud       1/1       Running   0          48m       $publicip.23
default       frontend-mwu18       1/1       Running   0          48m       $publicip.23
default       frontend-o33ei       1/1       Running   0          48m       $publicip.26
default       redis-master-ubpga   1/1       Running   0          46m       $publicip.23
default       redis-slave-7aqp9    1/1       Running   0          46m       $publicip.97
default       redis-slave-w6rn3    1/1       Running   0          46m       $publicip.26
default       redis-slave-wny9v    1/1       Running   0          46m       $publicip.26
kube-system   kube-dns-v9-jek26    4/4       Running   0          50m       $publicip.23
kube-system   kube-dns-v9-ua150    4/4       Running   0          50m       $publicip.26
kube-system   kube-dns-v9-ycloq    4/4       Running   0          50m       $publicip.97
NAMESPACE     NAME           CLUSTER_IP       EXTERNAL_IP   PORT(S)         SELECTOR            AGE
default       frontend       10.100.221.197   nodes         80/TCP          name=frontend       46m
default       kubernetes     10.100.0.1       <none>        443/TCP         <none>              1h
default       redis-master   10.100.151.114   <none>        6379/TCP        name=redis-master   46m
default       redis-slave    10.100.223.227   nodes         6379/TCP        name=redis-slave    46m
kube-system   kube-dns       10.100.88.88     nodes         53/UDP,53/TCP   k8s-app=kube-dns    46m
NAMESPACE     CONTROLLER     CONTAINER(S)   IMAGE(S)                                             SELECTOR            REPLICAS   AGE
default       frontend       php-redis      kubernetes/example-guestbook-php-redis:v2            name=frontend       3          48m
default       redis-master   master         redis                                                name=redis-master   1          46m
default       redis-slave    worker         kubernetes/redis-slave:v2                            name=redis-slave    3          46m
kube-system   kube-dns-v9    etcd           gcr.io/google_containers/etcd:2.0.9                  k8s-app=kube-dns    3          50m
                             kube2sky       gcr.io/google_containers/kube2sky:1.11                                   
                             skydns         gcr.io/google_containers/skydns:2015-10-13-8c72f8c                       
                             healthz        gcr.io/google_containers/exechealthz:1.0  


$ rkubectl  exec busybox -- nslookup kubernetes
Server:    10.100.88.88
Address 1: 10.100.88.88

nslookup: can't resolve 'kubernetes'
error: error executing remote command: Error executing command in container: Error executing in Docker Container: 1
$ rkubectl  exec busybox -- ping -w 1 10.100.88.88
PING 10.100.88.88 (10.100.88.88): 56 data bytes

--- 10.100.88.88 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
error: error executing remote command: Error executing command in container: Error executing in Docker Container: 1

$ rkubectl  exec busybox -- route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.17.42.1     0.0.0.0         UG    0      0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0

$ rkubectl  exec busybox -- ifconfig
eth0      Link encap:Ethernet  HWaddr 02:42:AC:11:00:1A  
          inet addr:172.17.0.26  Bcast:0.0.0.0  Mask:255.255.0.0

$ rkubectl  exec busybox -- cat /etc/resolv.conf
nameserver 10.100.88.88
nameserver 8.8.8.8
nameserver 8.8.4.4
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
4

0 回答 0