From decc4b06e1cf7bf1d5e8fa18bf02dd3446f3b4e1 Mon Sep 17 00:00:00 2001 From: Anton Smith Date: Wed, 3 Nov 2021 14:13:00 +0100 Subject: [PATCH] cleaning up, adding more comments --- maas-setup.sh | 70 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/maas-setup.sh b/maas-setup.sh index 4636969..cf7c9e3 100644 --- a/maas-setup.sh +++ b/maas-setup.sh @@ -41,12 +41,24 @@ maas admin vm-hosts create password=password type=lxd power_address=https://${ # TODO find out the name of our vm host, and store this id in a variable maas admin vm-hosts read | jq '.[] | select (.name=="proud-possum") | .name, .id' # add a VM for the juju controller with minimal memory -# TODO use the variable for the VM host ID (below it is static 1) +# TODO use the variable for the VM host ID (below it is static 1). If you don't have 8 cores, change this to 4. maas admin vm-host compose 1 cores=8 memory=2048 architecture="amd64/generic" storage="main:16(pool1)" #TODO get the system_id from output of above, and use it with: -# maas admin tag update-nodes "juju-controller" add=$TAG +# maas admin tag update-nodes "juju-controller" add=$SYSTEM-ID - # Juju (note, this section requires manual intervention) +## Create 3 "bare metal" machines +maas admin vm-host compose 1 cores=8 memory=8192 architecture="amd64/generic" storage="main:25(pool1),ceph:150(pool1)" hostname="metal-1" +# TODO grab system-id and tag machine "metal" +maas admin vm-host compose 1 cores=8 memory=8192 architecture="amd64/generic" storage="main:25(pool1),ceph:150(pool1)" hostname="metal-2" +# TODO grab system-id and tag machine "metal" +maas admin vm-host compose 1 cores=8 memory=8192 architecture="amd64/generic" storage="main:25(pool1),ceph:150(pool1)" hostname="metal-3" +# TODO grab system-id and tag machine "metal" + +# Go to the MAAS UI, log in with username admin password admin, and tag the machines +# Browse to http://localhost:5240/MAAS/ - select the 3 machines metal-1, metal-2, and metal-3, click actions - add tag "metal" + +### Juju setup (note, this section requires manual intervention) +cd ~ sudo snap install juju --classic sed -i 's/IP_ADDRESS/${IP_ADDRESS}/' maas-cloud.yaml juju add-cloud --local maas-cloud maas-cloud.yaml @@ -56,54 +68,54 @@ juju credentials # Bootstrap the maas-cloud - get a coffee juju bootstrap maas-cloud --bootstrap-constraints "tags=juju-controller mem=2G" - - # 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 - -# TODO do we need to create ceph-mon machines? -maas admin vm-host compose 1 cores=8 memory=8192 architecture="amd64/generic" storage="main:25(pool1),ceph:150(pool1)" hostname="metal-1" -# TODO grab system-id and tag machine "metal" -maas admin vm-host compose 1 cores=8 memory=8192 architecture="amd64/generic" storage="main:25(pool1),ceph:150(pool1)" hostname="metal-2" -# TODO grab system-id and tag machine "metal" -maas admin vm-host compose 1 cores=8 memory=8192 architecture="amd64/generic" storage="main:25(pool1),ceph:150(pool1)" hostname="metal-3" -# TODO grab system-id and tag machine "metal" - - -# Deploy Ceph +### Ceph juju deploy -n 3 ceph-mon --to lxd:0,lxd:1,lxd:2 juju deploy --config ceph-osd.yaml cs:ceph-osd -n 3 --to 0,1,2 juju add-relation ceph-mon ceph-osd -# watch the fun (with a another coffee) +# watch the fun (with a another coffee). watch -c juju status --color +# Wait for Ceph to settle before proceeding -# deploy kubernetes-core with juju and re-use existing machines +### Kubernetes + +# Deploy kubernetes-core with juju and re-use existing machines. juju deploy kubernetes-core --map-machines=existing,0=0,1=1 -#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 +juju scp kubernetes-master/1:/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 +# add k8s to juju (choose option 1, client only) 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 + +### Deploying applications +# juju add-model some-model my-k8s +# juju deploy someapp(s) + +### Cleanup? not sure this always works. + +#juju destroy-controller -y --destroy-all-models --destroy-storage maas-cloud-default + +### Notes / LMA stack deployment +## 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 + +## random notes +# get some storage going +# https://jaas.ai/ceph-base +# https://jaas.ai/canonical-kubernetes/bundle/471 \ No newline at end of file