Juju with Google Kubernetes Engine (GKE)
Running through this guide will ensure that you’re ready to deploy and manage Kubernetes workloads on Google Kubernetes Engine (GKE) with Juju.
Juju provides built-in support for GKE. That means, once you’ve registered your cluster, you’ll be able to deploy workloads straight away.
This guide covers:
- making sure all necessary software is installed
- all configuration is in place
- a live Juju controller is available
- a Juju model has been created
Software to Install
Using Juju to drive Kubernetes workloads on AKS requires installing some pre-requisite software:
- Juju client
- Google Cloud SDK
- Kubernetes client
Juju client (
You will need to install Juju. If you’re on Linux, we recommend using snap:
snap install juju --classic
We also provide other installation methods as described on our detailed installation documentation.
Googe Cloud SDK (
Installing the Google Cloud SDK is easiest via snap:
snap install google-cloud-sdk --classic
Instructions for other
gcloud installation methods also also available.
Kubernetes client (
kubectl is the command-line client for directly interacting with a Kubernetes cluster. Visit the Kubernetes documentation for manual
kubectl installation instructions.
Provision a Kubernetes cluster on Google Kubernetes Engine
You will need to have an GKE cluster available before Juju can connect to it. It’s easy to do that via the cloud console.
When creating the default node pool, ensure that you request a machine type that provides at least 6 GB memory. This provides sufficient resources to enable Juju to be deployed alongside your workloads.
Linking the cluster to the local environment
The Google Cloud SDK will configure
kubectl on your behalf via the
gcloud container clusters get-credential command. Onc executed,
kubectl will be able to control your cluster directly.
gcloud container clusters get-credentials <k8s-cluster> --zone <zone> --project <project>
kubectl set up
To check that you have configured
kubectl correctly, execute a command:
kubectl get nodes
Set up Juju within the cluster
Now that the pieces are in place, let’s join them together. This is a three step process:
- registering the cluster as a “K8s cloud”
- deploying a Juju controller within the cluster
- creating a “model” (namespace) to house our deployment(s)
Register the cluster as a “K8s cloud”
In Juju’s vocabulary, a “cloud” is a space that can host deployed workloads. To register a Kubernetes cluster with Juju, execute the
juju add-k8s command. The
<cloud> will be used by Juju to refer to the cluster later on.
juju add-k8s --eks <cloud>
This command is interactive and will request that you provide details of its
Create a controller
Juju, as an active agent system, requires a controller to get started. Controllers are created with the
juju bootstrap command that takes a cloud’s name and our intended name for the controller.
juju bootstrap <cloud> <controller>
Create a model
A model is a workspace for inter-related applications. They correspond (roughly) to a Kubernetes namespace. To create one, use
juju add-model with a name of your choice:
juju add-model <model>
You’re now able to deploy workloads into your model. Workloads are provided by charms (and sets of charms called bundles).
Use the Kubernetes filter in the Charm Store to find Kubernetes workloads to deploy, e.g. Search results for | Juju.