Hello all,
I have been working on getting up to speed with the new Operator framework, and also have been doing a lot of testing against microk8s, as part of my usual responsibilities as an Engineering Manager on the Juju core team.
To those ends, I’ve made a “microk8s testbed” charm, to automate the process of spinning up a cloud vm, installing microk8s on it, and setting up a juju model on the microk8s cluster.
Code:
My WIP code lives here (this is a personal project at this point – if we decide to formalize it, we’ll move it elsewhere):
https://github.com/petevg/microk8s-testbed
Deploying it
# Install Juju 2.9 rc5
sudo snap refresh juju --channel 2.9/candidate
# or
sudo snap install juju --channel 2.9/candidate --classic
# Boostrap a 2.9 rc5 controller
juju bootstrap <cloud> microk8s-testbed
# Deploy the charm on an adequately specced machine
juju deploy microk8s-testbed --constraints "cores=2 mem=8G root-disk=40G"
Once the machine is up – you can monitor with watch --color "juju status --color"
, ssh into it:
juju ssh microk8s-testbed/0
… and from within that machine, you should be able to do juju status
, where you will see a brand new kubernetes cloud!
Request for feedback
I’d love some feedback on this charm. Namely:
- Does the approach that I took to the Operator framework make sense?
- The code is very procedural, and there might be a more elegant way of doing things.
- Did I pick up on all of the event hooks and syntactic sugar that I could have used?
- Is this sort of charm useful to you?
- E.g., would you like to see a
microkstack-testbed
charm, or ajuju dev envrionment
charm? - I have company paid cloud creds at hand, and work in an Ubuntu environment with a local lxc cloud and virtual MAAS, which makes Juju an intersting tool for setting up, tearing down, and recreating development environments. How does this workflow feel to others?
- E.g., would you like to see a
- Does juju nesting juju feel weird to you?
- This is a fairly normal part of my workflow, but I know that it is a bit odd to use a juju client to ssh to a machine where you use another juju client.
- I can’t think of a “charming” way to register the microk8s cloud with the juju client residing on the host machine, but I wonder if it might be wise to add some external scripting, or a juju plugin, around this.