You will need to create a cloud-config.yaml for each core os node in the cluster and build each coreos node individually using the file. Below is an example of one we made and used when building each coreos node. It is a three node cluster.
See our first node “core1” config below. Build the coreos system using this and once it is up and running move onto the next node.
#cloud-config
hostname: core1
users:
- name: core
passwd: ***password hash here***
groups:
- sudo
- docker
coreos:
etcd2:
name: core1
initial-advertise-peer-urls: http://192.168.1.201:2380
initial-cluster-token: etcd-cluster-1
initial-cluster: core1=http://192.168.1.201:2380,core2=http://192.168.1.202:2380,core3=http://192.168.1.203:2380
initial-cluster-state: new
listen-peer-urls: http://0.0.0.0:2380,http://0.0.0.0:7001
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
advertise-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
units:
- name: etcd2.service
command: start
- name: fleet.service
command: start
- name: 00-enp.network
runtime: true
content: |
[Match]
Name=enp*
[Network]
DNS=192.168.1.1
Address=192.168.1.201/24
Gateway=192.168.1.1
Our second node “core2” configuration is below, only a few fields needed to be updated to reflect name and IP
#cloud-config
hostname: core2
users:
- name: core
passwd: ***password hash here***
groups:
- sudo
- docker
coreos:
etcd2:
name: core2
initial-advertise-peer-urls: http://192.168.1.201:2380
initial-cluster-token: etcd-cluster-1
initial-cluster: core1=http://192.168.1.201:2380,core2=http://192.168.1.202:2380,core3=http://192.168.1.203:2380
initial-cluster-state: new
listen-peer-urls: http://0.0.0.0:2380,http://0.0.0.0:7001
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
advertise-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
units:
- name: etcd2.service
command: start
- name: fleet.service
command: start
- name: 00-enp.network
runtime: true
content: |
[Match]
Name=enp*
[Network]
DNS=192.168.1.1
Address=192.168.1.202/24
Gateway=192.168.1.1
Finally for the third node the following can be used. Similar to the last node only a few fields need to be changed
#cloud-config
hostname: core3
users:
- name: core
passwd: ***password hash here***
groups:
- sudo
- docker
coreos:
etcd2:
name: core3
initial-advertise-peer-urls: http://192.168.1.201:2380
initial-cluster-token: etcd-cluster-1
initial-cluster: core1=http://192.168.1.201:2380,core2=http://192.168.1.202:2380,core3=http://192.168.1.203:2380
initial-cluster-state: new
listen-peer-urls: http://0.0.0.0:2380,http://0.0.0.0:7001
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
advertise-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
units:
- name: etcd2.service
command: start
- name: fleet.service
command: start
- name: 00-enp.network
runtime: true
content: |
[Match]
Name=enp*
[Network]
DNS=192.168.1.1
Address=192.168.1.203/24
Gateway=192.168.1.1
Be sure that when you build each node you can use “journalctl -f” to verify whether each one is joining the cluster fine as you build it. After your second node joining the three node cluster you can use “etcdctl cluster-health” to verify them also, but going to the logfiles using journalctl is more verbose.
At this point when all the nodes are joined to your cluster try to reboot them and make sure the cluster comes up fine, it should be able to survive reboots.
Leave a Reply
You must be logged in to post a comment.