Introduction

In recent years, containers have become the definitive way to develop applications because they provide packages that contain everything you need to run your applications: code, runtime, databases, system libraries, etc.

Kubernetes is an open source solution for managing application containers. With Kubernetes, you can decide when your containers should run, increase, or decrease the size of application containers or check the resource consumption of your application deployments. The Kubernetes project is based on Google's experience working with containers, and it is gaining momentum as the easiest and the most recommended way to manage containers in production.

Applications can be installed in Kubernetes using Helm charts. Helm charts are packages that contain all the information that Kubernetes needs to know for managing a specific application within the cluster.

This guide will walk you, step by step, through the process of deploying applications within a Kubernetes cluster using Bitnami Helm charts.

Introducing Kubernetes

Kubernetes is an open source project designed specifically for container orchestration. Kubernetes offers a number of key features, including multiple storage APIs, container health checks, manual or automatic scaling, rolling upgrades and service discovery. Applications can be installed to a Kubernetes cluster via Helm charts, which provides streamlined package management functions.

If you're new to this container-centric infrastructure, the easiest way to get started with Kubernetes is with Bitnami Helm charts. Bitnami offers a number of stable, production-ready Helm charts to deploy popular software applications in a Kubernetes cluster.

Kubernetes Native App architecture

The architecture of a typical Cloud-Native application consists of 3-tiers: a persistence or database tier, backend tier and frontend tier for your application.
In Kubernetes, you define and create multiple resources for each of these tiers, as you can see in the following diagram:

Working with Kubernetes

Kubernetes is platform-agnostic and integrates with a number of different cloud providers, allowing you to pick the platform that best suits your needs. Check Kubernetes official documentation to find out the right solution for you.

There are two different interfaces from which you can manage the resources on your cluster:

Introducing Helm

The official Helm webpage defines Helm as a "package manager for Kubernetes" but, it is more than this. Helm is a tool for managing applications that run in the Kubernetes cluster manager.Helm provides a set of operations that are useful for managing applications, such as: inspect, install, upgrade and delete.

Helm is composed of two parts:

A client: Helm

A server: Tiller

Helm Charts: applications ready-to-deploy

Helm charts are packages of pre-configured Kubernetes resources. A Helm chart describes how to manage a specific application on Kubernetes. It consists of metadata that describes the application, plus the infrastructure needed to operate it in terms of the standard Kubernetes primitives. Each chart references one or more (typically Docker-compatible) container images that contain the application code to be run.

Helm charts contains at least these two elements:

A description of the package (chart.yml).

One or more templates, which contains Kubernetes manifest files.

Despite the fact you can run application containers using the Kubernetes command line (kubectl), the easiest way to run workloads in Kubernetes is using the ready-made Helm charts. Helm charts simply indicate to Kubernetes how to perform the application deployment and how to manage the container clusters.

Bitnami provides a set of stable and tested charts that give you the opportunity to deploy popular software application with ease and confidence.

Overview

Google Kubernetes Engine (also known as GKE) is a cluster manager and orchestration system for running Docker containers in the cloud. It is a production-ready environment with guaranteed uptime, load balancing and included container networking features. It allows you to create multiple-node clusters while also providing access to all Kubernetes' features.

TIP: For more information on how to run a Kubernetes cluster on other platforms, please refer to our other guides.

In this tutorial, you will learn how to install the needed requirements to run Bitnami applications on Kubernetes using GKE.

Configure the compute zone. Remember that this zone must match the one you indicated in Step 1. Replace the COMPUTE_ZONE placeholder with the correct value.

$ gcloud config set compute/zone COMPUTE_ZONE

Get your cluster credentials:

$ gcloud container clusters get-credentials MY_KUBERNETES_CLUSTER

Authenticate your cluster:

$ gcloud auth application-default login

After you have run the command below, Google will prompt you to introduce your Google account and allow Google Auth Library to access your account information:

Now, your cluster is authenticated with the Google Cloud SDK. You can install the kubectl CLI and start to work with your Kubernetes cluster.

Step 3: Install the kubectl command-line tool

In order to start working on a Kubernetes cluster, it is necessary to install the Kubernetes command line (kubectl). Follow these steps to install the kubectl CLI:

