The MicroK8s cloud and Juju

List of supported clouds > MicroK8s

This document describes details specific to using your existing MicroK8s cloud with Juju.

See more: MicroK8s

When using the MicroK8s cloud with Juju, it is important to keep in mind that it is a (1) Kubernetes cloud and (2) not some other cloud.

See more: Cloud differences in Juju

As the differences related to (1) are already documented generically in our Tutorial, How-to guides, and Reference docs, here we record just those that follow from (2).

Juju points of variation Notes for the MicroK8s cloud
setup (chronological order):
CLOUD
supported versions: TBA
requirements: Your $USER will need to be a member of the MicroK8s group.
> See more: MicroK8s | Get started > 2. Join the group

You will need to enable the following MicroK8s add-ons:hostpath-storage and dns.
> See more: MicroK8s | MicroK8s addons

definition: Cf. kubeconfig file.

If you are an admin Juju user and your cloud is a local MicroK8s cloud: Juju retrieves your cloud definition automatically. Run juju clouds --all to confirm. (Pre-defined cloud name in Juju: microk8s.)

CREDENTIAL
definition: Cf. kubeconfig file.

If you are an admin Juju user and your cloud is a local MicroK8s cloud: Juju retrieves your credential definition automatically. Run juju credentials to confirm. (Pre-defined credential name in Juju: microk8s.)

auth-type: [certificate, clientcertificate, oauth2, oauth2withcert, userpass].

CONTROLLER
notes on bootstrap:
other (alphabetical order:)
CONFIGURATION (model)
cloud-specific: TBA
CONSTRAINT
conflicting:
allocate-public-id :negative_squared_cross_mark:
arch :white_check_mark:
container :negative_squared_cross_mark:
cores :negative_squared_cross_mark:
cpu-power :white_check_mark:
Non-standard: cpu-power=100 is 1/10 of a core. cpu-power is measured in millicores as defined by Kubernetes.
instance-role :negative_squared_cross_mark:
instance-type :negative_squared_cross_mark:
mem :white_check_mark:
root-disk :white_check_mark:
root-disk-source :negative_squared_cross_mark:
spaces :negative_squared_cross_mark:
tags :negative_squared_cross_mark:
virt-type :negative_squared_cross_mark:
zones TBA
PLACEMENT DIRECTIVE
<machine> TBA
subnet=... :negative_squared_cross_mark:
system-id=... :negative_squared_cross_mark:
zone=... TBA
RESOURCE (cloud)

Consistent naming, tagging, and the ability to add user-controlled tags to created instances.

:negative_squared_cross_mark:

There’s an open bug which results in the microk8s installation failing. microk8s needs to be installed before juju and the user has to be in the microk8s group before installing juju or else the installation will fail.

See: Bug #1881769 “Snap installation of microk8s fails when juju snap...” : Bugs : juju

Thanks for mentioning this @sesopenko. I’ve swapped the order around to make it clear that MicroK8s should be installed before Juju.

It also ran out of memory when trying to bootstrap it in a VM with only 4GB. Some minimum system requirements for microk8s with juju together would be helpful.

Nothing else refers to setting up such a storage pool (and indeed the charm deploys without having explicitly done so) - is this a holdover from a previous version somewhere?

Likely, yes. I’ll look into it.

1 Like

This is quite unfortunate. 4GB RAM is the recommended minimum currently, I believe. I’ve encountered issues at this size on another cluster before because Kubernetes was unable to deploy some background services alongside the Juju controller… The controller pod was deemed “unplaceable”.

It seems the videos are not found now. I guess the videos are still there somewhere, it’s just the links are not working now.
So I just removed them for now but we can bring them back anytime when we fixed the links.

hi @pedroleaoc do you have any ideas of how to fix those links?

Cheers
Kelvin

How to use MicroK8s with Juju says:

Add your account to the microk8s group. This grants the account elevated privileges to the cluster, meaning that sudo will not be required to interact with microk8s:

sudo usermod -a -G microk8s $USER

This is not enough. You need to also run:

sudo chown -f -R $USER ~/.kube

This is stated in the microk8s installation instructions (MicroK8s - Get started) as well.

a suggestion for the next refresh: enabling the storage add-on brings now a warning that storage is deprecated and hostpath-storage should be used instead

It seems very odd that we’re not suggesting/recommending that people install the ingress add-on here. Without it you won’t have any kind of ingress controller configured so many http workloads won’t be reachable without hitting the pod IP and port directly (or service port and IP), which seems less than ideal.

Could we add that in?

Got this today while running this howto :

$ juju bootstrap microk8s micro                                                                                                 
Since Juju 3 is being run for the first time, it has downloaded the latest public cloud information.
ERROR "/var/snap/juju/21122/microk8s/credentials/client.config" does not exist: juju "3.0.0" can only work with strictly confined microk8s

$ snap list
Name        Version       Rev    Tracking       Publisher   Notes
[...]
juju        3.0.0         21122  latest/stable  canonical✓  -
microk8s    v1.25.4       4221   1.25/stable    canonical✓  classic

Refreshing the juju snap to 2.9/stable worked.

Microk8s no longer wants us to do that:

WARNING: Do not enable or disable multiple addons in one command.
         This form of chained operations on addons will be DEPRECATED in the future.
         Please, enable one addon at a time: 'microk8s enable <addon>'

results in

Warning: flag --classic ignored for strictly confined snap juju

Results in

ERROR "/var/snap/juju/23354/microk8s/credentials/client.config" does not exist: juju "3.1.5" can only work with strictly confined microk8s

I am facing the exact same issue. Any solution?

Edit: recent change in the doc solved the problem. It was a matter of version of microk8s.