From fb7f47d70963baab133c9aff6664e00d0d3eb91c Mon Sep 17 00:00:00 2001 From: Anton Smith Date: Fri, 29 Oct 2021 19:12:13 +0200 Subject: [PATCH] added working juju/ceph storage setup, add k8s to juju, bootstrap, add models and deploy lma-light --- ceph-osd.yaml | 2 ++ maas-setup.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 ceph-osd.yaml diff --git a/ceph-osd.yaml b/ceph-osd.yaml new file mode 100644 index 0000000..b4a6fbf --- /dev/null +++ b/ceph-osd.yaml @@ -0,0 +1,2 @@ +ceph-osd: + osd-devices: /dev/sda \ No newline at end of file diff --git a/maas-setup.sh b/maas-setup.sh index d36b5c2..5f989d6 100644 --- a/maas-setup.sh +++ b/maas-setup.sh @@ -1,3 +1,7 @@ +# lxd / maas issue. either upgrade lxd or maas to 3.1 +sudo snap switch --channel=4.19/stable lxd +sudo snap refresh lxd + #get local interface name (this assumes a single default route is present) export INTERFACE=$(ip route | grep default | cut -d ' ' -f 5) export IP_ADDRESS=$(ip -4 addr show dev $INTERFACE | grep -oP '(?<=inet\s)\d+(\.\d+){3}') @@ -38,8 +42,7 @@ maas admin vm-hosts create password=password type=lxd power_address=https://${ maas admin vm-hosts read | jq '.[] | select (.name=="proud-possum") | .name, .id' # add a VM #TODO use the variable for the VM host ID (below it is static 1) -maas admin vm-host compose 1 cores=4 cpu_speed=300 memory=8192 architecture="amd64/generic" \ - storage="main:100(pool1)" +maas admin vm-host compose 1 cores=4 cpu_speed=300 memory=8192 architecture="amd64/generic" storage="main:100(pool1)" # Juju (note, this section requires manual intervention) sudo snap install juju --classic @@ -48,4 +51,52 @@ juju add-cloud --local maas-cloud maas-cloud.yaml juju add-credential maas-cloud juju clouds --local juju credentials -juju bootstrap maas-cloud \ No newline at end of file +juju bootstrap maas-cloud + + + +# fire up the juju gui to view the fun +juju gui +# get coffee + + +# get some storage going +# https://jaas.ai/ceph-base +# https://jaas.ai/canonical-kubernetes/bundle/471 +juju deploy -n 3 ceph-mon + +# add some machines for ceph-osd, 2 disks each +maas admin vm-host compose 1 cores=4 cpu_speed=300 memory=2048 architecture="amd64/generic" storage="main:8(pool1),ceph:80(pool1)" +maas admin vm-host compose 1 cores=4 cpu_speed=300 memory=2048 architecture="amd64/generic" storage="main:8(pool1),ceph:80(pool1)" +maas admin vm-host compose 1 cores=4 cpu_speed=300 memory=2048 architecture="amd64/generic" storage="main:8(pool1),ceph:80(pool1)" + +juju deploy --config ceph-osd.yaml cs:ceph-osd -n 3 +juju add-relation ceph-mon ceph-osd + +# add some machines for kubernetes-core +maas admin vm-host compose 1 cores=4 cpu_speed=300 memory=4096 architecture="amd64/generic" storage="main:24(pool1)" +maas admin vm-host compose 1 cores=4 cpu_speed=300 memory=4096 architecture="amd64/generic" storage="main:24(pool1)" +maas admin vm-host compose 1 cores=4 cpu_speed=300 memory=4096 architecture="amd64/generic" storage="main:24(pool1)" + +# deploy kubernetes-core with juju +juju deploy kubernetes-core +# add the new kubernetes as a cloud to juju +mkdir ~/.kube +juju scp kubernetes-master/0:/home/ubuntu/config ~/.kube/config + +# add storage relations +juju add-relation ceph-mon:admin kubernetes-master +juju add-relation ceph-mon:client kubernetes-master + +# add k8s to juju +juju add-k8s my-k8s +juju bootstrap my-k8s + +# add a model (k8s namespace) to the cluster +juju add-model k8s-model my-k8s + +# add an LMA model to the cluster +juju add-model lma my-k8s + +juju deploy lma-light --channel=edge --trust +#juju destroy-controller -y --destroy-all-models --destroy-storage maas-cloud-default \ No newline at end of file