Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documents on deployment with consul? #291

Open
harryge00 opened this issue Dec 12, 2018 · 4 comments
Open

Documents on deployment with consul? #291

harryge00 opened this issue Dec 12, 2018 · 4 comments

Comments

@harryge00
Copy link

harryge00 commented Dec 12, 2018

I am not familiar with consul. I thought I need to run a consul server along with marathon-consul in Mesos-master. And run consul-agent in each Mesos-agent ?
I am a bit confused on the relationship between marathon-consul and consul-server, because there is no config about consul-server address...

@harryge00
Copy link
Author

harryge00 commented Dec 12, 2018

I finally set up consul server on the master and consul agent on the Mesos-node. However, I cannot register task to consul...

My marathon app JSON:

{
  "id": "consularppp",
  "cmd": null,
  "cpus": 0.1,
  "mem": 128,
  "disk": 0,
  "instances": 1,
  "container": {
    "docker": {
      "image": "nginx"
    },
    "type": "DOCKER"
  },
  "networks": [
    {
      "mode": "container/bridge"
    }
  ],
  "labels": {
    "consul-tag": "marathon",
    "consul": "",
    "varnish": "tag",
    "metrics": "tag"
  }
}

And marathon-consul log:

Dec 12 04:23:08 master marathon-consul[23974]: time="2018-12-12T04:23:08Z" level=info msg="Got StatusEvent" Id=consularppp.a07d49e9-fdc5-11e8-8989-0242ff8d8593 TaskSta
tus=TASK_STARTING
Dec 12 04:23:08 master marathon-consul[23974]: time="2018-12-12T04:23:08Z" level=info msg="Got StatusEvent" Id=consularppp.a07d49e9-fdc5-11e8-8989-0242ff8d8593 TaskSta
tus=TASK_RUNNING
 # curl http://127.0.0.1:8500/v1/catalog/services
{"consul":[]}

@harryge00
Copy link
Author

I read the code and found only healthy services are registered...

@harryge00
Copy link
Author

harryge00 commented Dec 13, 2018

I encounter problem again... How can I use marathon-consul as DNS?
My marathon task has registered:

# curl localhost:8500/v1/catalog/service/mes0sttt|python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   677  100   677    0     0  46004      0 --:--:-- --:--:-- --:--:-- 48357
[
    {
        "Address": "192.168.65.193",
        "CreateIndex": 1801,
        "Datacenter": "dc1",
        "ID": "4f3c0174-bce2-c138-d9fb-b3aed490eab4",
        "ModifyIndex": 1801,
        "Node": "agent-two",
        "NodeMeta": {
            "consul-network-segment": ""
        },
        "ServiceAddress": "192.168.65.193",
        "ServiceConnect": {},
        "ServiceEnableTagOverride": false,
        "ServiceID": "mes0sttt.04135489-fe7e-11e8-8922-0242d9be3463_mes0sttt_31485",
        "ServiceKind": "",
        "ServiceMeta": {},
        "ServiceName": "mes0sttt",
        "ServicePort": 31485,
        "ServiceProxy": {},
        "ServiceProxyDestination": "",
        "ServiceTags": [
            "marathon",
            "marathon-task:mes0sttt.04135489-fe7e-11e8-8922-0242d9be3463"
        ],
        "ServiceWeights": {
            "Passing": 1,
            "Warning": 1
        },
        "TaggedAddresses": {
            "lan": "192.168.65.193",
            "wan": "192.168.65.193"
        }
    }
]

But I cannot dig the FQDN:

dig @127.0.0.1 -p 8600 mes0sttt.service.consul


; <<>> DiG 9.9.4-RedHat-9.9.4-72.el7 <<>> @127.0.0.1 -p 8600 mes0sttt.service.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 16215
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;mes0sttt.service.consul.	IN	A

;; AUTHORITY SECTION:
consul.			0	IN	SOA	ns.consul. hostmaster.consul. 1544672991 3600 600 86400 0

;; Query time: 0 msec
;; SERVER: 127.0.0.1#8600(127.0.0.1)
;; WHEN: Thu Dec 13 03:49:51 UTC 2018
;; MSG SIZE  rcvd: 102

Maybe I need a Mesos-DNS in addition to marathon-consul?

@harryge00 harryge00 reopened this Dec 13, 2018
@Grant1219
Copy link

@harryge00

As long as I enabled DNS in the Consul agent configuration file, all registered services were available via DNS unless they have characters in the name that are not allowed in domain names. The marathon-consul logs will tell you if a service can't be registered with Consul DNS.

Does the consul service resolve in DNS for you? That should be registered by default.

$ dig @127.0.0.1 -p 8600 consul.service.consul +short
10.10.17.88
10.10.17.97
10.10.17.87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants