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.
- 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
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
-
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:
mvn -Dgit.repo=<repo_user> -Dgit.tag=<repo_tag> -DidentityId=<user-assigned-managed-identity-id> -DcreateAKSCluster=true -DcreateACR=true -DuploadAppPackage=<true or false> -DuseOpenLibertyImage=<true or false> -DuseJava8=<true or false> -DappReplicas=<number of replicas> -Dtest.args="-Test All" -Ptemplate-validation-tests clean install
-
Or use an existing AKS cluster and an existing ACR instance:
mvn -Dgit.repo=<repo_user> -Dgit.tag=<repo_tag> -DidentityId=<user-assigned-managed-identity-id> -DcreateAKSCluster=false -DaksClusterName=<aks-cluster-name> -DaksClusterRGName=<cluster-group-name> -DcreateACR=false -DacrName=<acr-instance-name> -DuploadAppPackage=<true or false> -DuseOpenLibertyImage=<true or false> -DuseJava8=<true or false> -DappReplicas=<number of replicas> -Dtest.args="-Test All" -Ptemplate-validation-tests clean install
-
-
Change to
./target/arm
directory -
Using
deploy.azcli
to deploy the application package to AKS cluster./deploy.azcli -n <deploymentName> -i <subscriptionId> -g <resourceGroupName> -l <resourceGroupLocation> -f <application-package-path>
- If you check the resource group
resourceGroupName
in Azure portal, you will see related resources created:- An new AKS cluster if it's specified;
- An new ACR instance if it's specified;
- An deployment script instance;
- To visit the application home page:
- Open the resource group
resourceGroupName
; - Navigate to "Deployments >
deploymentName
> Outputs"; - Copy value of property
result > applicationEndpoint
and open it in the browser;
- Open the resource group