【问题标题】:etcd dns-discovery within cloud-initcloud-init 中的 etcd dns-discovery
【发布时间】:2015-04-13 11:24:47
【问题描述】:

如何通过 cloud-init 使用 etcd 对等 dns 发现来引导 CoreOS 集群?

我只找到了使用发现令牌服务的示例,但没有发现 dns 发现。关于这方面的文档确实很少,但有时会被提及。

更新:

我正在寻找一种可能性来启动一个集群并为 etcd 使用 DNS 发现,如下所述:https://github.com/coreos/etcd/blob/a4018f25c91fff8f4f15cd2cee9f026650c7e688/Documentation/clustering.md#dns-discovery

理论上我想用“discover-srv:”之类的东西替换“discovery:”,但我不知道现在是否可以使用 cloud-init。到目前为止,我已经尝试过但失败了。

【问题讨论】:

  • 你是在谈论 etcd peer 发现,还是使用 skydns/registrator 发现容器?
  • 关于对等发现

标签: coreos


【解决方案1】:

看源码我觉得你需要的设置是命名的:

discovery_srv

在 etcd2 部分。我想它应该采用与您提供的链接中描述的相同的设置。它被翻译成环境变量 ETCD_DISCOVERY_SRV

另一个需要注意的设置是:

proxy
proxy_srv

例如猜测一下,类似下面的东西可能会起作用。我也有一种感觉,如果你使用破折号,它们会变成下划线,所以 discovery-srv 和 discovery_srv 可能是等价的。不要引用我的话!

coreos:
  etcd2:
    name: <hostname matching srv record>
    discovery_srv: example.com
    initial_cluster_state: new
    # multi-region and multi-cloud deployments need to use $public_ipv4
    advertise_client_urls: http://$public_ipv4:2379
    initial_advertise_peer_urls: http://$private_ipv4:2380
    # listen on both the official ports and the legacy ports
    # legacy ports can be omitted if your application doesn't depend on them
    listen_client_urls: http://0.0.0.0:2379,http://0.0.0.0:4001
    listen_peer_urls: http://$private_ipv4:2380,http://$private_ipv4:7001

--- 编辑---

我可以确认需要代理的节点的以下工作。

# cloud-config

coreos:
  etcd2:
    discovery-srv: example.com
    proxy: on
  units:
    name: etcd2.service
    command: start

【讨论】:

  • 终于有时间检查了:它有效,谢谢!添加代理成员有效。但是对我不起作用的是向集群添加一个新成员。新集群成员是否必须在启动时出现在 SRV 条目中?
  • 了解之后如何添加新成员:github.com/coreos/etcd/blob/master/Documentation/… - 新节点的 IP 必须在节点启动之前添加为 etcd 和 SRV 条目中的成员。
猜你喜欢
  • 2018-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-25
  • 2019-04-30
  • 2018-05-27
  • 2022-01-16
  • 1970-01-01
相关资源
最近更新 更多