In an earlier article, I shared a demo to deploy AWS EKS, deploy an app, and then deploy a BIG-IP to expose that application securely to the internet.
This article will do similar but for Azure's AKS service.
What this demo will deploy:
This demo is hosted here and full instructions can be found here too. Otherwise you can continue below:
You will need a Terraform client.
I personally use an Ubuntu 18.04 machine and for this demo I used Terraform version 0.12.23
You need details of a ServicePrincipal in Azure.
In this demo your Azure account will be accessed by Terraform using a Service Principal. You can set up a ServicePrincipal by following these instructions. In my example, I use a ServicePrincipal and client secret, but you can also authenticate with client certificate, or Managed Service Identity. The SP should have contributor access in the subscription.
Run git clone to copy the Terraform files we need locally
We now need to update the file called variables.tf in the root module to reflect your own Service Principle details:
You want your variables.tf file to include this below. Obviously, replace my xxx with your SP details, and you can create your own prefix value and Azure location if you wish. Of course, in production, use a better password than below.
Now let's run Terraform! You will need to type "yes" at the last prompt and you will get billed for resources deployed.
Now let's change directories and run Terraform and build apps!
You will need to type "yes" at the last prompt.
Once this is complete, you should see an output called appUrl. Visit this URL, and you should see a simple demo app (the Azure vote demo app). This demo app is a good example because it involves 2 services within Kubernetes (a front end service, with multiple pods, and a backend service, with one pod). Here is the command to print this output on the screen:
terraform output appUrl
The output of this command is a URL for you to visit. The demo is successful when you see this app below. This microservices app is 2-tier, running in AKS, and exposed to the internet via the F5 BIG-IP. Now, you can apply firewall rules, iRules, SSL termination, or any other F5 app services at your F5 BIG-IP, and still get the benefit of running in AKS.
Finally, don't forget to delete your resources! Again - you'll need to type "yes" when prompted. Let's ensure we delete the resources from the "apps" directory and then from the "infra" directory.
And now back to the /infra directory and destroy those resources too.
Once in a while, Azure will destroy these resources without considering dependencies, and you'll see an error when you delete your resources. If this happens, just destroy again with the command above, or just delete the Azure Resource Group via the Azure portal.
Thanks for reading, and please share your experiences and thoughts!