Build SaaS for your containerized applications
KubePlus - Kubernetes Operator for Multi-Instance Multi-tenancy
KubePlus is a turn-key solution to transform any containerized application into a SaaS.
Multi-instance multi-tenancy (MIMT) is a software architecture pattern in which a dedicated instance of an application is provided per tenant. The typical adopters of this pattern are organizations that need to host and manage multiple instances of a software application for different tenants and effectively deliver that application as-a-service. KubePlus is a turn-key solution to build a multi-instance multi-tenancy (MIMT) pattern on Kubernetes and comes with end to end automation to help you deploy and manage your MIMT application on Kubernetes. This includes isolation and security between instances along with easy to use APIs for managing upgrades, customization and resource utilization.
KubePlus takes an application Helm chart and wraps it under a Kubernetes API (CRD). Whenever an application instance is created using this API, KubePlus ensures that every instance is created in a separate namespace and the required multi-tenancy policies are applied in order to ensure isolation between instances. The API also supports RBAC, version upgrades and additional customizations for each instance.
Isolation
KubePlus takes an application Helm chart and wraps it in a Kubernetes API. Application providers use this API to provision application instances on a cluster. KubePlus isolates each application instance in a separate Namespace. It adds a safety perimeter around such Namespaces using Kubernetes Network Policies and non-shared persistent volumes ensuring that each application instance is appropriately isolated from other instances. Additionally, it provides controls for application providers to deploy different tenant application instances on different worker nodes for node isolation.
Security
The KubePlus Operator does not need any admin-level permissions on a cluster for application providers. This allows application providers to offer their managed services on any K8s clusters including those owned by their customers. KubePlus comes with a small utility that allows you to create provider specific kubeconfig on a cluster in order to enable this RBAC. Application providers have an ability to create a consumer specific further limited kubeconfig to allow for self service provisioning of the instance as well.
Resource utilization
KubePlus provides controls to set per-namespace resource quotas. It also monitors usage of CPU, memory, storage, and network traffic at the application instance level. The collected metrics are available in different formats and can be pulled into Prometheus for historical usage tracking.
Upgrades
A new version of an application can be deployed by updating the application Helm chart under the existing Kubernetes API or registering the new chart under a new Kubernetes API. If the existing Kubernetes API object is updated, KubePlus will deploy the new application instances using the new version of the application Helm chart.
Customization
The spec properties of the Kubernetes API wrapping the application Helm chart are the fields defined in the chart’s values.yaml file. Application deployments can be customized by specifying different values for these spec properties.
KubePlus architecture details are available here. KubePlus is a referenced solution for multi-customer tenancy in Kubernetes.
Demo
KubePlus-demo.mp4
Example
Let’s look at an example of creating a multi-instance WordPress Service using KubePlus. The WordPress service provider goes through the following steps towards this on their cluster:
Create cluster (or using existing cluster). For testing purposes you can create a minikube cluster:
$ minikube start --kubernetes-version=v1.24.3
Download KubePlus plugins and set up the PATH
wget "https://github.com/cloud-ark/kubeplus/blob/master/kubeplus-kubectl-plugins.tar.gz?raw=true"
mv kubeplus-kubectl-plugins.tar.gz\?raw=true kubeplus-kubectl-plugins.tar.gz
gunzip kubeplus-kubectl-plugins.tar.gz
tar -xvf kubeplus-kubectl-plugins.tar
export KUBEPLUS_HOME=pwd
export PATH=$KUBEPLUS_HOME/plugins:$PATH
Set the Namespace in which to deploy KubePlus
export KUBEPLUS_NS=<namespace in which you want to run KubePlus>
Create provider kubeconfig using the provider-kubeconfig.py utility that we provide
wget https://raw.githubusercontent.com/cloud-ark/kubeplus/master/requirements.txt
wget https://raw.githubusercontent.com/cloud-ark/kubeplus/master/provider-kubeconfig.py
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
python3 provider-kubeconfig.py create $KUBEPLUS_NS
Install KubePlus Operator using the generated provider kubeconfig
helm install kubeplus "https://github.com/cloud-ark/operatorcharts/blob/master/kubeplus-chart-3.0.30.tgz?raw=true" --kubeconfig=kubeplus-saas-provider.json -n $KUBEPLUS_NS
until kubectl get pods -A | grep kubeplus | grep Running; do echo "Waiting for KubePlus to start.."; sleep 1; done
Create API wrapping WordPress Helm chart.
The WordPress Helm chart can be specified as a public url or can be available locally.
kubectl create -f https://raw.githubusercontent.com/cloud-ark/kubeplus/master/examples/multitenancy/wordpress/wordpress-service-composition.yaml --kubeconfig=kubeplus-saas-provider.json
kubectl get resourcecompositions
kubectl describe resourcecomposition wordpress-service-composition
If the status of the wordpress-service-composition indicates that the new CRD has been created successfully, verify it:
kubectl get crds
You should see wordpressservices.platformapi.kubeplus
CRD registered.
Create WordpressService instance1
kubectl create -f https://raw.githubusercontent.com/cloud-ark/kubeplus/master/examples/multitenancy/wordpress/tenant1.yaml --kubeconfig=kubeplus-saas-provider.json
Create WordpressService instance2
kubectl create -f https://raw.githubusercontent.com/cloud-ark/kubeplus/master/examples/multitenancy/wordpress/tenant2.yaml --kubeconfig=kubeplus-saas-provider.json
Check created WordpressService instances
kubectl get wordpressservices
NAME AGE
wp-tenant1 86s
wp-tenant2 26s
Check the details of created instance:
kubectl describe wordpressservices wp-tenant1
Check created application resources
kubectl appresources WordpressService wp-tenant1 –k kubeplus-saas-provider.json
```
NAMESPACE KIND NAME
default WordpressService wp-tenant1
wp-tenant1 PersistentVolumeClaim mysql-pv-claim
wp-tenant1 PersistentVolumeClaim wp-for-tenant1
wp-tenant1 Service wordpress-mysql
wp-tenant1 Service wp-for-tenant1
wp-tenant1 Deployment mysql
wp-tenant1 Deployment wp-for-tenant1
wp-tenant1 Pod mysql-76d6d9bdfd-2wl2p
wp-tenant1 Pod wp-for-tenant1-87c4c954-s2cct
wp-tenant1 NetworkPolicy allow-external-traffic
wp-tenant1 NetworkPolicy restrict-cross-ns-traffic
wp-tenant1 ResourceQuota wordpressservice-wp-tenant1
</code></pre>
<ol>
<li>Check application resource consumption</li>
</ol>
<p><code>kubectl metrics WordpressService wp-tenant1 $KUBEPLUS_NS -k kubeplus-saas-provider.json</code></p>
<pre><code>----------------------------------------------------------
Kubernetes Resources created:
Number of Sub-resources: -
Number of Pods: 2
Number of Containers: 2
Number of Nodes: 1
Number of Not Running Pods: 0
Underlying Physical Resoures consumed:
Total CPU(cores): 0.773497m
Total MEMORY(bytes): 516.30859375Mi
Total Storage(bytes): 40Gi
Total Network bytes received: 0
Total Network bytes transferred: 0
----------------------------------------------------------
</code></pre>
<ol>
<li>
<p>Cleanup</p>
<pre><code>kubectl delete wordpressservice wp-tenant1 --kubeconfig=kubeplus-saas-provider.json
kubectl delete wordpressservice wp-tenant2 --kubeconfig=kubeplus-saas-provider.json
kubectl delete resourcecomposition wordpress-service-composition --kubeconfig=kubeplus-saas-provider.json
helm delete kubeplus -n $KUBEPLUS_NS
python3 provider-kubeconfig.py delete $KUBEPLUS_NS
</code></pre>
</li>
</ol>
Try
<ol>
<li>
<p>Examples:</p>
<ul>
<li><a href="https://github.com/cloud-ark/kubeplus/blob/master/./examples/multitenancy/hello-world/steps.txt" rel="nofollow">Hello world</a></li>
<li><a href="https://github.com/cloud-ark/kubeplus/blob/master/./examples/multitenancy/wordpress/steps.txt" rel="nofollow">Wordpress</a></li>
<li><a href="https://github.com/cloud-ark/kubeplus/blob/master/./examples/multitenancy/odoo/steps.txt" rel="nofollow">Bitnami Odoo chart</a></li>
</ul>
</li>
<li>
<p>Run tests</p>
</li>
</ol>
<pre><code> cd tests
python3 -m unittest -v tests
</code></pre>
<ol>
<li>Troubleshoot</li>
</ol>
<pre><code> kubectl logs <kubeplus-pod> -c crd-hook
kubectl logs <kubeplus-pod> -c helmer
kubectl exec -it <kubeplus-pod> -c kubeconfiggenerator /bin/bash; tail -100 /root/kubeconfiggenerator.log
</code></pre>
Case studies
<ol>
<li>
<p><a href="https://cloudark.medium.com/kubeplus-verified-to-deliver-managed-services-with-100-bitnami-helm-charts-57eae3b9f6a6" rel="nofollow">Bitnami Charts</a></p>
</li>
<li>
<p><a href="https://cloudark.medium.com/building-a-managed-jenkins-service-for-ut-austin-a-case-study-with-kubeplus-bdc082032f73" rel="nofollow">Managed Jenkins Service at UT Austin</a></p>
</li>
</ol>
CNCF Landscape
<p>KubePlus is part of CNCF landscape's
<a href="https://landscape.cncf.io/card-mode?category=application-definition-image-build&grouping=category" rel="nofollow">Application Definition section</a>.</p>
Operator Maturity Model
<p>As enterprise teams build their custom Kubernetes platforms using community or in house developed Operators, they need a set of guidelines for Operator readin
ess in multi-Operator and multi-tenant environments.
We have developed the <a href="https://github.com/cloud-ark/kubeplus/blob/master/Guidelines.md" rel="nofollow">Operator Maturity Model</a> for this purpose. Operator developers are using this model today to ensure that their Operator is a good citizen of the multi-Operator world and ready
to serve multi-tenant workloads. It is also being used by Kubernetes cluster administrators for curating community Operators towards building their custom pl
atforms.</p>
Presentations
<ol>
<li>
<p><a href="https://github.com/cloud-ark/kubeplus/blob/master/KubePlus-presentation.pdf" rel="nofollow">KubePlus presentation at community meetings (CNCF sig-app-delivery, Kubernetes sig-apps, Helm)</a></p>
</li>
<li>
<p><a href="https://webinars.devops.com/deliver-your-kubernetes-applications-as-a-service" rel="nofollow">DevOps.com Webinar: Deliver your Kubernetes Applications as-a-Service</a></p>
</li>
<li>
<p><a href="https://www.youtube.com/watch?v=NEGs0GMJbCw&t=2s" rel="nofollow">Being a good citizen of the Multi-Operator world, Kubecon NA 2020</a></p>
</li>
<li>
<p><a href="https://youtu.be/F_Dgz1V5Q2g" rel="nofollow">Operators and Helm: It takes two to Tango, Helm Summit 2019</a></p>
</li>
</ol>
Contact
<p>For support and new features <a href="https://cloudark.io/kubeplus-saas-manager" rel="nofollow">reach out to us</a>
or contact our team on <a href="https://join.slack.com/t/cloudark/shared_invite/zt-2yp5o32u-sOq4ub21TvO_kYgY9ZfFfw" rel="nofollow">Slack</a>.</p>
Twice a month we will interview people behind open source businesses. We will talk about how they are building a business on top of open source projects.
We'll never share your email with anyone else.