Content

Get Started with the Azure Container Service (AKS)

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 Container Service (AKS) brings these two solutions together, allowing users to quickly and easily create fully managed Kubernetes clusters.

This guide walks you, step by step, through the process of provisioning a new Kubernetes cluster on Microsoft Azure using AKS and then deploying an application to the cluster using a Bitnami Helm chart.

Overview

This guide will introduce you to AKS 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.

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:

Restart the Tiller deployment using the ServiceAccount previously created:

If you don't initialize Helm in the previous step, you can use the following command:

$ helm init --service-account tiller

In case that you have initialized Helm, then execute the following command:

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

Step 3: Subscribe To Your Private Registry and Container Marketplace

At the end of this step, you will have created a private Azure Container Registry (ACR) synchronized with the Bitnami container registry.

Once your AKS cluster is up and running, next step is to create a private ACR to make sure that images are pulled from your private registry instead of, for example, from the public Docker Hub. Follow these steps:

You will be redirected to a form. Select the subscription name and enter a name for your private registry. (If you already have an ACR, click the "Use existing" option). Finally, select the Resource group you have set in step1 and enter the Location.

Once you have a private registry on Azure, you need to connect it to the Bitnami container registry. That way, both will be synchronized and ready to pull the images from the Bitnami Container Catalog.

First, you need to create a user with read permissions in the Bitnami registry. Execute the following commands:

NOTE: Remember to replace MY-REGISTRY and MY-USER placeholders with your registry name and Azure username, respectively.

To configure your AKS cluster to use your ACR, you need to indicate Kubernetes from where the Docker images have to be pulled, so it is necessary to specify your custom Docker registry as part of your Kubernetes object configuration. Instead of editing the corresponding yaml files, you can use Kubernetes secrets.

To create a Kubernetes secret, execute the commands below. Remember to define a value for MY-ACR-AUTH and to replace the EMAIL-ADDRESS placeholder with your email address:

NOTE: Once you are subscribed to an Azure Marketplace Container, the image is copied to your own registry with the name "bitnami.bitnami/wordpress". The image currently does not support other different tags except "latest".

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.

Check pod status until both WordPress and MariaDB are "running":

$ kubectl get pods -w

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

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

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

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

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

Step 5: 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:

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:

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 6: 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.

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.

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

Select the "Posts -> Add New" menu option to create a new 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.

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

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.

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.

Useful links

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