【问题标题】:Can not configure CoreOS cluster properly无法正确配置 CoreOS 集群
【发布时间】:2016-05-26 01:09:14
【问题描述】:

我一直在配置 CoreOS 集群。

我的 cloud_config 文件是两个虚拟机的下一个:

#cloud-config

ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1yc2EAAAA...

hostname: core001

coreos:
 etcd2:
  name: core001
  discovery: https://discovery.etcd.io/86567bce070bd5316bdc9357ee2600de
  # private networking need to use $public_ipv4:
  advertise-client-urls: http://192.168.128.156:2379,http://192.168.128.156:4001
  initial-advertise-peer-urls: http://192.168.128.156:2380
  # listen on the official ports 2379, 2380 and one legacy port 4001:
  listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
  listen-peer-urls: http://192.168.128.156:2380

 fleet:
  public-ip: 192.168.128.156
 units:
  - name: etcd2.service
    command: start
  - name: fleet.service
    command: start

write_files:
    -  path: /etc/systemd/network/enp0s8.network
       permissions: 0644
       owner: root
       content: |
         [Match]
         Name=enp0s8

         [Network]
         Address=192.168.128.156/22
         Gateway=192.168.128.1

users:
- name: test
  passwd: $1$yxV9YDKT$s.fAj5dlFyrPwrH0xAQJy/
  groups:
  - sudo
  - docker

#cloud-config

ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1y...

hostname: core002

coreos:
 etcd2:
  name: core001
  discovery: https://discovery.etcd.io/86567bce070bd5316bdc9357ee2600de
  # private networking need to use $public_ipv4:
  advertise-client-urls: http://192.168.128.157:2379,http://192.168.128.157:4001
  initial-advertise-peer-urls: http://192.168.128.157:2380
  # listen on the official ports 2379, 2380 and one legacy port 4001:
  listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
  listen-peer-urls: http://192.168.128.157:2380

 fleet:
  public-ip: 192.168.128.157
 units:
  - name: etcd2.service
    command: start
  - name: fleet.service
    command: start

write_files:
    -  path: /etc/systemd/network/enp0s8.network
       permissions: 0644
       owner: root
       content: |
         [Match]
         Name=enp0s8

         [Network]
         Address=192.168.128.157/22
         Gateway=192.168.128.1

users:
- name: test
  passwd: $1$yxV9YDKT$s.fAj5dlFyrPwrH0xAQJy/
  groups:
  - sudo
  - docker

我已经成功安装了两个节点,但是当我尝试运行时:

 core@core001 ~ $ fleetctl list-machines
 MACHINE        IP      METADATA
 cd08747e...    192.168.128.156 -

我只有一台机器。第二个节点也一样:

core@core002 ~ $ fleetctl list-machines
MACHINE     IP      METADATA
753caf1b... 192.168.128.157 -

我怀疑 etcd 可能有问题,但是通过大量的谷歌参考资料 - 我没有发现任何对这个案例有用的东西。

你能帮我解决这个问题吗?

我刚开始学习 CoreOS,所以有些方面对我来说还不清楚。

提前致谢

【问题讨论】:

    标签: coreos


    【解决方案1】:

    您已经创建了两个独立的单节点 etcd 集群。 etcd 日志可能会提示原因。我猜想重复名称 core001 可能有所贡献。

    【讨论】:

    • 你说得对,我注意到了。我也犯了一个大错误:我创建了不正确数量的节点,因为我为 3 个节点生成了发现令牌,但创建了 2 个。因此,etcd2 生成了大量带有错误的警告日志。一旦我为生成的令牌创建了足够数量的节点并正确重命名了 core001 - 它对我来说效果很好。非常感谢!
    猜你喜欢
    • 2018-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-24
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 2021-10-05
    相关资源
    最近更新 更多