Setting up CoreOS on homelab servers with static IPs
Work Notes
core01: 192.168.61
core02: 192.168.62
core03: 192.168.63
core04: 192.168.64
For each node core01,core02,core03,core04
core@coreXX ~ $ sudo vi /var/lib/coreos-install/user_data
core@coreXX ~ $ sudo rm -rf /var/lib/etcd2/*; sudo rm -f /etc/systemd/system/etcd*
core@coreXX ~ $ sudo reboot
FILE: /var/lib/coreos-install/user_data (core01)
--- snip --
#cloud-config
hostname: core01
ssh_authorized_keys:
- ssh-rsa ...
coreos:
etcd2:
# Static cluster
name: core01
advertise-client-urls: http://192.168.61:2379
initial-advertise-peer-urls: http://192.168.61:2380
initial-cluster: "core01=http://192.168.61:2380,core02=http://192.168.1.62:2380,core03=http://192.168.1.63:2380"
initial-cluster-state: new
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
listen-peer-urls: http://0.0.0.0:2380,http://0.0.0.0:7001
fleet:
public-ip: $public_ipv4
metadata: "role=services"
flannel:
interface: $public_ipv4
update:
reboot-strategy: "etcd-lock"
units:
- name: 00-eth0.network
runtime: true
content: |
[Match]
Name=eno1
[Network]
DNS=192.168.1.1
Address=192.168.61/24
Gateway=192.168.1.1
# To use etcd2, comment out the above service and uncomment these
# Note: this requires a release that contains etcd2
- name: etcd2.service
command: start
- name: fleet.service
command: start
- name: flanneld.service
drop-ins:
- name: 50-network-config.conf
content: |
[Service]
ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'
command: start
- name: docker-tcp.socket
command: start
enable: true
content: |
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
Service=docker.service
BindIPv6Only=both
[Install]
WantedBy=sockets.target
write_files:
- path: "/etc/motd"
permissions: "0644"
owner: "root"
content: |
--- My CoreOS Cluster ---
---snip--
core@core01 ~ $ etcdctl cluster-health
member 4374c5ef9f2370d6 is healthy: got healthy result from http://192.168.1.63:2379
member 45337feea7d7a60f is healthy: got healthy result from http://192.168.1.61:2379
member 6688d9448380b482 is healthy: got healthy result from http://192.168.1.62:2379
core@core02 ~ $ etcdctl member list
4374c5ef9f2370d6: name=core03 peerURLs=http://192.168.1.63:2380 clientURLs=http://192.168.1.63:2379 isLeader=true
45337feea7d7a60f: name=core01 peerURLs=http://192.168.1.61:2380 clientURLs=http://192.168.1.61:2379 isLeader=false
6688d9448380b482: name=core02 peerURLs=http://192.168.1.62:2380 clientURLs=http://192.168.1.62:2379 isLeader=false
core@core02 ~ $ fleetctl list-machines
MACHINE IP METADATA
497f6384... 192.168.1.61 role=services
9f8f9d8a... 192.168.1.62 role=services
c6d410a0... 192.168.1.63 role=services
No comments:
Post a Comment