Jump to content
Welcome to our new Citrix community!
  • Deployment options for Ingress proxy in Kubernetes cluster


    Mayur Patil
    • Validation Status: Work In Progress
      Summary: Deployment options for Ingress proxy in Kubernetes cluster
      Has Video?: No

    To route the client traffic to a microservice based application, you have to write Ingress rules that must propagate in the Ingress proxy for better traffic distribution. Ingress proxy acts as Application Delivery Controller to load balance microservice based application.

    Citrix has a container based Ingress proxy called as NetScaler CPX. It provides application load balancing, acceleration, security, and offload feature set in a simple, easy-to-install container. The NetScaler CPX is built from the same code base as the NetScaler and is packaged as a Docker container.

    In this article, NetScaler CPX (a containerized form-factor) routes the Ingress traffic to the Apache microservice application.

    NetScaler CPX supports the following deployment modes:

    Deploy a standalone NetScaler CPX (NetScaler CPX per Kubernetes cluster)

    1. Deploy a stand-alone NetScaler CPX as an ingress proxy.

      ```kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yamlkubectl get pods -l app=cpx-ingresskubectl get svc cpx-service```

    2. Send traffic to the Apache microservice.

      ```curl -s -H "Host: www.ingress.com" http://<Master IP:<NodePort>```

    3. Clean up the setup.

      kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yaml

    Deploy NetScaler CPX per node of a Kubernetes cluster

    1. Get the list of nodes in a cluster and deploy NetScaler CPX per node.

      kubectl get nodeskubectl create -f <https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/cpx-per-node-mode.yaml>kubectl get pods -l app=cpx-ingresskubectl get svc cpx-service

      The number of CPX-ingress pods are equal to the number of nodes in the Kubernetes cluster deploying pods.

    2. Deploy traffic to the Apache microservice.

      ```curl -s -H "Host: www.ingress.com" <http://<Master IP:<NodePort>```

    3. Clean up the setup.

      kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/cpx-per-node-mode.yaml

    Deploy NetScaler CPX per namespace deployment

    The following example shows how to deploy NetScaler CPX in multiple namespaces.

    1. Create three namespaces in the Kubernetes cluster.

      ```kubectl create namespace team-Akubectl create namespace team-Bkubectl create namespace team-C```

    2. Deploy the NetScaler CPX in each namespace.

       kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yaml -n team-A kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yaml -n team-B kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yaml -n team-C

    3. Deploy the colddrink microservice apps in all namespaces.

      kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-app.yaml -n team-A kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-app.yaml -n team-B kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-app.yaml -n team-C

    4. Verify the deployment using the following commands:

       kubectl get pods -l app=frontend-colddrinks -n team-A kubectl get pods -l app=frontend-colddrinks -n team-B kubectl get pods -l app=frontend-colddrinks -n team-C

    5. Deploy Ingress rules that send traffic to http://www.colddrink.com.

       kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-ingress.yaml -n team-A kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-ingress.yaml -n team-B kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-ingress.yaml -n team-C

    6. Verify the Ingress using the following commands:

       kubectl get ingress -n team-A kubectl get svc cpx-service -n team-A kubectl get ingress -n team-B kubectl get svc cpx-service -n team-B kubectl get ingress -n team-C kubectl get svc cpx-service -n team-C

    7. Deploy the traffic for each NetScaler CPX deployed in different namespaces.

       kubectl get pods -l app=cpx-ingress -n team-A kubectl get pods -l app=cpx-ingress -n team-B kubectl get pods -l app=cpx-ingress -n team-C kubectl get svc -n team-A kubectl get svc -n team-B kubectl get svc -n team-C

    8. Verify NodePort for all CPXs and create cURL requests.

       curl -s -H "Host: www.ingress.com" http://<Master IP:<NodePort>

    9. Clean up the setup.

       kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yaml -n team-A kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yaml -n team-B kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yaml -n team-C kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-app.yaml -n team-A kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-app.yaml -n team-B kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-app.yaml -n team-C kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-ingress.yaml -n team-A kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-ingress.yaml -n team-B kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/colddrink-ingress.yaml -n team-C kubectl delete namespace team-A team-B team-C

    High availability NetScaler CPX deployment

    This example shows how to deploy NetScaler CPX in high availability mode.

    1. Deploy NetScaler CPX in high availability mode.

       kubectl create -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yaml kubectl get pods -l app=cpx-ingress

    2. Scale up the NetScaler CPX to two instances.

       kubectl scale deployment cpx-ingress --replicas=2  kubectl get pods -l app=cpx-ingress

      Now both NetScaler CPXs are capable to take distributed Ingress traffic.

    3. Scale down NetScaler CPX pods to a single instance.

       kubectl scale deployment cpx-ingress --replicas=1 kubectl get pods app=cpx-ingress

    4. Test the Kubernetes self-healing mechanism.

       kubectl get pods -l app=cpx-ingress kubectl delete pod <cpx-ingress pod name> kubectl get pods -l app=cpx-ingress

      You can see that a new NetScaler CPX pod has come up immediately after a running pod goes down.

    5. Try out Horizontal pod autoscaling for NetScaler CPX.

       NetScaler CPX supports Horizontal Pod Autoscaling (HPA) to automatically scale the number of pods in your workload based on different metrics like actual resource usage. Try out CPX HPA from [CPX HPA documentation](https://developer-docs.citrix.com/projects/citrix-k8s-ingress-controller/en/latest/how-to/cpx-hpa/)

    6. Clean up the setup.

       kubectl delete -f https://raw.githubusercontent.com/citrix/cloud-native-getting-started/master/beginners-guide/manifest/standalone-cpx-mode.yaml

    For more information, see the NetScaler CPX documentation.

    For more information on the Citrix ingress controller, see the Citrix ingress controller documentation.

    For more tutorials, see beginners-guides.


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...