citrix-cpx-istio-sidecar-injector

by NetScaler

Helm chartv1.14.1App 1.14.1Verified publisher

A Helm chart to deploy resources which install NetScaler CPX in Istio Service Mesh as sidecar in application pod

About this chart

Deploy NetScaler CPX as a sidecar in Istio environment using Helm charts

NetScaler CPX can be deployed as a sidecar proxy in an application pod in the Istio service mesh.

Table of Contents

  1. TL; DR;
  2. Introduction
  3. Deploy Sidecar Injector for NetScaler CPX using Helm chart
  4. Observability using NetScaler Observability Exporter
  5. NetScaler CPX License Provisioning
  6. Service Graph configuration
  7. Generate Certificate for Application
  8. Limitations
  9. Clean Up
  10. Configuration Parameters

TL; DR;

kubectl create namespace netscaler-system

helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/

helm install cpx-sidecar-injector netscaler/citrix-cpx-istio-sidecar-injector --namespace netscaler-system --set cpxProxy.EULA=YES

Introduction

NetScaler CPX can act as a sidecar proxy to an application container in Istio. You can inject the NetScaler CPX manually or automatically using the Istio sidecar injector. Automatic sidecar injection requires resources including a Kubernetes mutating webhook admission controller, and a service. Using this Helm chart, you can create resources required for automatically deploying NetScaler CPX as a sidecar proxy.

In Istio servicemesh, the namespace must be labelled before applying the deployment yaml for automatic sidecar injection. Once the namespace is labelled, sidecars (envoy or CPX) will be injected while creating pods.

  • For CPX, namespace must be labelled cpx-injection=enabled
  • For Envoy, namespace must be labelled istio-injection=enabled

Note: If a namespace is labelled with both istio-injection and cpx-injection, Envoy injection takes a priority! NetScaler CPX won't be injected on top of the already injected Envoy sidecar. For using NetScaler as sidecar, ensure that istio-injection label is removed from the namespace.

For detailed information on different deployment options, see Deployment Architecture.

Compatibility Matrix between NetScaler xDS-adaptor and Istio version

Below table provides info about recommended NetScaler xDS-Adaptor version to be used for various Istio versions.

NetScaler xDS-Adaptor versionIstio version
quay.io/citrix/citrix-xds-adaptor:0.10.3Istio v1.14+
quay.io/citrix/citrix-xds-adaptor:0.10.1Istio v1.12 to Istio v1.13
quay.io/citrix/citrix-xds-adaptor:0.9.9Istio v1.10 to Istio v1.11
quay.io/citrix/citrix-xds-adaptor:0.9.8Istio v1.8 to Istio v1.9
quay.io/citrix/citrix-xds-adaptor:0.9.5Istio v1.6

Prerequisites

The following prerequisites are required for deploying NetScaler as a sidecar to an application pod.

  • Ensure that Istio version 1.8 onwards is installed
  • Ensure that Helm with version 3.x is installed. Follow this step to install the same.
  • Ensure that your cluster Kubernetes version should be 1.16 onwards and the admissionregistration.k8s.io/v1, admissionregistration.k8s.io/v1beta1 API is enabled

You can verify the API by using the following command:

    kubectl api-versions | grep admissionregistration.k8s.io/v1

The following output indicates that the API is enabled:

    admissionregistration.k8s.io/v1
    admissionregistration.k8s.io/v1beta1
  • Create namespace netscaler-system

      kubectl create namespace netscaler-system
    
  • Registration of NetScaler CPX in ADM

Create a secret containing ADM username and password in each application namespace.

    kubectl create secret generic admlogin --from-literal=username=<adm-username> --from-literal=password=<adm-password> -n netscaler-system

Deploy Sidecar Injector for NetScaler CPX using Helm chart

Before you Begin

To deploy resources for automatic installation of NetScaler CPX as a sidecar in Istio, perform the following step. In this example, release name is specified as cpx-sidecar-injector and namespace is used as netscaler-system.

helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/

helm install cpx-sidecar-injector netscaler/citrix-cpx-istio-sidecar-injector --namespace netscaler-system --set cpxProxy.EULA=YES

This step installs a mutating webhook and a service resource to application pods in the namespace labeled as cpx-injection=enabled.

"Note:" The cpx-injection=enabled label is mandatory for injecting sidecars.

An example to deploy application along with NetScaler CPX sidecar is provided here.

Observability using NetScaler Observability Exporter

Pre-requisites

  1. NetScaler Observability Exporter (NSOE) should be deployed in the cluster.

  2. NetScaler CPX should be running with versions 13.0-48+ or 12.1-56+.

NetScaler CPXes serving East West traffic send its metrics and transaction data to NSOE which has a support for Prometheus and Zipkin.

Metrics data can be visualized in Prometheus dashboard.

Zipkin enables users to analyze tracing for East-West service to service communication.

Note: Istio should be installed with Zipkin as tracing endpoint.

helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/

helm install cpx-sidecar-injector netscaler/citrix-cpx-istio-sidecar-injector --namespace netscaler-system --set cpxProxy.EULA=YES,coe.coeURL=<coe-service-name>.<namespace>

By default, NSOE is primarily used for Prometheus integration. Servicegraph and tracing is handled by NetScaler ADM appliance. To enable Zipkin tracing, set argument coe.coeTracing=true in helm command. Default value of coeTracing is set to false.

helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/

helm install cpx-sidecar-injector netscaler/citrix-cpx-istio-sidecar-injector --namespace netscaler-system --set cpxProxy.EULA=YES,coe.coeURL=<coe-service-name>.<namespace>,coe.coeTracing=true

