kubernetes deployer #0

Supports: xenial bionic


This charm provides auto deployment for kubernetes


This subordinate charm serves as a plugin for the Kubernetes cluster and manages a namespace. It support the following operations: - Creating resources using the kubernetes-deployer interface. - Adding networkpolicies on a namespace level.

Using the Charm

The charm is subordinate to a kubernetes master.

juju deploy ./kubernetes-deployer deployer
juju add-relation deployer kubernetes-master

Configuring the application

  • namespace: Every deployer is limited to one namespace. These namespaces should be unique per deployer charm!
  • isolated: Requires a Kubernetes cluster with network policy support such as the canal bundle. If true all pods within the namespace are isolated.

Important Notes

  • Namespaces which do not have any resources will be removed.
  • Do not use generateName in any resource manifest. kubectl apply is used behind the screens and does not support the auto creation of names. See the following issue.
  • Charms who are creating k8s resources via the deployer can use the get_uuid() function from the kubernetes-deployer interface to ensure unique resource names.
  • The deployer will add the following labels to any resource it creates:
    • deployer: name of the deployer who created the resource.
    • juju_unit: name of the juju unit application (minus the unit number).
    • model_uuid: uuid of the juju model.
    • juju_app: uuid of the juju unit created by the kubernetes-deployer interface.

How it works

The deployer stores all resources locally on the Kubernetes master and uses kubectl apply to create all requested resources. The deployer keeps the following dir structure:

|___ namespaces
|   |   default.yaml
|   |   dev.yaml
|   |   live.yaml
|___ network-policies
|___ dev-deployer-0
|   |   da83235577854e42ae7fceee159d9c15-0.yaml
|   |   da83235577854e42ae7fceee159d9c15-1.yaml
|___ live-deployer-0
    |   f01cd117171748d888d58890ad9143d7-0.yaml
    |   f01cd117171748d888d58890ad9143d7-1.yaml
    |   f01cd117171748d888d58890ad9143d7-3.yaml

Known issues

  • Resources will not be deleted when a resource requesting charm has multiple units where each unit requests different resources. This scenario occurs when a unit calls send_create_request() twice, once with an actual resource request and the second time with an empty list. The cleanup will trigger after the relation between the k8s-deployer and requesting charm is removed.


This software was created in the IDLab research group of Ghent University in Belgium. This software is used in Tengu, a project that aims to make experimenting with data frameworks and tools as easy as possible.


(boolean) When true, the pods will only be able to receive traffic from inside the same namespace.
(string) The namespace in which the deployments will be set-up.