在 mesos 集群上设置 Mesos-DNS dockerized

Setup Mesos-DNS dockerized on a mesos cluster

我在尝试 运行 mesos-dns docker 在 mesos 集群上化时遇到了一些麻烦。

我在 windows 8.1 主机上设置了 2 个 ubuntu trusty 虚拟机。 我的虚拟机名为 docker-vmdocker-sl-vm;第一个 运行s mesos-master 和第二个 运行s mesos-slave.

VM 有 2 个网卡;一个 运行ning NAT 用于通过主机访问互联网,另一个是用于内部通信的 Host-only 适配器。

VM 的 IP 是:

MESOS 集群 运行ning OK.

我正在尝试关注 this tutorial。所以,我 运行ning mesos-dns 具有以下马拉松描述:

{
    "args": [
        "/mesos-dns",
        "-config=/config.json"
    ],
    "container": {
        "docker": {
            "image": "mesosphere/mesos-dns",
            "network": "HOST"
        },
        "type": "DOCKER",
        "volumes": [
            {
                "containerPath": "/config.json",
                "hostPath": "/usr/local/mesos-dns/config.json",
                "mode": "RO"
            }
        ]
    },
    "cpus": 0.5,
    "mem": 256,
    "id": "mesos-dns",
    "instances": 1,
    "constraints": [["hostname", "CLUSTER", "docker-sl-vm"]]
}

和这个config.json:

{
    "zk": "zk://192.168.56.101:2181/mesos",
    "refreshSeconds": 60,
    "ttl": 60,
    "domain": "mesos",
    "port": 53,
    "resolvers": ["8.8.8.8"],
    "timeout": 5,
    "email": "root.mesos-dns.mesos"
}

我也在运行创建一个名为 peek 的测试提案应用程序,其描述如下:

{
  "id": "peek",
  "cmd": "env >env.txt && python3 -m http.server 8080",
  "cpus": 0.5,
  "mem": 32.0,
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "python:3",
      "network": "BRIDGE",
      "portMappings": [
        { "containerPort": 8080, "hostPort": 0 }
      ]
    }
  }
}

问题

进入教程,一个dig命令如dig _peek._tcp.marathon.mesos SRV得到如下答案:

; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> _peek._tcp.marathon.mesos SRV
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57329
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;_peek._tcp.marathon.mesos. IN  SRV

;; ANSWER SECTION:
_peek._tcp.marathon.mesos. 60   IN  SRV 0 0 31000 peek-27346-s0.marathon.mesos.

;; ADDITIONAL SECTION:
peek-27346-s0.marathon.mesos. 60 IN A   10.141.141.10

;; Query time: 4 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Oct 24 23:21:15 UTC 2015
;; MSG SIZE  rcvd: 160

我们可以清楚地看到绑定到 _peek._tcp.marathon.mesos SRV 的端口和 IP,BUT 当我 运行 在我的从机上 - 这是 运行宁这个容器 - 我得到这个结果:

docker@docker-sl-vm:~$ dig _peek._tcp.marathon.mesos SRV

; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> _peek._tcp.marathon.mesos SRV
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 33415
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;_peek._tcp.marathon.mesos. IN  SRV

;; AUTHORITY SECTION:
.           10791   IN  SOA a.root-servers.net. nstld.verisign-grs.com. 2015102801 1800 900 604800 241

;; Query time: 1 msec
;; SERVER: 10.10.11.1#53(10.10.11.1)
;; WHEN: Wed Oct 28 17:06:30 BRT 2015
;; MSG SIZE  rcvd: 129

看起来 mesos-dns 无法解析 _peek._tcp.marathon.mesos SRV。

有谁知道为什么以及如何解决它?

提前谢谢你...

更新

命令结果/etc/resolv.conf

nameserver 10.10.11.1
nameserver 10.10.10.7

查看 Mesos DNS docs 关于 从站设置:

To allow Mesos tasks to use Mesos-DNS as the primary DNS server, you must edit the file /etc/resolv.conf in every slave and add a new nameserver. For instance, if mesos-dns runs on the server with IP address 10.181.64.13, you should add the line nameserver 10.181.64.13 at the beginning of /etc/resolv.conf on every slave node.

我认为您的 /etc/resolv.conf 中缺少本地 IP (192.168.56.102) 地址。

否则,您也可以尝试my minimal Mesos DNS image,但您仍然需要编辑上述文件。