In this guide you will learn:
- How to deploy Azure K8s cluster (AKS)
- How to create container deployable image for CPX, CIC from Azure marketplace
- How to deploy a CPX in AKS cluster exposed as LoadBalancer type services
- Load balance hotdrink beverage microservice app using AKS
Section | Description |
---|---|
Section A | Create K8s cluster in AKS |
Section B | Create CPX, CIC Azure repository container images from marketplace |
Section C | Load balance apps using CPX |
Section D | Clean Up |
Azure has two options for deploying Kubernetes cluster in AKS, using Kubenet CNI and Azure CNI. In this demo, we will use Azure CNI for creating AKS k8s cluster.
You can create cluster either using Azure portal GUI or Azure CLI. Choose one option from below to create AKS cluster.
Section | Description |
---|---|
Option A | Create AKS cluster using Azure cloud portal GUI |
Option B | Create AKS cluster using Azure CLI |
-
Login to Azure cloud portal - https://portal.azure.com/#home You will below home page after successful login.
-
Create new Azure resource group
Select Resource group from Azure services -> Click on Add and provide Resource group name and region information -> Click on Review + Create -> Click on Create.
-
Create 2 worker node AKS K8s cluster using Azure CNI
Select newly created Resource group and Click on Add -> Select Kubernetes Service from list.
Create K8s cluster by filling ARM template, provide information like K8s cluster name, Region, Node count, Network configuration-. Azure CNI in Networking. After Review click on Create and wait for some time (2-3 mins) for Cluster to be UP.
Check the status of K8s cluster from Resource group -> Overview -> Select Kubernetes service created -> Status: Succeeded.
-
Login to Azure Cloud shell and validate cluster status Click on Connect -> Follow instructions on right and you will be connected to AKS cluster.
Check the AKS cluster status before beginning your demo
kubectl get nodes kubectl get pods
-
Install Azure CLI and Kubectl in local machine Install Azure CLI from here Install Kubectl from here
Check the status for successful installation,
az version kubectl version
-
Login to Azure accout
az login
Select your Azure subscription from the az login output list and set it in below command at ''
az account set --subscription "<name of the subscription>"
-
Create new Azure resource group
az group create --name CN-marketplace-cpx-deployment --location southindia
-
Create 2 worker node AKS K8s cluster using Azure CNI
az aks create --resource-group CN-marketplace-cpx-deployment --name cpx-aks-cluster --node-count 2 --enable-addons monitoring --generate-ssh-keys --network-plugin azure
-
Validate AKS cluster status
az aks get-credentials --resource-group CN-marketplace-cpx-deployment --name cpx-aks-cluster kubectl get nodes
-
Login to Azure marketplace account to create CIC repository image.
-
Subscribe to Citrix Ingress Controller from Marketplace
- Step 1 will take you to CIC offering from Marketplace, if not found search for Citrix Ingress controller in Marketplace
- Click on GET IT NOW from CIC offering and provide details in Subscription page. We will use 'CN-marketplace-cpx-deployment' resource group created in Section A for this subscription. Click on Subscribe after filling the form as shown below.
-
CIC container repository image URL is available now
- Go to the Resouce Groups page and select the resource group created in Section A, in my case its 'CN-marketplace-cpx-deployment'
- Click on registry -> Repositories under Services from left panel -> Click on 'citrix/citrix-k8s-ingress-controller' -> click on 'latest' tag -> Copy docker pull command
e.g. In my setup CIC docker pull command is 'docker pull cicimage.azurecr.io/citrix/citrix-k8s-ingress-controller:latest' that I will use in section C for CPX deployment.
In case you find challenege in generating CIC repository image, refer to Citrix Ingress Controller from Azure marketplace for more details.
-
Login to Azure marketplace account to create CPX repository image.
-
Subscribe to Citrix ADC CPX 13.0 (CPX Express) from Marketplace
- Step 1 will take you to CPX offering from Marketplace, in not found search for CPX in Marketplace
- Click on GET IT NOW from CIC offering and provide details in Subscription page. We will use 'CN-marketplace-cpx-deployment' resource group created in Section A for this subscription. Click on Subscribe after filling the form as shown below.
-
CPX container repository image URL is available now
- Go to the Resouce Groups page and select the resource group created in Section A, in my case its 'CN-marketplace-cpx-deployment'
- Click on registry -> Repositories under Services from left panel -> Click on 'citrix/citrix-k8s-cpx-ingress-13-0' -> click on '58.30' tag -> Copy docker pull command
e.g. In my setup CPX docker pull command is 'docker pull cpximage.azurecr.io/citrix/citrix-k8s-cpx-ingress-13-0:58.30' that I will use in section C for CPX deployment.
In case you find challenege in generating CPC repository image, refer to Citrix ADC CPX from Azure marketplace for more details.
Note Below deployment is done using Azure CLI, you can use Azure shell GUI for same. Instructions for enabling Azure CLI or cloud shell in given in Section A.
-
Deploy the
colddrink
microservice application in the AKS clusterkubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-app.yaml kubectl get pods
-
Deploy Citrix ADC CPX in AKS exposed on NodePort Download CPX yaml file to update it with Azure registory image URLS of CPX and CIC.
wget https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/azure/marketplace-cpx/manifest/cpx.yaml
Update '<>' in CPX yaml file with 'CPX URL' generated in Section B & Update '<>' in CPX yaml file with 'CIC URL' generated in Section B.
kubectl create -f cpx.yaml
Note In case you find error in CPX deployment, e.g. CPX pod status is 'ImagePullBackOff' or 'ErrImagePull' then please ensure that you have right Azure Container Registry roles and permissions.
You can try add Azure container registry (ACR) to your k8s cluster using command 'az aks update -n cluster-name -g Cresource-group-name --attach-acr CPX/CIC ACR name'
-
Deploy an Ingress rule for colddrink app to access http://www.colddrink.com
kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-ingress.yaml
-
Verify CPX configuration in AKS Check the status for CPX and colddrink application pods,
kubectl get pods
Login into CPX pods to check colddrink microservice application configuration status
kubectl exec -it <CPX pod name> bash
Now, you will find CPX has all configurations required for colddrink app. e.g.
cli_script.sh "sh cs vserver"
```
kubectl delete -f cpx.yaml
kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-app.yaml
kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-ingress.yaml
```