Juju 101 - Update [6/12]

Overview

Duration: 3:00

Before you get started!

Welcome to the world of operators! In this series of tutorials, we will walk you through all the necessary steps to explore and learn operators through some basic examples. Starting with just your laptop, you will learn how to use operators for sophisticated application management at scale, across multiple Kubernetes clusters, cloud virtual machines, and ultimately bare metal.

This tutorial assumes you have successfully completed the previous tutorial - Integration.

Explore other tutorials >

What are operators?

Operators are pieces of software designed to drive other software. They encapsulate the operational code of applications, shifting the burden of lifecycle management from configuration files and manual steps to an operator instance. Operators are a form of automation that is gaining popularity in the Kubernetes domain where traditional configuration management does not work. However, operators work with traditional virtual and bare metal machines as well.

Learn more about operators >

What is Juju OLM?

Juju is a universal Operator Lifecycle Manager (OLM) which provides services to operators. It provides resources for operators, deploys them, manages their lifecycle, delivers configuration updates, etc. Juju OLM is universal, meaning that it supports container substrates like Kubernetes as well as traditional machine substrates like bare metal, VMware, OpenStack, or public cloud instances.

Learn more about Juju OLM >

In this tutorial, you will learn how to:

  • Update operators to a newer version

  • Update applications to a newer version with operators

You will only need:

  • A machine with 8 GB of RAM

  • Microk8s and Juju installed

  • Juju controller bootstrapped on MicroK8s

  • The Prometheus and Grafana operators deployed to Microk8s

Update operators and applications

Duration: 5:00

Operators and Juju OLM provide lifecycle management capabilities so that applications can be updated in a fully automated way.

In the following steps, we will update the Grafana application with an operator.

First, let’s see what the current status of the model is:


$ juju status
Model       Controller  Cloud/Region        Version  SLA          Timestamp
monitoring  mk8s        microk8s/localhost  2.9.9    unsupported  12:26:52+01:00

App             Version                  Status  Scale  Charm           Store     Channel  Rev  OS          Address         Message
grafana-k8s     grafana/grafana@7f26ece  active      1  grafana-k8s     charmhub  stable     1  kubernetes  10.152.183.126
prometheus-k8s  prom/prometheus:latest   active      2  prometheus-k8s  charmhub  stable     1  kubernetes  10.152.183.7

Unit               Workload  Agent  Address     Ports     Message
grafana-k8s/0*     active    idle   10.1.98.61  3000/TCP
prometheus-k8s/0*  active    idle   10.1.98.51  9090/TCP
prometheus-k8s/1   active    idle   10.1.98.5   9090/TCP

In previous tutorials, we deployed a Prometheus and a Grafana operator. Updating a Grafana operator can be achieved by running the following command:

$ juju refresh grafana-k8s
Looking up metadata for charmhub charm "grafana-k8s"
Added charmhub charm "grafana-k8s", revision 2 in channel stable, to the model
Leaving endpoints in "alpha": database, grafana, grafana-dashboard, grafana-source

Notice running microk8s.kubectl get pods -n monitoring will show the newly created pod (age is lower compared to the other pods).

$ microk8s.kubectl get pods -n monitoring
NAME                             READY   STATUS    RESTARTS   AGE
...
grafana-k8s-0                    1/1     Running   0          35s

If there are no new updates to be received then Juju will return a different result:

$ juju refresh grafana-k8s
ERROR already running latest charm "grafana-k8s"

That’s it. Your Grafana application is already using the latest version of the operator

Next steps

Duration: 2:00

Congratulations! You have reached the end of this tutorial.

You can now move to the next tutorial - “7. Teardown”.

In this tutorial you have learnt how to:

  • Update operators to a newer version

  • Update applications to a newer version with operators

Where to go from here?