A basic Juju Kubernetes demo


Quick Juju Kubernetes demo

On AWS, an example using dynamic persistent volumes and 2 charms related together.

juju bootstrap aws
juju deploy kubernetes-core
juju deploy aws-integrator
juju trust aws-integrator

Wait for juju status to go green.

juju scp kubernetes-master/0:config ~/.kube/config
juju add-k8s myk8scloud
juju add-model myk8smodel myk8scloud
juju create-storage-pool operator-storage kubernetes storage-class=juju-operator-storage storage-provisioner=kubernetes.io/aws-ebs parameters.type=gp2
juju create-storage-pool k8s-ebs kubernetes storage-class=juju-ebs storage-provisioner=kubernetes.io/aws-ebs parameters.type=gp2

The above can be set up ahead of time.

Run up the Juju GUI.

juju gui

Select the myk8smodel model.

Deploy mariadb.

juju deploy cs:~wallyworld/mariadb-k8s --storage database=10M,k8s-ebs

Now you can see the storage being created/attached using juju storage.

juju storage
juju storage --filesystem
juju storage --volume
juju storage --format yaml

You can also see the persistent volumes and volume claims being created in Kubernetes.

kubectl -n myk8smodel get all,pvc,pv

It will take a minue but the above Juju commands will ultimately show storage provisioned and attached the mariadb charm running.

Deploy gitlab and relate to mariadb.

juju deploy cs:~wallyworld/gitlab-k8s
juju relate gitlab mariadb

Because this is on AWS, an ELB is used to give gitlab a public hostname without needed to juju expose. You can see what this hostname is by running juju status.
Stick that hostname in a browser and it will take a few minutes (gitlab takes a while to start) but you’ll eventually get the gitlab login page.

Assorted questions

Juju, Kubernetes and microk8s

@wallyworld would you mind clarifying this pls? :slight_smile:


I believe the staging charmstore is needed to provide some of the resources for kubernetes charms. That bootstrap lets you target an alternate charmstore for testing.
Eventually staging will be rolled out onto the main charmstore and you won’t need to do the --config step.

‘juju trust aws-integrator’ allows aws-integrator to have access to your cloud credentials so that it can do things like set AWS roles on the units of Kubernetes. We’ve chosen a route that allows for a small charm that is easily audited, to provide additional functionality on a cloud, rather than allowing any charm access, and rather than having to implement all possible cloud requests.


@jameinel I mean what the actual commands are to get this demo going … it seems some may have gotten lost in between there somewhere. Trying to follow along and I couldn’t make sense of it. Thank you for elaborating none the less.


@jamesbeedy There was a typo in the bootstrap command - a missing space between aws and --config
I’ve updated the post.

To bootstrap, you do this

juju bootstrap aws --config charmstore-url=https://api.staging.jujucharms.com/charmstorejuju deploy cs:~johnsca/kube-core-awsjuju trust aws-integrator

And then hopefully what follows makes sense.