Deploy a Java application with Open Liberty or WebSphere Liberty on an Azure Kubernetes Service (AKS) cluster
- You will need an Azure subscription. If you don't have one, you can get one for free for one year here.
- You need to have either an Owner role or Contributor and User Access Administrator roles in the subscription.
- Install a Java SE implementation (for example, AdoptOpenJDK OpenJDK 8 LTS/OpenJ9).
- Install Maven 3.5.0 or higher.
- Install Docker for your OS.
- Install Azure CLI 2.0.75 or later.
- Install Bicep.
- Install
jq
-
Checkout azure-javaee-iaas
- Change to directory hosting the repo project & run
mvn clean install
- Change to directory hosting the repo project & run
-
Checkout arm-ttk under the specified parent directory
- Run
git checkout cf5c927eaf1f5652556e86a6b67816fc910d1b74
to checkout the verified version ofarm-ttk
- Run
-
Checkout this repo under the same parent directory and change to directory hosting the repo project
-
Build the project by replacing all placeholder
${<place_holder>}
with valid values-
Create a new AKS cluster and a new Azure Container Registry (ACR) instance with Application Gateway Ingress Controller (AGIC) enabled:
mvn -Dgit.repo=<repo_user> -Dgit.tag=<repo_tag> -DcreateCluster=true -DcreateACR=true -DdeployWLO=<true|false> -Dedition=<edition> -DproductEntitlementSource=<productEntitlementSource> -DdeployApplication=<true|false> -DappImagePath=<app-image-path> -DappReplicas=<number of replicas> -DenableAppGWIngress=true -DappgwUsePrivateIP=<true|false> -DappGatewayCertificateOption=generateCert -DenableCookieBasedAffinity=true -Dtest.args="-Test All" -Pbicep -Passembly -Ptemplate-validation-tests clean install
-
Or use an existing AKS cluster and an existing ACR instance without AGIC:
mvn -Dgit.repo=<repo_user> -Dgit.tag=<repo_tag> -DcreateCluster=false -DclusterName=<aks-cluster-name> -DclusterRGName=<cluster-group-name> -DcreateACR=false -DacrName=<acr-instance-name> -DacrRGName=<acr-group-name> -DdeployWLO=<true|false> -Dedition=<edition> -DproductEntitlementSource=<productEntitlementSource> -DdeployApplication=<true|false> -DappImagePath=<app-image-path> -DappReplicas=<number of replicas> -DenableAppGWIngress=false -DappgwUsePrivateIP=<true|false> -DappGatewayCertificateOption=generateCert -DenableCookieBasedAffinity=true -Dtest.args="-Test All" -Pbicep -Passembly -Ptemplate-validation-tests clean install
-
-
Change to
./target/cli
directory -
Using
deploy.azcli
to deploy the application package to AKS cluster./deploy.azcli -n <deploymentName> -g <resourceGroupName> -l <resourceGroupLocation>
- If you check the resource group
resourceGroupName
in Azure portal, you will see related resources created:- A new AKS cluster if it's specified;
- A new ACR instance if it's specified;
- Two deployment script instances;
- To visit the application home page if you chose to deploy a sample app:
- Open the resource group
resourceGroupName
; - Navigate to "Deployments >
deploymentName
> Outputs"; - Copy value of property
appHttpEndpoint
> append context root defined in the 'server.xml' of your application if it's not equal to '/' > open it in the browser; - If you enabled AGIC: copy value of property
appHttpsEndpoint
> append context root defined in the 'server.xml' of your application if it's not equal to '/' > open it in the browser;
- Open the resource group
The offer provisions the WebSphere Liberty Operator or Open Liberty Operator and supporting Azure resources.
- Computing resources
- Azure Kubernetes Service cluster
- Dynamically created AKS cluster with
- Choice of Node count.
- Choice of Node size.
- Network plugin: Azure CNI.
- You can choose to deploy into a pre-existing AKS cluster
- Dynamically created AKS cluster with
- An Azure Container Registry. You can also bring your own container registry. The registry is used to store the Liberty and application image.
- Azure Kubernetes Service cluster
- Network resources
- A virtual network and one subnet if user selects to deploy an Azure Application Gateway Ingress Controller (AGIC) and create a new virtual network.
- A network security group if user selects to create a new virtual network.
- An Application Gateway acting as Ingress controller for pods running in the AKS cluster if user selects to deploy AGIC, with the following configuration:
- Create a new virtual network or use a pre-existing virtual network.
- Options to provide TLS/SSL certificate (upload, identify an Azure Key Vault and generate a self-signed certificate).
- Enable/disable cookie based affinity.
- A public IP address assigned to the Azure Application Gateway if user selects to deploy AGIC.
- Key software components
- A WebSphere Liberty Operator version 1.1.0 or Open Liberty Operator version 0.8.1 installed and running on the AKS cluster, per user selection.
- An WebSphere Liberty or Open Liberty application deployed and running on the AKS cluster, per user selection:
- User can select to deploy an application or not.
- User can deploy own application or a sample application.
- User need to provide additional entitlement info to deploy the application if a WebSphere Liberty Operator (IBM supported) is deployed.