azure

Get Started with Bitnami Charts in the Microsoft Azure Marketplace

Introduction

Microsoft Azure is a flexible and versatile cloud platform for enterprise use cases, while Kubernetes is quickly becoming the standard way to manage application containers in production environment. Azure Kubernetes Service (AKS) brings these two solutions together, allowing users to quickly and easily create fully managed Kubernetes clusters.

But starting up a cluster is just the beginning: the next step is to deploy applications on it. That’s where this tutorial comes in. It will walk you, step by step, through the process of using the Microsoft Azure Marketplace to deploy Bitnami applications using Helm charts on a running AKS cluster.

Overview

This guide will introduce you to Bitnami’s Helm charts by provisioning a Kubernetes cluster and deploying the Bitnami WordPress Helm chart on it. This will give you a pre-configured WordPress blog that you can start using right away. But WordPress is just an example: there are hundreds of other Bitnami applications to choose from, and they’re all equally easy to set up.

Here are the steps you’ll follow in this tutorial:

  • Provision a Kubernetes cluster
  • Install and configure Helm
  • Deploy the WordPress Helm chart
  • Access the Kubernetes dashboard
  • Log in and start using WordPress

The next sections will walk you through these steps in detail.

Assumptions and prerequisites

This guide assumes that:

Step 1: Provision a Kubernetes cluster

At the end of this step, you will have provisioned a Kubernetes cluster on AKS.

The first step is to provision a new Kubernetes cluster using the Microsoft Azure CLI. Follow these steps:

NOTE: If you already have a running Kubernetes cluster on AKS, you can skip the first two steps in this section. However, ensure that you execute the final step in this section to obtain and configure your local environment with the credentials for your cluster using the az aks get-credentials command.

  • Log in to Microsoft Azure:

    $ az login
    

    If you have multiple subscriptions, you can optionally set the subscription you wish to use in the SUBSCRIPTION-NAME placeholder.

    $ az account set --subscription "SUBSCRIPTION-NAME"
    
  • Create a resource group and cluster. The cluster creation process can take up to 20 minutes.

    $ az group create --name aks-resource-group --location eastus
    $ az aks create --name aks-cluster --resource-group aks-resource-group --node-count 3 --generate-ssh-keys
    

    In this example, the resource group is named aks-resource-group and the cluster is named aks-cluster and is provisioned in the eastus location. If you choose different names or a different location, update the following steps to use the correct information.

  • Install kubectl, the Kubernetes command-line interface, and configure it with the credentials for the new AKS cluster:

    $ sudo az aks install-cli
    $ az aks get-credentials --name aks-cluster --resource-group aks-resource-group
    

Step 2: Install and configure Helm and Tiller

At the end of this step, you will have configured Helm to work in your AKS cluster and provided Tiller the right permissions to allow Helm to deploy charts with RBAC.

Next, install and configure Helm for your operating system and then create the following Kubernetes objects to make Helm work with Role-Based Access Control (RBAC) in AKS:

  • ClusterRoleBinding
  • ServiceAccount

Follow these instructions:

  • To install Helm, run the following commands:

    $ curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
    $ chmod 700 get_helm.sh
    $ ./get_helm.sh
    

    TIP: If you are using OS X you can install it with the brew install command: brew install kubernetes-helm.

  • To create a ServiceAccount and associate it with the predefined cluster-admin role, use a ClusterRoleBinding, as below:

    $ kubectl create serviceaccount -n kube-system tiller
    $ kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
    
  • Initialize Helm as shown below:

    $ helm init --service-account tiller
    

    If you have previously initialized Helm, execute the following command to upgrade it:

    $ helm init --upgrade --service-account tiller
    

Finally, create a secret to use when pulling images from the registry:

    $ kubectl create secret generic emptysecret --from-literal=.dockerconfigjson='{"auths":{"marketplace.azurecr.io":{"Username":"","Password":""}}}' --type=kubernetes.io/dockerconfigjson

