citrix-adc-istio-egress-gateway
by NetScaler
A Helm chart for NetScaler as Egress Gateway installation in Istio Service Mesh on Kubernetes platform
About this chart
Deploy NetScaler as an egress Gateway in Istio environment using Helm charts
NetScaler can be deployed as an Istio Egress Gateway to control the egress traffic to Istio service mesh.
Table of Contents
- TL; DR;
- Introduction
- Deploy NetScaler VPX or MPX as an Egress Gateway
- Deploy NetScaler CPX as an Egress Gateway
- Visualizing statistics of NetScaler Egress Gateway with Metrics Exporter
- NetScaler CPX License Provisioning
- Service Graph configuration
- Generate Certificate for Egress Gateway
- NetScaler as Egress Gateway: a sample deployment
- Uninstalling the Helm chart
- Configuration Parameters
TL; DR;
To deploy NetScaler VPX or MPX as an Egress Gateway
kubectl create secret generic nsloginegress --from-literal=username=<netscaler-user> --from-literal=password=<netscaler-password> -n netscaler-system
helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/
helm install citrix-adc-istio-egress-gateway netscaler/citrix-adc-istio-egress-gateway --namespace netscaler-system --set egressGateway.EULA=YES --set egressGateway.netscalerUrl=https://<nsip>[:port] --set egressGateway.vserverIP=<IPv4 Address> --set secretName=nsloginegress
To deploy NetScaler CPX as an Egress Gateway
helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/
helm install citrix-adc-istio-egress-gateway netscaler/citrix-adc-istio-egress-gateway --namespace netscaler-system --set egressGateway.EULA=true --set citrixCPX=true
Introduction
This chart deploys NetScaler CPX as an Egress Gateway. An egress gateway defines the exit point from the mesh. It provides features like load balancing at the edge of the mesh, monitoring, and routing rules to exiting the mesh.
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 version | Istio version |
|---|---|
| quay.io/citrix/citrix-xds-adaptor:0.10.3 | Istio v1.14+ |
| quay.io/citrix/citrix-xds-adaptor:0.10.1 | Istio v1.12 to Istio v1.13 |
| quay.io/citrix/citrix-xds-adaptor:0.9.9 | Istio v1.10 to Istio v1.11 |
| quay.io/citrix/citrix-xds-adaptor:0.9.8 | Istio v1.8 to Istio v1.9 |
| quay.io/citrix/citrix-xds-adaptor:0.9.5 | Istio v1.6 |
Prerequisites
The following prerequisites are required for deploying NetScaler as an Egress Gateway in Istio service mesh:
-
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/v1beta1API is enabledYou can verify the API by using the following command:
kubectl api-versions | grep admissionregistration.k8s.io/v1The following output indicates that the API is enabled:
admissionregistration.k8s.io/v1 admissionregistration.k8s.io/v1beta1 -
For deploying NetScaler VPX or MPX as an Egress gateway:
Create a Kubernetes secret for the NetScaler user name and password using the following command:
kubectl create secret generic nsloginegress --from-literal=username=<netscaler-user> --from-literal=password=<netscaler-password> -n netscaler-system -
Ensure that your cluster has Kubernetes version 1.16.0 or later and the
admissionregistration.k8s.io/v1beta1API is enabled -
Create system user account for xDS-adaptor in NetScaler:
The NetScaler appliance needs to have system user account (non-default) with certain privileges so that
xDS-adaptorcan configure the NetScaler VPX or MPX appliance. Follow the instructions to create the system user account on NetScaler.Create a Kubernetes secret for the user name and password using the following command: kubectl create secret generic nslogin --from-literal=username='cxa' --from-literal=password='mypassword'
The
xDS-adaptorconfigures the NetScaler using a system user account of the NetScaler. The system user account should have certain privileges so that the xDS-adaptor has permissions configure the following on the NetScaler:- Add, Delete, or View Content Switching (CS) virtual server
- Configure CS policies and actions
- Configure Load Balancing (LB) virtual server
- Configure Service groups
- Cofigure SSl certkeys
- Configure routes
- Configure user monitors
- Add system file (for uploading SSL certkeys from Kubernetes)
- Configure Virtual IP address (VIP)
- Check the status of the NetScaler appliance
- Add, Delete or view authentication virtual server, policy, authaction
- Add, Delete or view Policy
- Add, Delete or view Responder policy, action, param
- Add, Delete or view Rewrite policy, action, param
- Add, Delete or view analytics profile
- Add, Delete or view DNS name server
- Add, Delete or view network netprofile
- Add, Delete or view Traffic Management Commands(sessionaction, session policy, sessionparameter)
Note:
The system user account would have privileges based on the command policy that you define.
To create the system user account, do the following:
-
Log on to the NetScaler appliance. Perform the following:
-
Use an SSH client, such as PuTTy, to open an SSH connection to the NetScaler appliance.
-
Log on to the appliance by using the administrator credentials.
-
-
Create the system user account using the following command: add system user For example: add system user cxa mypassword
-
Create a policy to provide required permissions to the system user account. Use the following command:
add cmdpolicy cxa-policy ALLOW "((^\S+\s+cs\s+\S+)|(^\S+\s+lb\s+\S+)|(^\S+\s+service\s+\S+)|(^\S+\s+servicegroup\s+\S+)|(^stat\s+system)|(^show\s+ha)|(^\S+\s+ssl\s+certKey)|(^\S+\s+ssl)|(^\S+\s+route)|(^\S+\s+monitor)|(^show\s+ns\s+ip)|(^\S+\s+system\s+file)|)|(^\S+\s+aaa\s+\S+)|(^\S+\s+aaa\s+\S+\s+.)|(^\S+\s+authentication\s+\S+)|(^\S+\s+authentication\s+\S+\s+.)|(^\S+\s+policy\s+\S+)|(^\S+\s+policy\s+\S+\s+.)|(^\S+\s+rewrite\s+\S+)|(^\S+\s+rewrite\s+\S+\s+.)|(^\S+\s+analytics\s+\S+)|(^\S+\s+analytics\s+\S+\s+.)|(^\S+\s+dns\s+\S+)|(^\S+\s+dns\s+\S+\s+.)|(^\S+\s+netProfile)|(^\S+\s+netProfile\s+.)|(^\S+\s+tm\s+\S+)|(^\S+\s+tm\s+\S+\s+.)"
-
Bind the policy to the system user account using the following command: bind system user cxa cxa-policy 0
- Registration of NetScaler CPX in ADM
Create a secret for ADM username and password
kubectl create secret generic admloginegress --from-literal=username=<adm-username> --from-literal=password=<adm-password> -n netscaler-system
- Important Note: For deploying NetScaler VPX or MPX as egress gateway, you should establish the connectivity between NetScaler VPX or MPX and cluster nodes. This connectivity can be established by configuring routes on NetScaler as mentioned here or by deploying NetScaler Node Controller.
Deploy NetScaler VPX or MPX as an Egress Gateway
To deploy NetScaler VPX or MPX as an Egress Gateway in the Istio service mesh, do the following step. In this example, release name is specified as citrix-adc-istio-egress-gateway and namespace as netscaler-system.
kubectl create secret generic nsloginegress --from-literal=username=<netscaler-user> --from-literal=password=<netscaler-password> -n netscaler-system
helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/
helm install citrix-adc-istio-egress-gateway netscaler/citrix-adc-istio-egress-gateway --namespace netscaler-system --set egressGateway.EULA=YES,egressGateway.netscalerUrl=https://<nsip>[:port],egressGateway.vserverIP=<IPv4 Address> --set secretName=nsloginegress
Deploy NetScaler CPX as an Egress Gateway
To deploy NetScaler CPX as an egress Gateway, do the following step. In this example, release name is specified as citrix-adc-istio-egress-gateway and namespace is used as netscaler-system.
helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/
helm install citrix-adc-istio-egress-gateway netscaler/citrix-adc-istio-egress-gateway --namespace netscaler-system --set egressGateway.EULA=true --set citrixCPX=true
Visualizing statistics of NetScaler Egress Gateway with Metrics Exporter
By default, NetScaler Metrics Exporter is also deployed along with NetScaler Egress Gateway. NetScaler Metrics Exporter fetches statistical data from NetScaler and exports it to Prometheus running in Istio service mesh. When you add Prometheus as a data source in Grafana, you can visualize this statistical data in the Grafana dashboard.
Metrics Exporter requires the IP address of NetScaler CPX or VPX as Egress Gateway. It is retrieved from the value specified for EgressGateway.netscalerUrl.
When NetScaler CPX is deployed as Egress Gateway, Metrics Exporter runs along with NetScaler CPX Egress Gateway in the same pod and specifying IP address is optional.
To deploy NetScaler CPX as Egress Gateway without Metrics Exporter, set the value of metricExporter.required as false.
helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/
helm install citrix-adc-istio-egress-gateway netscaler/citrix-adc-istio-egress-gateway --namespace netscaler-system --set egressGateway.EULA=YES --set citrixCPX=true --set metricExporter.required=false
To deploy NetScaler VPX or MPX as Egress Gateway without Metrics Exporter, set the value of metricExporter.required as false.
kubectl create secret generic nsloginegress --from-literal=username=<netscaler-user> --from-literal=password=<netscaler-password> -n netscaler-system
helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/
helm install citrix-adc-istio-egress-gateway netscaler/citrix-adc-istio-egress-gateway --namespace netscaler-system --set egressGateway.EULA=YES,egressGateway.netscalerUrl=https://<nsip>[:port],egressGateway.vserverIP=<IPv4 Address>,metricExporter.required=false,secretName=nsloginegress
"Note:" To remotely access telemetry addons such as Prometheus and Grafana, see Remotely Accessing Telemetry Addons.
Generate Certificate for Egress Gateway
NetScaler Egress gateway needs TLS certificate-key pair for establishing secure communication channel with 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 citrix-adc-istio-egress-gateway netscaler/citrix-adc-istio-egress-gateway --namespace netscaler-system --set egressGateway.EULA=YES --set citrixCPX=true --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/v
Deploy citrix-adc-istio-egress-gateway with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has citrix-adc-istio-egress-gateway 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartcitrix-adc-istio-egress-gateway is pinned at v1.14.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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