Deploy and Manage Applications with Kubeapps using the Oracle Container Engine

Introduction

Kubeapps is a web-based UI for deploying and managing applications in Kubernetes clusters. It allows your cluster users to deploy applications packaged as Helm charts directly from their browsers.

Bitnami has been working on making the experience of running Kubeapps on top of an Oracle Container Engine for Kubernetes (OKE) cluster great, including testing and improving Bitnami's authored Helm charts so they work out of the box in OKE clusters.

This guide will show how you can deploy Kubeapps into your OKE cluster and use it to deploy the WordPress Helm chart included in the Kubeapps catalog.

Assumptions and prerequisites

This guide makes the following assumptions:

Step 1: Install Helm locally and in your cluster

Tip

Tiller is not required if using Helm v3.x.

When creating an OKE cluster you have the option to have Tiller (Helm v2.x's server component) deployed into your cluster.

  • Check if Tiller is already running in your cluster by running the following:

    kubectl get pods -n kube-system
    

    The output should be similar to this:

        NAME                                  READY   STATUS  RESTARTS   AGE
        kube-dns-66d8df795b-j6jnb             3/3     Running   0       22h
        kube-dns-66d8df795b-p4md6             3/3     Running   0       21h
        kube-dns-66d8df795b-twg4r             3/3     Running   0       21h
        kube-dns-autoscaler-87496f994-46gwr   1/1     Running   0       22h
        kube-flannel-ds-c9knx                 1/1     Running   2       21h
        kube-flannel-ds-jtcm8                 1/1     Running   3       21h
        kube-flannel-ds-lbbwc                 1/1     Running   2       21h
        kube-proxy-5bm72                      1/1     Running   1       21h
        kube-proxy-m2xbd                      1/1     Running   0       21h
        kube-proxy-zflnz                      1/1     Running   0       21h
        kubernetes-dashboard-8698b85796-5n6rr 1/1     Running   0       22h
        tiller-deploy-5f547b596c-djbnb        1/1     Running   0       22h
    

    As you can see above, there is a pod running called tiller-deploy. That means that Tiller is already deployed in your cluster.

To interact with Helm you will need to install the CLI tool locally in your system. As the version of Tiller that comes with your OKE cluster is 2.8.2, you will need to install a compatible CLI version. Follow the instructions on the Github release page to install the latest version of the Helm CLI into your system.

  • To install Tiller in case that it is not already deployed in your cluster, execute the Helm init command as shown below:

    helm init
    

Step 2: Deploy Kubeapps in your cluster

Watch the video below to learn how to install and use Kubeapps to deploy applications on Kubernetes or continue reading for instructions:

The next step is to deploy Kubeapps in your cluster. This can be done with Helm in your terminal by running:

helm repo add bitnami https://charts.bitnami.com/bitnami
helm install --namespace kubeapps kubeapps bitnami/kubeapps

Kubeapps requires a token to login, then it will be used in any request to make sure that the user has enough permissions to perform the required API calls (if your cluster has RBAC enabled). To do so:

  • Create a service account with cluster-admin permissions:

    kubectl create serviceaccount kubeapps-operator
    kubectl create clusterrolebinding kubeapps-operator --clusterrole=cluster-admin --serviceaccount=default:kubeapps-operator
    
  • Reveal the token that will be used to login into the Kubeapps dashboard by running the following:

    kubectl get secret $(kubectl get serviceaccount kubeapps-operator -o jsonpath='{.secrets[].name}') -o jsonpath='{.data.token}' | base64 --decode
    

Step 3: Accessing the Kubeapps dashboard and logging in

The default values for the options in the Kubeapps Helm chart deploy the Kubeapps main service as a ServiceIP, which cannot be accessed externally.

  • To be able to access it locally, use the Kubernetes port-forward option as follows:

    echo "Kubeapps URL: http://127.0.0.1:8080"
    export POD_NAME=$(kubectl get pods --namespace kubeapps -l "app=kubeapps" -o jsonpath="{.items[0].metadata.name}")
    kubectl port-forward --namespace kubeapps $POD_NAME 8080:8080
    

Once the port-forward is running you can access Kubeapps in your browser at http://localhost:8080. You will be prompted with a login screen. To log in, you can paste the token you obtained in the previous section:

Log in to Kubeapps

Step 4: Using Kubeapps to deploy Bitnami charts in your OKE cluster

Bitnami maintains a catalog of more than 50 charts and those have been fully tested in OKE clusters and polished to work out of the box on an OKE cluster. You can have a look at the Helm charts in the Bitnami repo by accessing http://localhost:8080/charts/bitnami/.

Available Helm charts dashboard

Let's see how to deploy a Helm chart through Kubeapps using the Bitnami WordPress Helm chart as an example.

  • In the "Catalog" Page, search for and and select the WordPress chart. You will see the description of the chart and the instructions to deploy it.
Bitnami WordPress Helm chart
  • Deploy it with the default values, which will create a LoadBalancer service and will deploy a MariaDB database in the cluster. You can check that both pods are up and running, and that PVCs, backed by OCI have been provisioned, by running the kubectl get pods and the kubectl get pvc commands, respetively:

    kubectl get pods
    NAME                                  READY   STATUS  RESTARTS   AGE
    my-wordpress-mariadb-0                1/1     Running   0        4m
    my-wordpress-wordpress-5cfc65b9-dnblz 1/1     Running   0        4m
    
    kubectl get pvc
    NAME                          STATUS  VOLUME                                                                            CAPACITY   ACCESS MODES   STORAGECLASS   AGE
    data-my-wordpress-mariadb-0   Bound   ocid1.volume.oc1.phx.abyhqljsslsar3caoqzxotoaci3svroeci4g2pkh7rva6gtck4tqbckslmnq   50Gi     RWO            oci            4m
    my-wordpress-wordpress        Bound   ocid1.volume.oc1.phx.abyhqljsiewzlxlyuaeulf6nsm4w2wqnzwq3ho3vbisrcjumroga6l765r6q   50Gi
    

    Also, as this is a LoadBalancer service, OKE will provide a load balancer with an IP you can use to access your new WordPress website:

WordPress chart deployed
  • Browse to the given URL to access your WordPress site:
Access WordPress