NOTE: This command (creating a secret) is only necessary the first time you deploy a chart on an AKS cluster. This command can safely be omitted for subsequent chart deployments on the same AKS cluster.

Step 3: Deploy the WordPress Helm Chart

At the end of this step, you will have WordPress running in your AKS cluster.

Once Helm is installed, you’re ready to deploy WordPress using the Bitnami WordPress Helm Chart.

  • Add the Microsoft Azure Marketplace chart repository to Helm:

    $ helm repo add azure-marketplace https://marketplace.azurecr.io/helm/v1/repo
    
  • Install the WordPress Helm Chart by executing the command below.

    $ helm install azure-marketplace/wordpress --set global.imagePullSecrets={emptysecret}
    

    You should see something like the output below as the chart is installed. Pay special attention to the NOTES section of the output, as it contains important information to access the application.

    Helm chart output

    NOTE: Some Bitnami charts, such as those for Magento and Ghost, can connect to an external database and require deployment in two steps. First, deploy the database server and obtain its public IP address and then, run the helm upgrade command with the public IP address. For example:

      $ helm upgrade azure-marketplace/magento --set magentoHost=$APP_HOST,magentoPassword=$APP_PASSWORD,mariadb.db.password=$APP_DATABASE_PASSWORD --set global.imagePullSecrets={emptysecret}
    
  • Check pod status until both WordPress and MariaDB are “running”:

    $ kubectl get pods -w
    

    Pods

  • Check services until you see the load balancer’s external IP address:

    $ kubectl get svc -w wordpress-chart-wordpress --namespace default
    

    Load balancer

  • Get the credentials for the application by executing the commands shown in the output of helm install:

    Helm chart commands

Browse to the specified URL and you should see WordPress running. Here’s what it should look like:

WordPress home page

You will also be able to see your cluster in the Microsoft Azure dashboard, under the “Resource groups” menu item:

Cluster details

Step 4: Access the Kubernetes dashboard

Once your WordPress Helm chart has been installed and it is running in your AKS cluster, you can access the Kubernetes dashboard to manage and monitoring your deployments in a visual way. Follow these steps:

  • To access your AKS cluster, navigate to the Microsoft Azure Portal and select the “Kubernetes services” section.
  • Click the name of the cluster you want to access. Then, click “View Kubernetes dashboard”.
  • In the resulting screen, you will find a set of steps that include the commands you need to execute from a terminal window in your local system:

    Instructions to access the Kubernetes dashboard

  • Once you have executed the commands above, the Kubernetes dashboard IP address will be displayed. Enter that IP address in a web browser to access the cluster dashboard.

Step 5: Log in and start using WordPress

At the end of this step, you will have logged in to WordPress and created a new blog post.

To log in to the WordPress dashboard, follow these steps:

  • Browse to the WordPress dashboard, usually at the URL http://SERVER-IP/wp-admin.

  • Log in with the administrator credentials from the previous step.

    WordPress credentials

You should now arrive at the WordPress dashboard, which allows you to manage posts, pages and comments; customize your blog with themes and plugins; import and export content; manage navigation menus; add or delete new user accounts; and much more.

WordPress credentials

You can now add a new post using the following steps:

  • Select the “Posts -> Add New” menu option to create a new post.

    Add new WordPress post

  • Enter a title and content for the post. You can use the formatting tools at the top of the content area to format your post and add hyperlinks or images.

  • Optionally, choose the format and category for your post.

  • Publish it immediately using the “Publish” button.

    Add new WordPress post

And now, when you visit your blog’s front page, you should see your new post.

WordPress post publishing

Congratulations! You now have a working, fully-functional WordPress blog in the cloud.

You can keep your WordPress installation up-to-date with the WordPress automatic update feature. To access this:

  • Log in to WordPress using the administrator account.
  • Select the “Dashboard -> Updates” menu item.

    WordPress update

  • Review the resulting page to see if WordPress needs an update. If an update is available, you can install it by clicking the “Update Now” button. You can also re-install WordPress if needed with the “Re-install Now” button.

    WordPress update

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

Last modification March 15, 2019