For example, if NSOE is deployed as coe in netscaler-system namespace, then below helm command will deploy sidecar injector webhook which will be deploying NetScaler CPX sidecar proxies in application pods, and these sidecar proxies will be configured to establish communication channels with NSOE.

helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/

helm install cpx-sidecar-injector netscaler/citrix-cpx-istio-sidecar-injector --namespace netscaler-system --set cpxProxy.EULA=YES,coe.coeURL=coe.netscaler-system

Important: Apply below mentioned annotations on NSOE deployment so that Prometheus can scrape data from NSOE.

        prometheus.io/scrape: "true"
        prometheus.io/port: "5563" # Prometheus port

NetScaler CPX License Provisioning

By default, CPX runs with 20 Mbps bandwidth called as [CPX Express](https://www.netscaler.com/platform/cpx-containerter performance and production deployment customer needs licensed CPX instances. NetScaler ADM is used to check out licenses for NetScaler CPX.

Bandwidth based licensing For provisioning licensing on NetScaler CPX, it is mandatory to provide License Server information to CPX. This can be done by setting ADMSettings.licenseServerIP as License Server IP. In addition to this, ADMSettings.bandWidthLicense needs to be set true and desired bandwidth capacity in Mbps should be set ADMSettings.bandWidth. For example, to set 2Gbps as bandwidth capacity, below command can be used.

helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/

helm install cpx-sidecar-injector netscaler/citrix-cpx-istio-sidecar-injector --namespace netscaler-system --set cpxProxy.EULA=YES --set ADMSettings.licenseServerIP=<licenseServer_IP>,ADMSettings.bandWidthLicense=True --set ADMSettings.bandWidth=2000

Service Graph configuration

NetScaler ADM Service graph is an observability tool that allows user to analyse service to service communication. The service graph is generated by ADM post collection of transactional data from registered NetScaler instances. More details about it can be found here. NetScaler needs to be provided with ADM details for registration and data export. This section lists the steps needed to deploy NetScaler and register it with ADM.

  1. Create secret using NetScaler ADM Agent credentials, which will be used by NetScaler as CPX to communicate with NetScaler ADM Agent:
kubectl create secret generic admlogin --from-literal=username=<adm-agent-username> --from-literal=password=<adm-agent-password>
  1. Deploy NetScaler CPX sidecar injector using helm command with ADM details:
helm install cpx-sidecar-injector netscaler/citrix-cpx-istio-sidecar-injector --namespace netscaler-system --set cpxProxy.EULA=YES --set ADMSettings.ADMIP=<ADM-Agent-IP>

Note: If container agent is being used here for NetScaler ADM, specify serviceIP of container agent in the ADMSettings.ADMIP parameter.

Generate Certificate for Application

Application needs TLS certificate-key pair for establishing secure communication channel with other applications. Earlier these certificates were issued by Istio Citadel and bundled in Kubernetes secret. Certificate was loaded in the application pod by doing volume mount of secret. Now xDS-Adaptor can generate its own certificate and get it signed by the Istio Citadel (Istiod). This eliminates the need of secret and associated risks.

xDS-Adaptor needs to be provided with details Certificate Authority (CA) for successful signing of Certificate Signing Request (CSR). By default, CA is istiod.istio-system.svc which accepts CSRs on port 15012. To skip this process, don't provide any value (empty string) to certProvider.caAddr.

	helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/

        helm install cpx-sidecar-injector netscaler/citrix-cpx-istio-sidecar-injector --namespace netscaler-system --set cpxProxy.EULA=YES --set certProvider.caAddr=""

Configure Third Party Service Account Tokens

In order to generate certificate for application workload, xDS-Adaptor needs to send valid service account token along with Certificate Signing Request (CSR) to the Istio control plane (Citadel CA). Istio control plane authenticates the xDS-Adaptor using this JWT. Kubernetes supports two forms of these tokens:

  • Third party tokens, which have a scoped audience and expiration.
  • First party tokens, which have no expiration and are mounted into all pods.

If Kubernetes cluster is installed with third party tokens, then the same information needs to be provided for automatic sidecar injection by passing --set certProvider.jwtPolicy="third-party-jwt". By default, it is first-party-jwt.

        helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/

        helm install cpx-sidecar-injector netscaler/citrix-cpx-istio-sidecar-injector --namespace netscaler-system --set cpxProxy.EULA=YES --set certProvider.caAddr="istiod.istio-system.svc" --set certProvider.jwtPolicy="third-party-jwt"

To determine if your cluster supports third party tokens, look for the TokenRequest API using below command. If there is no output, then it is first-party-jwt. In case of third-party-jwt, output will be like below.

# kubectl get --raw /api/v1 | jq '.resources[] | select(.name | index("serviceaccounts/token"))'

{
    "name": "serviceaccounts/token",
    "singularName": "",
    "namespaced": true,
    "group": "authentication.k8s.io",
    "version": "v1",
    "kind": "TokenRequest",
    "verbs": [
        "create"
    ]
}

Limitations

NetScaler CPX occupies certain ports for internal usage. This makes application service running on one of these restricted ports incompatible with the NetScaler CPX. The list of ports is mentioned below. NetScaler is working on delisting some of the major ports from the given list, and same shall be available in future releases.

Restricted Ports

Sr NoPort Number
180
23010
35555
48080

Clean Up

To delete the resources created for automatic injection with the release name cpx-sidecar-injector, perform the following step.

helm delete cpx-sidecar-injector

Configuration parameters

The following table lists the configurable parameters and their default values in the Helm

Deploy citrix-cpx-istio-sidecar-injector with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has citrix-cpx-istio-sidecar-injector on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcitrix-cpx-istio-sidecar-injector is pinned at v1.14.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply