2 test node to form a LXD cluster instead of a single node

This commit is contained in:
Khue Doan 2021-02-16 17:55:06 +07:00
parent b4fc52b860
commit f2602aa749
3 changed files with 16 additions and 53 deletions

View File

@ -1,19 +1,21 @@
.POSIX:
NAME = homelab
NAME = metal
default: init metal infra
init:
multipass list | grep $(NAME) \
for count in 0 1; do \
multipass list | grep $(NAME)$$count \
|| multipass launch \
--cpus 4 \
--mem 8G \
--disk 64G \
--cloud-init ./multipass-cloud-init.yaml \
--name $(NAME) \
release:20.10
multipass exec homelab -- sed -i "$$ a\$(shell cat ~/.ssh/id_rsa.pub)" /home/ubuntu/.ssh/authorized_keys
--cpus 2 \
--mem 4G \
--disk 64G \
--cloud-init ./multipass-cloud-init.yaml \
--name $(NAME)$$count \
release:20.10; \
multipass exec $(NAME)$$count -- sed -i "$$ a\$(shell cat ~/.ssh/id_rsa.pub)" /home/ubuntu/.ssh/authorized_keys; \
done
shell:
multipass shell $(NAME)
@ -32,5 +34,7 @@ stop:
multipass stop $(NAME)
clean:
multipass delete $(NAME)
for count in 0 1; do \
multipass delete $(NAME)$$count; \
done
multipass purge

View File

@ -1,5 +1,3 @@
[metal]
homelab ansible_host=192.168.64.5 ansible_user=ubuntu
[etcd]
homelab
metal0 ansible_host=192.168.64.6 ansible_user=ubuntu
metal1 ansible_host=192.168.64.7 ansible_user=ubuntu

View File

@ -1,39 +0,0 @@
config:
core.https_address: 192.168.64.5:8443
core.trust_password: "1"
networks:
- config:
bridge.mode: fan
fan.underlay_subnet: auto
description: ""
name: lxdfan0
type: ""
project: default
storage_pools:
- config:
size: 50GB
description: ""
name: default
# TODO use btrfs in k8s 1.19.8 https://github.com/kubernetes/kubernetes/issues/94335
driver: lvm
profiles:
- config: {}
description: ""
devices:
eth0:
name: eth0
network: lxdfan0
type: nic
root:
path: /
pool: default
type: disk
name: default
cluster:
server_name: metal0
enabled: true
member_config: []
cluster_address: ""
cluster_certificate: ""
server_address: ""
cluster_password: ""