Execute the following commands to install the kubectl CLI. OS_DISTRIBUTION is a placeholder for the binary distribution of kubectl, remember to replace it with the corresponding distribution for your Operating System (OS).

Step 4: Install Helm and Tiller

The easiest way to run and manage applications in a Kubernetes cluster is using Helm. Helm allows you to perform key operations for managing applications such as install, upgrade or delete. As previously mentioned, Helm is composed of two parts: Helm (the client) and Tiller (the server). Follow the steps below to complete both Helm and Tiller installation.

Once you have installed Helm, a set of useful commands to perform common actions is shown below:

Step 5: Install an application using a Helm Chart

A Helm chart describes a specific version of an application, also known as a "release". The "release" includes files with Kubernetes-needed resources and files that describe the installation, configuration, usage and license of a chart.

The steps below show how to run the following Bitnami applications using Helm charts:

Once you have the chart installed a "Notes" section will be shown at the bottom of the installation information. It contains important instructions about how to obtain your application's IP address or credentials. Please check it carefully:

Find how to install MongoDB, Odoo or WordPress in the examples below:

To install the most recent MongoDB release on GKE, run the following command:

Now, you can manage your deployments from the Kubernetes Dashboard. Follow the instructions below to access the Web user interface.

Step 6: Access the Kubernetes Dashboard

The Kubernetes Dashboard is a Web user interface from which you can manage your clusters in a more simple and digestible way. It provides information on the cluster state, deployments and container resources. You can also check both the credentials and the log error file of each pod within the deployment.

To open the Kubernetes Dashboard, you just need to run the following command:

$ kubectl proxy

With this command, you will create a proxy server on port 8001 for accessing the Kubernetes Dashboard. It will be available at: localhost:8001/ui. The home screen shows the "Workloads" section. Here you get an overview of the following cluster elements:

CPU usage

Memory usage

Deployments

Replica Sets

Pods

From this home screen, you can perform some basic actions such as:

Monitoring the status of your deployments and pods.

Checking pod and container(s) logs to identify possible errors during the creation of the containers.

Finding application credentials.

Monitor the status of Deployments and Pods

Monitor Deployments

To check detailed information about the status of your deployments, navigate to the "Workloads -> Deployments" section located on the left menu. It shows a screen with a graphical representation of the CPU and memory usage, as well as a list of all deployments you have in your cluster.

Click each deployment to obtain detailed information of the selected deployment:

Monitoring pods

Pods are the smallest units in Kubernetes deployments. They can contain one or multiple containers (that need to share resources in order to work together). Learn more about pods.

When you click on a pod in the "Workloads -> Pods", you access the pod list. By selecting a pod, you will see the "Details" section that contains information related to the pod,and a "Containers" section that includes the information related to this pod's container(s).

Follow these instructions to access pod and container information:

To check the status of your deployments in detail, navigate to the "Workloads -> Pods" section located on the left menu. It shows the pod list:

Click the pod you'd like to access further details for.

Check logs

The Kubernetes Dashboard allows you to check the logs of both the pod and any containers belonging to the pod to detect possible errors that might have occurred. To access the logs viewer, follow the steps below:

Navigate to the "Workloads -> Pods" section located on the left menu, select the pod you'd like to check from the pod list.

In the detail page of the selected pod, you will find a "View logs" link both in the "Details" and "Containers" section. Click the one you want to see:

The logs viewer opens:

Find application credentials

The application credentials are shown in the "Notes" section after installing the application chart:

You can get the application username and password at any time by running the following command:

$ kubectl describe po

As you can see in the image above, the application password is configured as a secret password. To get it, browse to the Kubernetes Dashboard and follow these instructions:

Navigate to the "Config -> Secrets" section located on the left menu.

Click the application for which you wish to obtain the credentials.

In the "Data" section, click the eye icon to see the password:

Step 7: Uninstall an application using Helm

To uninstall an application, you need to run the helm delete command. Every Kubernetes resource that is tied to that release will be removed.

TIP: To get the release name, you can run the helm list command.

$ helm delete MY_RELEASE

NOTE: Remember that MY_RELEASE is a placeholder, replace it with the name you have used during the chart installation process.

Useful links

To learn more about the topics discussed in this guide, use the links below: