Get Started with the Okteto Cloud Application Catalog

Image of Get Started with the Okteto Cloud Application Catalog

Author bio: Jeevanjot Singh is a full stack developer. He is a game developer, graphic designer and video editor as a freelancer and also experienced with Blockchain development. He loves to develop open-source software for multiple startups.

I recently discovered Okteto Cloud and I am very impressed by its developer experience. It provides a good free tier to deploy your Kubernetes applications. Then, you code from your local IDE, and Okteto takes care of updating your applications in seconds 🤗. It also provides an application catalog to launch applications in one-click. The default catalog contains building blocks like MongoDB, Redis, serverless frameworks and a couple of sample applications.

In this blog post, I would like to share with you the things that I have learned while deploying Drupal on Okteto Cloud using the Drupal Bitnami Chart and the steps I took to contribute my first helm chart to the Okteto Cloud Application Catalog.

Introducing Helm

Helm is officially defined as a package manager for Kubernetes. Helm charts are packages of pre-configured Kubernetes applications and contain at least three elements:

  • A description of the package (Chart.yaml).
  • One or more templates to describe the Kubernetes resources to create.
  • A default configuration to deploy the chart (values.yaml).

Helm charts are the easiest way to deploy third-party workloads in Kubernetes. Bitnami, in particular, maintains a set of stable and tested charts that help you deploy popular software applications with ease and confidence. There is also helm hub that has a collection of charts from different maintainers.

Deploying Drupal Easily to my Development Workflow On Cloud

In the past, I have to configure and maintain local instances of the application that I require to run. That makes my development environment complex. All this now changed and becomes very easy once I started using Okteto Cloud. I can deploy the exact version of my application (in this case, Drupal) that I require and use the Okteto CLI to develop directly in my instance running in Okteto Cloud. I see the results of my changes almost as fast as I type them in my local IDE (more about this on this link). It’s an amazing development experience, and it doesn’t require any local setup at all!

There are three different ways to deploy your applications on Okteto Cloud:

  • Download your Kubernetes credentials and deploy with kubectl or helm.
  • Configure the Okteto Cloud Application Catalog with your own Helm Repository. For example, https://charts.bitnami.com/bitnami for Bitnami Charts.
  • Submit a pull request to the Okteto Cloud Application Catalog.

You can find more information about the first option here and the second option here. In this post, I am going to focus on my experience adding Drupal to the default Okteto Cloud Application Catalog.

How to Add a Chart to the default Application Catalog

The Okteto Cloud Application Catalog is defined in this Github repository. Adding a new application is as simple as sending a pull request to this repo 😀 (see my original pull request here). This is the best option to share your applications with all the Okteto Community!

There are three main things to considerer before submitting your pull request:

  • Add the original chart as a Helm dependency.
  • Make your chart multi-tenant friendly.
  • Suggest meaningful default configuration values to make your application easy to use.

Add the original Helm chart as a dependency

For most cases, instead of defining your chart from scratch in your pull request, it’s easier to import the original chart as a dependency. In my case, my Drupal chart is based on the one maintained by Bitnami Charts. This meant creating an empty dir, copying the original Chart.yaml, and adding the following lines:

1
2
3
4
dependencies:
- name: drupal
version: 6.2.10
repository: https://charts.bitnami.com/bitnami

Also, add a new source to point to the Okteto Cloud Application Catalog:

1
2
3
sources:
- https://github.com/bitnami/bitnami-docker-drupal
- https://github.com/okteto/charts/tree/master/drupal

Then run:

1
$ helm dependency update

The rest of the Chart.yaml file should be the same as the original chart.

Make your chart multi-tenant friendly

Okteto Cloud is a multi-tenant environment. It gives you access to Kubernetes namespaces with a few restrictions in place to make it safer and easier to use for everyone (more information in the official documentation). The most important ones are:

  • Your chart cannot create ClusterRole or ClusterRoleBinding objects.
  • Okteto Cloud automatically translates NodePort and LoadBalancer service types into ingress rules.
  • Okteto Cloud uses Pod Security Policies to limit pod privileges. The following Pod options are not allowed: privileged, hostNetwork, allowPrivilegeEscalation, hostPID, hostIPC. Volume host paths are not allowed either.

Install your chart in Okteto Cloud using the Helm CLI and iterate on it until your application is compatible with Okteto Cloud multi-tenant environments. For the case of my Drupal application, I didn’t need to change anything on the original chart 😀.

Suggest meaningful default configuration values

The values.yaml file of Helm charts contains the default configuration values of your application. This file can be too complex for anyone who is not familiar with your application. But you can also place a values-okteto.yaml file side by side with your values.yaml file to show the recommended options for Okteto users. Okteto Cloud will automatically load the values-okteto.yaml file and show it in the Deploy application configuration dialog. It is a beautiful way to organize your application configuration 💡.

For my Drupal application, it meant adding a values.yml with the configuration Okteto users shouldn’t change (the rest of the configuration is inherited from the original Drupal Bitnami chart):

1
2
3
4
5
6
7
8
drupal:
allowEmptyPassword: "no"
service:
type: ClusterIP
ingress:
enabled: true
annotations:
dev.okteto.com/generate-host: "true"

and adding a values-okteto.yaml with the configuration Okteto users should be able to configure:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
drupal:
drupalUsername: okteto
drupalPassword: "change-me!"
drupalEmail: [email protected]

mariadb:
master:
persistence:
size: 1Gi

persistence:
drupal:
size: 1Gi

resources:
limits:
memory: 512Mi
cpu: 300m

For my chart, I’m using the annotation dev.okteto.com/generate-host: "true" to tell Okteto Cloud to automatically inject the right hostnames for the Drupal ingress rule while leaving the rest of the configuration intact. This made the application portable between Okteto Cloud namespaces. More about providing automatic SSL endpoint to your application here.

And that’s it, folks!

Send your pull request with a description that talks about why your application is useful for the community and the use cases you want to cover. Once it gets merged, your application will be available from the Okteto Cloud Application Catalog for everyone. Let’s have a look at it!

Log into Okteto Cloud and click on the Deploy button on the top left of the Okteto Cloud UI. Switch the deploy method to Deploy from Helm Chart. A dialog will open with the list of available applications including my Drupal application:

There you give it a name, select a version, and customize the configuration values (or just keep the default values). Once you’re ready, click on the Deploy button on the bottom of the dialog to launch your own Drupal instance. Your application will be ready to go once it reaches the Running state:

Conclusions

I have enjoyed how easy is to deploy Helm Charts on Okteto Cloud. It was really cool to be able to build a new chart and share it with the rest of the community via the catalog. I’d like to invite the rest of the community to also share your applications with the world by submitting a pull request to the Okteto Charts repository. Once it merged, your application will be available to everyone with the click of a button 🚀.

If you have any questions or have feedback, contact me on the #okteto channel in the Kubernetes community Slack. Have fun!