无法正确配置CoreOS群集

时间:2016-05-24 18:08:00

标签: coreos

我无法配置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,因此我不清楚某些方面。

提前致谢

1 个答案:

答案 0 :(得分:0)

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