netscaler-ingress-controller
by NetScaler
A Helm chart for NetScaler Ingress Controller configuring MPX/VPX.
About this chart
NetScaler Ingress Controller
NetScaler provides an Ingress Controller for NetScaler MPX (hardware), NetScaler VPX (virtualized), and NetScaler CPX (containerized) for bare metal and cloud deployments. It configures one (or more) NetScaler based on the Ingress resource configuration in Kubernetes or in OpenShift cluster.
TL;DR;
For Kubernetes
helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/
helm install nsic netscaler/netscaler-ingress-controller --set nsIP=<NSIP>,license.accept=yes,adcCredentialSecret=<Secret-for-NetScaler-credentials>
For OpenShift
helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/
helm install nsic netscaler/netscaler-ingress-controller --set nsIP=<NSIP>,license.accept=yes,adcCredentialSecret=<Secret-for-NetScaler-credentials>,openshift=true
Important:
The
license.acceptargument is mandatory. Ensure that you set the value asyesto accept the terms and conditions of the NetScaler license.
NOTE:
The CRDs supported by NetScaler will be installed automatically with the installation of the Helm Charts if CRDs are not already available in the cluster.
Introduction
This Helm chart deploys NetScaler ingress controller in the Kubernetes or in the Openshift cluster using Helm package manager.
NetScaler credential hot-reload with HashiCorp Vault
This chart can source the NetScaler (ADC) login credentials from HashiCorp Vault and hot-reload them when they rotate, without restarting the controller. The feature is opt-in: set vaultCredentials.enabled=true and add a Vault Agent sidecar (via extraContainers) that renders the username and password files into the shared credential volume the chart mounts at vaultCredentials.mountPath (default /etc/citrix); adcCredentialSecret then becomes optional. Any rotated credential is validated against the NetScaler before the controller switches to it, and the controller keeps the last-good credential if a rotation is invalid. But if you already changed the password on the NetScaler, the last-good credential no longer works either, and the controller cannot log in, so fix the value in Vault right away. Requires NetScaler Ingress Controller 4.3.x or later. Vault (files) and adcCredentialSecret are not mutually exclusive: the controller resolves each field file-first (IP-keyed file → flat file → NS_USER/NS_PASSWORD from adcCredentialSecret), so a file always takes precedence and the secret is used only as a fallback for a missing/empty file — and only the file source is hot-reloaded. vaultCredentials.suppressEnvCredentials (default true) omits the adcCredentialSecret env entirely for a Vault-only deployment (making adcCredentialSecret optional); set it false to keep the secret as a static start-up fallback. The chart sets the NS_CRED_HOTRELOAD environment variable from this flag in both directions, so hot-reload is armed only when you ask for it: an existing /etc/citrix/username/password secret-as-file mount — supported long before this feature — does not turn it on by itself on upgrade. vaultCredentials.shareWithExporter (default true) mounts the same credential volume into the metrics exporter, which reads it from a fixed /mnt/nslogin; set it false if your exporter takes its credentials from a separate secret, and the chart keeps the exporter's NS_USER/NS_PASSWORD env. If you run the metrics exporter (exporter.required=true) and it shares the volume, also add a one-shot Vault Agent init container via initContainers (default []). An init container is a container that Kubernetes runs to completion before it starts the other containers of the pod, so the files exist before the controller and the exporter start. This init container runs the HashiCorp Vault image (hashicorp/vault) with the agent command, so it is a Vault client, not a Vault server; it logs in to Vault with the pod's service account token. The chart does not add it for you. Give it the same image, environment, and volume mounts as the sidecar, plus the -exit-after-auth flag so that it writes the files once and exits, and keep the sidecar: it rewrites the files after each rotation so the controller can hot-reload them. This is needed because the exporter reads the files only once, at start-up, and the sidecar usually writes them too late; for the same reason, after each rotation, once the controller logs Credential hot-reload: promoted, restart the pod so that the exporter gets the new password too. For step-by-step instructions and the full list of vaultCredentials.* and sidecar hook variables, see Use Vault-stored credentials.
# only when the metrics exporter shares the credential volume
initContainers:
- name: vault-agent-init
image: hashicorp/vault:1.21 # the same image as the sidecar, run as a Vault Agent, not a Vault server
args: ["agent", "-config=/etc/vault/vault-agent-config.hcl", "-exit-after-auth"] # write the files once, then exit
# env and volumeMounts: the same as your vault-agent sidecar in extraContainers
Prerequisites
-
The Kubernetes version should be 1.24 and above if using Kubernetes environment.
-
Kubernetes version 1.29 or later is required to enable API Priority and Fairness (
apiPriorityAndFairness.enabled=true). -
The Openshift version 4.8 or later if using OpenShift platform.
-
Openshift version 4.16 or later is required to enable API Priority and Fairness (
apiPriorityAndFairness.enabled=true). -
The Helm version 3.x or later. You can follow instruction given here to install the same.
-
You determine the NS_IP IP address needed by the controller to communicate with NetScaler. The IP address might be anyone of the following depending on the type of NetScaler deployment:
-
(Standalone appliances) NSIP - The management IP address of a standalone NetScaler appliance. For more information, see IP Addressing in NetScaler.
-
(Appliances in High Availability mode) SNIP - The subnet IP address. For more information, see IP Addressing in NetScaler.
-
(Appliances in Clustered mode) CLIP - The cluster management IP (CLIP) address for a clustered NetScaler deployment. For more information, see IP addressing for a cluster.
-
-
You have installed Prometheus Operator, if you want to view the metrics of the NetScaler CPX collected by the metrics exporter.
-
The user name and password of the NetScaler VPX or MPX appliance used as the ingress device. The NetScaler appliance needs to have system user account (non-default) with certain privileges so that NetScaler ingress controller can configure the NetScaler VPX or MPX appliance. For instructions to create the system user account on NetScaler, see Create System User Account for NSIC in NetScaler.
You can pass user name and password using Kubernetes secrets. Create a Kubernetes secret for the user name and password using the following command:
kubectl create secret generic nslogin --from-literal=username='nsic' --from-literal=password='mypassword'
Create system User account for NetScaler ingress controller in NetScaler
NetScaler ingress controller configures the NetScaler using a system user account of the NetScaler. The system user account should have certain privileges so that the NSIC has permission 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
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 <username> <password>For example:
add system user nsic mypassword -
Create a policy to provide required permissions to the system user account. Use the following command:
add cmdpolicy nsic-policy ALLOW '^(\?!shell)(\?!sftp)(\?!scp)(\?!batch)(\?!source)(\?!.*superuser)(\?!.*nsroot)(\?!install)(\?!show\s+system\s+(user|cmdPolicy|file))(\?!(set|add|rm|create|export|kill)\s+system)(\?!(unbind|bind)\s+system\s+(user|group))(\?!diff\s+ns\s+config)(\?!(set|unset|add|rm|bind|unbind|switch)\s+ns\s+partition).*|(^install\s*(wi|wf))|(^\S+\s+system\s+file)^(\?!shell)(\?!sftp)(\?!scp)(\?!batch)(\?!source)(\?!.*superuser)(\?!.*nsroot)(\?!install)(\?!show\s+system\s+(user|cmdPolicy|file))(\?!(set|add|rm|create|export|kill)\s+system)(\?!(unbind|bind)\s+system\s+(user|group))(\?!diff\s+ns\s+config)(\?!(set|unset|add|rm|bind|unbind|switch)\s+ns\s+partition).*|(^install\s*(wi|wf))|(^\S+\s+system\s+file)'Note: The system user account would have privileges based on the command policy that you define. The command policy mentioned in step 3 is similar to the built-in
sysAdmincommand policy with another permission to upload files.The command policy spec provided above have already escaped special characters for easier copy pasting into the NetScaler command line.
For configuring the command policy from NetScaler Configuration Wizard (GUI), use the below command policy spec.
^(?!shell)(?!sftp)(?!scp)(?!batch)(?!source)(?!.*superuser)(?!.*nsroot)(?!install)(?!show\s+system\s+(user|cmdPolicy|file))(?!(set|add|rm|create|export|kill)\s+system)(?!(unbind|bind)\s+system\s+(user|group))(?!diff\s+ns\s+config)(?!(set|unset|add|rm|bind|unbind|switch)\s+ns\s+partition).*|(^install\s*(wi|wf))|(^\S+\s+system\s+file)^(?!shell)(?!sftp)(?!scp)(?!batch)(?!source)(?!.*superuser)(?!.*nsroot)(?!install)(?!show\s+system\s+(user|cmdPolicy|file))(?!(set|add|rm|create|export|kill)\s+system)(?!(unbind|bind)\s+system\s+(user|group))(?!diff\s+ns\s+config)(?!(set|unset|add|rm|bind|unbind|switch)\s+ns\s+partition).*|(^install\s*(wi|wf))|(^\S+\s+system\s+file) -
Bind the policy to the system user account using the following command:
bind system user nsic nsic-policy 0
Installing the Chart
Add the NetScaler Ingress Controller helm chart repository using command:
helm repo add netscaler https://netscaler.github.io/netscaler-helm-charts/
For Kubernetes:
1. NetScaler Ingress Controller
To install the chart with the release name, my-release, use the following command:
helm install my-release netscaler/netscaler-ingress-controller --set nsIP=<NSIP>,license.accept=yes,adcCredentialSecret=<Secret-for-NetScaler-credentials>,ingressClass[0]=<ingressClassName>
Note:
By default the chart installs the recommended RBAC roles and role bindings.
The command deploys NetScaler ingress controller on Kubernetes cluster with the default configuration. The configuration section lists the mandatory and optional parameters that you can configure during installation.
2. NetScaler Ingress Controller with Exporter
Metrics exporter can be deployed along with NetScaler ingress controller and collects metrics from the NetScaler instances. You can then visualize these metrics using Prometheus Operator and Grafana.
Note: Ensure that you have installed Prometheus Operator.
Use the following command for this:
helm install my-release netscaler/netscaler-ingress-controller --set nsIP=<NSIP>,license.accept=yes,adcCredentialSecret=<Secret-for-NetScaler-credentials>,ingressClass[0]=<ingressClassName>,exporter.required=true,exporter.validateCert=auto
Note:
exporter.validateCertis mandatory wheneverexporter.required=true, andhelm upgradefrom chart 4.2.26 or earlier fails until you set it.automakes the exporter validate the NetScaler certificate against its image trust store.autoneeds exporter 1.7.0
Deploy netscaler-ingress-controller with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has netscaler-ingress-controller 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 chartnetscaler-ingress-controller is pinned at v4.3.22 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