Permalink
bcbecea Feb 13, 2019
3 contributors

Users who have contributed to this file

@bhardwajk @mayurpatil11 @ankits123
145 lines (110 sloc) 7.69 KB

Learn how to use Citrix ADC in two tier microservices architecture

Citrix ADC offers the two-tier architecture deployment solution to load balance the enterprise grade applications deployed in microservices and access those through internet. Tier 1 can have traditional load balancers such as VPX/SDX/MPX, or CPX (containerized Citrix ADC) to manage high scale north-south traffic. Tier 2 has CPX deployment for managing microservices and load balances the north-south & east-west traffic.

2tierarchitecture

In the Kubernetes cluster, pod gets deployed across worker nodes. Below screenshot demonstrates the microservice deployment which contains 3 services marked in blue, red and green colour and 12 pods running across two worker nodes. These deployments are logically categorized by Kubenetes namespace (e.g. team-hotdrink namespace)

hotdrinknamespacek8s

Here are the detailed demo steps in cloud native infrastructure which offers the tier 1 and tier 2 seamless integration along with automation of proxy configuration using yaml files.

  1. Bring your own nodes (BYON) Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. Please install and configure Kubernetes cluster with one master node and at least two worker node deployment. Recommended OS: Ubuntu 16.04 desktop/server OS. Visit: https://kubernetes.io/docs/setup/scratch/ for Kubernetes cluster deployment guide. Once Kubernetes cluster is up and running, execute the below command on master node to get the node status.
kubectl get nodes

getnodes (Screenshot above has Kubernetes cluster with one master and two worker node).

  1. Set up a Kubernetes dashboard for deploying containerized applications. Please visit https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/ and follow the steps mentioned to bring the Kubernetes dashboard up as shown below.

k8sdashboard

  1. Create a namespaces using Kubernetes master CLI console.
kubectl create namespace tier-2-adc
kubectl create namespace team-hotdrink
kubectl create namespace team-colddrink
kubectl create namespace team-guestbook
kubectl create namespace monitoring

Once you execute above commands, you should see the output given in below screenshot using command:

kubectl get namespaces

getnamespace

  1. Copy the yaml files from /example-cpx-vpx-for-kubernetes-2-tier-microservices/config/ to master node in /root/yamls directory

  2. Go to Kubenetes dashboard and deploy the rbac.yaml in the default namespace

kubectl create -f /root/yamls/rbac.yaml 
  1. Deploy the CPX for hotdrink, colddrink and guestbook microservices using following commands,

Pre-Requsites: Citrix CPX deployment requires "image pull secrets" to download the CPX image. For generating new imagePullsecret, please raise a request to Citrix Slack.

Update the Secret provided by Citrix: Update the ".dockerconfigjson" field under secret in CPX.yaml

kubectl create -f /root/yamls/cpx-svcacct.yaml -n tier-2-adc
kubectl create -f /root/yamls/cpx.yaml -n tier-2-adc
kubectl create -f /root/yamls/hotdrink-secret.yaml -n tier-2-adc
  1. Deploy the three types of hotdrink beverage microservices using following commands
kubectl create -f /root/yamls/team_hotdrink.yaml -n team-hotdrink
kubectl create -f /root/yamls/hotdrink-secret.yaml -n team-hotdrink
  1. Deploy the colddrink beverage microservice using following commands
kubectl create -f /root/yamls/team_colddrink.yaml -n team-colddrink
kubectl create -f /root/yamls/colddrink-secret.yaml -n team-colddrink
  1. Deploy the guestbook no sql type microservice using following commands
kubectl create -f /root/yamls/team_guestbook.yaml -n team-guestbook
  1. Login to Tier 1 ADC (VPX/SDX/MPX appliance) to verify no configuration is present before we automate the Tier 1 ADC.

  2. Deploy the VPX ingress and ingress controller to push the CPX configuration into the tier 1 ADC automatically. Note:- Go to ingress_vpx.yaml and change the IP address of ingress.citrix.com/frontend-ip: "x.x.x.x" annotation to one of the free IP which will act as content switching vserver for accessing microservices. e.g. ingress.citrix.com/frontend-ip: "10.105.158.160" Go to cic_vpx.yaml and change the NS_IP value to your VPX NS_IP.
    - name: "NS_IP" value: "x.x.x.x" Now execute the following commands after the above change.

kubectl create -f /root/yamls/ingress_vpx.yaml -n tier-2-adc
kubectl create -f /root/yamls/cic_vpx.yaml -n tier-2-adc
  1. Add the DNS entries in your local machine host files for accessing microservices though internet. Path for host file: C:\Windows\System32\drivers\etc\hosts Add below entries in hosts file and save the file
<frontend-ip from ingress_vpx.yaml> hotdrink.beverages.com
<frontend-ip from ingress_vpx.yaml> colddrink.beverages.com
<frontend-ip from ingress_vpx.yaml> guestbook.beverages.com
  1. Now you can access your microservices over the internet. e.g. https://hotdrink.beverages.com

hotbeverage_webpage

  1. Deploy the CNCF monitoring tools such as Prometheus and Grafana to collect ADC proxies’ stats. Monitoring ingress yaml will push the configuration automatically to Tier 1 ADC. Note:- Go to ingress_vpx_monitoring.yaml and change the frontend-ip address from ingress.citrix.com/frontend-ip: "x.x.x.x" annotation to one of the free IP which will act as content switching vserver Prometheus and Grafana portal or you can use the same frontend-IP used in Step 11. e.g. ingress.citrix.com/frontend-ip: "10.105.158.161"
kubectl create -f /root/yamls/monitoring.yaml -n monitoring
kubectl create -f /root/yamls/ingress_vpx_monitoring.yaml -n monitoring
  1. Add the DNS entries in your local machine host files for accessing monitoring portals though internet. Path for host file: C:\Windows\System32\drivers\etc\hosts Add below entries in hosts file and save the file
<frontend-ip from ingress_vpx_monitoring.yaml> grafana.beverages.com
<frontend-ip from ingress_vpx_monitoring.yaml> prometheus.beverages.com
  1. Login to http://grafana.beverages.com and do the following one time setup Login to portal using admin/admin credentials. Click on Add data source and select the Prometheus data source. Do the settings as shown below and click on save & test button.

grafana_webpage

From the left panel, select import option and upload the json file provided in folder yamlFiles /example-cpx-vpx-for-kubernetes-2-tier-microservices/config/grafana_config.json Now you can see the Grafana dashboard with basic ADC stats listed.

grafana_stats

Citrix ADC solution supports the load balancing of various protocol layer traffic such as SSL, SSL_TCP, HTTP, TCP. Below screenshot has listed different flavours of traffic supported by this demo. traffic_flow