Mendix on AKS — A Missing Documentation

Qnt Tran
Qnt Tran
Nov 6 · 6 min read

This is a missing document that i would like to share. There are around 6 steps to make Mendix application to be on AKS.

The architecture would look like this

In this scope i do not authenticate with azure active directory, cause in Mendix application we can have a ldap module in order to login to Mendix application via ldap users.

This article is using Azure Database for Postgres

Install azure cli:

cmd: brew update && brew install azure-cli

result:

verify azure cli version:

verify kubectl at client:

Let’s start with these steps below

Step 1- Create ASK Cluster 3 nodes

Method 1: using az cli command

Create resource group

az group create — name myResourceGroup — location eastus

Create aks service

az aks create — resource-group myResourceGroup — name myAKSCluster — node-count 1 — enable-addons monitoring — generate-ssh-keys

Method 2: using azure portal

Create resource group

Create Kubernetes service

Press Add to create new Kubernetes Service
Select the resource group which created in the step above, using standard DS1 v2 for free account
scale option for whole vm sets
select advance option
final, press create

Step 2- Create azure container registry, build Mendix to ACR, and Create Azure SQL for Postgres

Create ACR

Registry name: myMendixRegistry

Login server: mymendixregistry.azurecr.io

Adminuser: myMendixRegistry

Password: Rx67wvUMa95R/LqVW8sB9Vbv4OoikPp2

Password2: RBRy+HJB6vPB5B1=RA64DkXT=xQVNwRw

Download this https://github.com/mendix/docker-mendix-buildpack

// Note: need dot at the end

docker build — build-arg BUILD_PATH=./DashboardUImain -t dbv002 .

// to see what have been build

docker images

// login

docker login -u myMendixRegistry mymendixregistry.azurecr.io

// tag the image

docker tag dbv002 mymendixregistry.azurecr.io/v002:v02

docker images

docker push mymendixregistry.azurecr.io/v002:v02

Create DB

Make a new resource group

Create a new DB under the new resource group

Virtual Network and subnet should be added into DB Rule

Test Client DB Connection

Create a db instance for Mendix App

So now, you can connect to azure postgres via pgadmin client and create a new database for mendix application, we will need to use this name to add into mendix secret yaml file.

Step 3- Prepare Kubernetes Manifest(all yaml files). Password and endpoint should be on base 64

You have prepare these manifest below:

I will explore it later, now we need to convert some parameters to base 64.

I mostly used this web site to encode the string to based 64.

postgres endpoint:

postgres://mendix@mymendixdb:Admin123@mymendixdb.postgres.database.azure.com:5432/dashboarddb

postgres endpoint base64:

cG9zdGdyZXM6Ly9tZW5kaXhAbXltZW5kaXhkYjpBZG1pbjEyM0BteW1lbmRpeGRiLnBvc3RncmVzLmRhdGFiYXNlLmF6dXJlLmNvbTo1NDMyL2Rhc2hib2FyZGRi

password Mendix admin(MxAdmin):

Admin@123

password Mendix admin base64:

QWRtaW5AMTIz

So now we take a look of each yaml file

mendix-app-secrets.yaml

mendix-app-service.yaml

mendix-app.yaml

Note: declare image registry, and the secret

helm-rbac.yaml

mendix-ingress.yaml

Note: you need to have public hostname. and your service name should be same as mendix-app-service.yaml name

I think we’re almost done, let connect to aks then do the deployment

Step 4 - Open Kubernetes Dashboard and connect to AKS cluster

// login

az login

// connect to AKS (Please be careful of copy and paste, there are 2 dash, take a look a picture for every steps)

az aks get-credentials — name myAKSCluster — resource-group myResourceGroup

// open Kubernetes dashboard

az aks browse — resource-group myResourceGroup — name myAKSCluster

Done now you can open the kubernetes dashboard, however the purpose is not looking at this. We haven’t deploy anything yet. Now let’s start doing some secret files first.

Create Docker Registry Secret for Mendix

docker-secret.yaml

kubectl create secret docker-registry — dry-run=true docker-secret \
— docker-server=mymendixregistry.azurecr.io \
— docker-username=myMendixRegistry \
— docker-password=Rx67wvUMa95R/LqVW8sB9Vbv4OoikPp2 \
docker-email=qntbkk@gmail.com -o yaml > docker-secret.yaml

First of all, let’s check the working node, before applying the manifest.

kubectl get nodes

Step 5 - Deploy Mendix manifest

Step 6 -Install ingress

helm install stable/nginx-ingress

all look great

get pods status

apply ingress

checking mendix app runtime

When you have a kubernetes public ip then you can able to create a dns name

Then can launch an app with the url below:

http://apptest-mendix.eastus.cloudapp.azure.com/login.html

Done App is running

Note: You may using a postgress container in another pods with pv and pvc.

good luck ^^

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade