Getting started with Juju and Kubernetes

I’m trying to get started with Juju managing Charms on Kubernetes. I am having trouble with

I’ve spun up a clean 20.04 LXD instance, installed the juju snap and the microk8s snap, and, as per the linked documentation:

If you have installed MicroK8s, the cluster is already registered. Feel free to move to the next section.

which is

To add a model, use the juju add-model command

When I do this, I get an error about lack of controllers:

# juju add-model loremipsum
ERROR No controllers registered.

Please either create a new controller using "juju bootstrap" or connect to
another controller that you have been given access to using "juju register".

and when I try to juju bootstrap, I get an empty error:

# juju bootstrap
Clouds
aws
aws-china
aws-gov
azure
azure-china
cloudsigma
google
joyent
localhost
microk8s
oracle
oracle-classic
rackspace

Select a cloud [localhost]: microk8s

Enter a name for the Controller [microk8s-localhost]: 

ERROR 

Am I doing something wrong or missing something here?

# snap info microk8s | grep ^installed
installed:          v1.18.2                    (1379) 201MB classic
# snap info juju | grep ^installed
installed:          2.7.6                                (11454)  77MB classic

Thanks!

I believe that this might be related to the issue that @rick_h ran into yesterday. You may need to reboot the machine you created to get the ubuntu and root users to both be part of the microk8s group.

@rick_h did you file a bug about the above?

Hi @doismellburning, that sounds like a thorn in the docs. The page you’ve found assumes that you already have a controller available, which was necessary earlier in Juju’s life.

To bootstrap, you need to specify a cloud:

juju bootstrap microk8s <controller-name>

Could you please try the instructions on this page? They’re more recent than that one.

Thanks @timClicks, @pengale

I tried rebooting (to no avail) and I tried using the other instructions, which at least got me an error message:

root@juju-microk8s:~# juju bootstrap microk8s micro
ERROR getting namespace "controller-micro": Get https://localhost/api/v1/namespaces/controller-micro: dial tcp 127.0.0.1:443: connect: connection refused

So it looks like it’s trying to use default HTTPS :443 to talk to microk8s instead of :16443 as per https://discourse.ubuntu.com/t/services-and-ports/15544

I’m not sure why - I don’t see evidence of this having recently changed for microk8s, and I couldn’t see anything obvious in juju --help bootstrap that I could use as a workaround

@doismellburning I assume “juju-microk8s” is the LXD container? You shouldn’t need to execute juju commands as root, fyi.

@wallyworld / @kelvin.liu - it looks like something may be broken with the microk8s integration. Is a nested use case, e.g. running microk8s inside LXD, supported?

Yep, clean and fresh!

Indeed, thanks, I just didn’t bother switching user after getting in with lxc exec juju-microk8s bash

I ran through the tutorial again yesterday on a fresh instance and hit the same context-free “ERROR”. Digging a bit more, it turned out one of the components of my microk8s install hadn’t come up properly. Once I ran through the steps at MicroK8s in LXD, I got a much healthier microk8s instance and Juju bootstrapped successfully!

There’s a couple of things here that I think would really help from my perspective please:

Thanks for your help!

1 Like

I should have said this earlier, but thanks very much for taking the time to make these suggestions.

No worries - thanks for all the help!