New to AppsCode Service Broker? Please start here.
Kubeapps is a web-based UI for deploying and managing applications in Kubernetes clusters. Using Kubeapps you can browse and provision external services exposed by a Service Catalog.
In this tutorial, we are going to show you how you can browse and manage database services provided by KubeDB in a Kubernetes cluster through the Kubeapps Dashboard.
Before we start, you need the following things:
A Kubernetes cluster(v1.9+), and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using Minikube.
Helm(v2.10.0+).
helm init
to install Tiller, the server-side component of Helm.You need to create a Kubernetes API token to access to the Kubeapps Dashboard and ensure that you can access it. To that end, follow Create a Kubernetes API token and Start the Kubeapps Dashboard sections.
After you have completed the prerequisite steps, you should be able to access the Kubeapps Dashboard.
If you select All Namespaces
from the drop-down list of namespaces, you should see namespaces like kubeapps
, catalog
, kubedb-operator
, appscode-service-broker
, etc.
You can click on the applications icon to see more information. Now go to the “Service Instances” page by clicking on the “Service Instances (alpha)” menu from the top menu bar. Then click “Deploy Service Instance” button and you will see the page that lists the services available from all the brokers installed in your cluster. Since you have only installed AppsCode Service Broker (according to this guide), this list contains services offered by AppsCode Service Broker. You can select any of the services from the gallery view.
Click “Select a plan” button on the icon for postgresql
service. Then a list of plans under this service will be shown.
In this section, you will learn how to use the following PostgreSQL service plans:
demo-postgresql
(Demo Standalone PostgreSQL database)postgresql
(PostgreSQL database with custom specification).demo-postgresql
PlanUsing this plan you can provision a demo PostgreSQL database with ephemeral storage in a Kubernetes cluster.
To provision a demo standalone PostgreSQL database, perform the following tasks:
demo-postgresql
plan on the list page postgresql
service class.Now, you get another modal dialog to input the parameters for provisioning. AppsCode Service Broker accepts only metadata and spec of Postgres CRD as parameters for the plans of postgresql
service. The metadata and spec should be provided with key "metadata"
and "spec"
respectively. The metadata is optional for all of the plans available. But the spec is required for the custom plan and it must be valid. Here we have used the following json
formatted metadata:
{
"metadata": {
"labels": {
"app": "my-postgres"
}
}
}
ProvisionedSuccessfully
as the reason in that page like below:All Namespaces
or default
from the drop-down list for namespaces and a list of current service instances in the selected namespace will be shown.In this section, we are going to bind the instance created in the previous section. To do so, follow the steps below:
postgresqldb
.postgresqldb
(same as the name of the instance).json
format for binding the instance. Currently, AppsCode Service Broker does not support any parameter for binding. So just keep it empty.postgresqldb
as InjectedBindResult
.You can unbind the newly created binding named postgresqldb
by clicking the “Remove” button on that page. Refresh the page afterwards and the binding will disappear.
To deprovision the previously created instance named postgresqldb
, just click “Deprovision” button and press “Delete” on the pop-up window. Refresh the page after several seconds. That’s it. Now you can check the “Service Instances” page by clicking the “Service Instances (alpha)” menu from the top menu bar and the instance should be gone.
postgresql
PlanUsing this plan you can provide a custom specification for PostgreSQL.
This section will show you how to provision postgresql
plan for PostgreSQL database using custom specification. Here are the steps:
postgresql
plan in the list page (the page that contains the list of plans for service named postgresql
).Now, you get another modal dialog to input the parameters for provisioning. AppsCode Service Broker accepts only metadata and spec of Postgres CRD as parameters for the plans of postgresql
service. The metadata and spec should be provided with key "metadata"
and "spec"
respectively. The metadata is optional for all of the plans available. But the spec is required for the custom plan and it must be valid. Here we have used the following json
formatted parameters for this custom postgresql
plan:
{
"metadata": {
"labels": {
"app": "my-postgres"
}
},
"spec": {
"storage": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "50Mi"
}
},
"storageClassName": "standard"
},
"terminationPolicy": "WipeOut",
"version": "10.2-v1"
}
}
Click “Submit”
Refresh the page after 10-15 seconds. You will see ProvisionedSuccessfully
as the reason in that page like below:
All Namespaces
or default
from the drop-down list for namespaces. You should see a list of current service instances in the selected namespace.In this section, we are going to bind the instance created in the previous section. Do the followings steps:
postgresqldb
.postgresqldb
(same as the name of instance).json
format for binding the instance. Currently, AppsCode Service Broker does not support any parameters for binding. So just keep it empty.postgresqldb
set to InjectedBindResult
.You can unbind the newly created binding named postgresqldb
by clicking the “Remove” button on that page. Refresh the page afterwards and the binding will disappear.
To deprovision the previously created instance named postgresqldb
for plan postgresql
, just click “Deprovision” button and press “Delete” to confirm on the pop-up dialog. Then refresh the page. That’s it. Now you can check the “Service Instances” page by clicking the “Service Instances (alpha)” menu from the top menu bar. You will see that the instance has disappeared.
Run the following commands to delete Service Catalog
$ helm delete --purge catalog
$ kubectl delete ns catalog
Run the following commands to delete Kubeapps
$ helm delete --purge kubeapps
$ kubectl delete ns kubeapps