• Facebook
  • Twitter
  • Youtube
  • LinkedIn
  • RSS
  • Docs
  • Comparisons
  • Blogs
  • Try NCache
  • Contact Us
Try NCache
Show / Hide Table of Contents

Deploy NCache with OpenShift

NCache can be deployed on an existing OpenShift cluster using the Helm chart or YAML files. Both methods create NCache server containers on Linux worker nodes and gateway services for client connections and management access.

This page describes the permissions and networking required for the deployment, followed by the steps to install and verify NCache. The examples use the default two-server configuration.

Prerequisites

Before you begin, make sure that:

  • You have access to an existing OpenShift cluster, or permission to create one as described below.
  • Your Kubernetes client is configured for the intended cluster. If deploying with Helm, Helm 3.14 or later is installed and configured.
  • You have permission to install namespace resources and cluster-wide RBAC resources. Your cluster administrator must authorize the NCache service account to use the security context constraints required by the container.
  • The OpenShift CLI (oc) is available for project setup, permissions, and Route configuration.
  • Your cluster security policy permits the anyuid security context constraint for the NCache service account. The current Enterprise images require this permission to run as the image user.
  • You have the Enterprise YAML files or access to the selected NCache chart version.
  • You have the required deployment key and any applicable licensing information.
  • The cluster provides gateway connectivity and the resources needed by the deployment.
  • The cluster must run Kubernetes version 1.25.0 or later. Provide at least two schedulable Linux worker nodes for separate-node placement, or configure shared-node placement for a single-node OKD deployment. For Helm, the default setting, deployment.podAntiAffinity=true, places each server on a separate node. If shared-node placement is acceptable, this value can be set to false during installation.

Create an OpenShift Cluster

If you do not already have an OpenShift cluster, install OpenShift Container Platform using the installation method appropriate for your infrastructure. For physical servers or virtual machines, the Red Hat Assisted Installer provides a guided installation process.

  • Create a cluster in the Assisted Installer and specify its name, base domain, and OpenShift version.
  • Generate and download the discovery ISO image, then attach it to each physical server or virtual machine and boot from it. Wait for each machine to appear in the installer before assigning its role.
  • Assign the control-plane and worker roles according to the selected cluster topology. Provide at least two schedulable Linux worker nodes for the default two-server NCache deployment, in addition to the required control-plane capacity.
  • Configure the cluster network and the API and ingress addresses required by your installation topology. Review the installer's host and network validations, resolve the reported issues, and start the installation once validation succeeds.
  • After installation completes, download and save the cluster's kubeconfig file on the machine from which you will run the deployment commands. Continue with Connect kubectl to OpenShift to select the cluster and verify its worker nodes. Ensure that the cluster provides a load balancer for the NCache gateway services before deploying NCache.

For local development on Windows, install CRC using the CRC installation instructions, then run the following commands in a normal PowerShell window as your regular Windows user. Approve elevation requests when prompted.

crc config set preset okd
crc setup
crc start
crc oc-env

If setup requests a restart, restart Windows and run crc setup again before crc start. After the cluster starts, execute the PowerShell command printed by crc oc-env to make oc available in that terminal. Continue with the project and permissions procedure below. Use the single-node settings in the selected deployment method and the Route procedure for Management Center access.

Deployment Process

Choose the deployment method below after connecting to your cluster. Both deployment methods use the ncache project and namespace. Use one method for a deployment so that the same resources are not managed by both Helm and YAML files.

Connect kubectl to OpenShift

For a cluster accessed through a downloaded kubeconfig, use the following procedure. For a local CRC cluster, use the CLI environment configured above and proceed to the context check.

  • In a Bash terminal, select the downloaded cluster configuration file. Replace the path with the location of your kubeconfig file.
export KUBECONFIG="/path/to/kubeconfig"
  • Use the cluster access configuration supplied by your OpenShift administrator and verify that it targets the intended cluster:
kubectl config current-context
kubectl get nodes

Before either deployment method, log in as kubeadmin or a cluster administrator, create the project, and grant the NCache service account permission to use the required security context constraint. If the project already exists, use oc project ncache in place of oc new-project ncache.

oc login -u kubeadmin "<api-url>"
oc new-project ncache
oc adm policy add-scc-to-user anyuid -z ncache-sa -n ncache
oc auth can-i use scc/anyuid --as=system:serviceaccount:ncache:ncache-sa -n ncache

In the anyuid command, -z ncache-sa specifies the service account, and -n ncache specifies the namespace. The final command should return yes. Complete the grant before installing NCache so that the server pods can start under the required security context.

Retain the container security settings in the supplied deployment files. Adding runAsNonRoot: true or allowPrivilegeEscalation: false prevents the current image from completing supported startup or authentication operations.

Deploy Using Helm

After confirming cluster access, prepare the chart and install NCache using the following steps.

Step 1: Prepare the NCache Helm Chart

  • Inspect the selected NCache chart's defaults:
helm show values oci://registry-1.docker.io/alachisoft/ncache-helm --version 5.3.8

Step 2: Install Helm Chart

For standard or mutual TLS, follow TLS Deployment for certificate preparation and client configuration. Use the chart reference and version shown on this page when installing on OpenShift, with deployment.platform=OpenShift.

Run the following command to deploy two NCache servers with defaultCache enabled. Replace xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx with your deployment key:

helm install ncache oci://registry-1.docker.io/alachisoft/ncache-helm --version 5.3.8 --set-string image.repository="alachisoft/ncache" --set-string image.tag="5.3.801" --namespace ncache --create-namespace \
  --set-string deployment.key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  --set-string deployment.platform="OpenShift"

On a single-node OKD cluster, add --set deployment.podAntiAffinity=false to the installation command so that both NCache server pods can run on the available node.

To install using the supplied deploy-ncache.sh, set NCACHE_KEY at the top of the script to your deployment key, then run the following command from its directory in Bash after selecting the ncache project.

oc project ncache
bash deploy-ncache.sh openshift

For a single-node cluster, add --set deployment.podAntiAffinity=false to the helm install command inside the script before running it. After the script finishes, skip the manual installation command and continue with Verify the Server Pods below. Check the configuration job, then follow Steps 3 and 4 to verify the services and open NCache Management Center.

Tip

For guidance on deploying in different scenarios, refer to Manage an Existing Deployment.

Verify the Server Pods

Check the pods and their worker-node placement after installation:

kubectl rollout status statefulset/ncache --namespace ncache
kubectl get pods,jobs --namespace ncache
kubectl get pods --namespace ncache -o wide

Check the security context assigned to each NCache server pod and verify its runtime user. Replace <pod-name> with each server pod name in turn.

oc get pod "<pod-name>" -n ncache -o 'jsonpath={.metadata.annotations.openshift\.io/scc}'
oc exec "<pod-name>" -n ncache -- id

For this deployment, the applied constraint should be anyuid and the runtime user should be 1655 (ncache). If the pod is rejected or cannot start, inspect its events and confirm the service account, namespace, and permission grant before checking cache status.

After Helm installs the release, NCache completes cache configuration and licensing through a configuration job. Follow Verify an Update to check the job result, then verify the caches in NCache Management Center before using the deployment.

Verify that all configured NCache server pods are ready; the default deployment contains two. If a pod fails to start, inspect its events and logs using its actual name, and check the deployment key, licensing values, and image access:

kubectl describe pod "<pod-name>" --namespace ncache
kubectl logs "<pod-name>" --namespace ncache

Step 3: Verify NCache Services

  • Check the server pods and gateway services:
kubectl get pods --namespace ncache -o wide
kubectl get svc --namespace ncache

Check the client endpoint and the configured Service ports. Configure public management access in Step 4:

  • Client connections: gateway.clientPort defaults to 9800.
  • Management: gateway.mgmtPorts defaults to 9801-9802, with session affinity.
  • Additional gateway ports: gateway.ports defaults to 9803-9997.
  • Portal: gateway.portalPorts defaults to 9998-9999, with session affinity.

Confirm that the client gateway is reachable from the application network. On OpenShift Local, run client applications inside the cluster and continue to the Route procedure in Step 4.

Step 4: Access NCache Management Center

Access Through a Route

On OpenShift Local or single-node OKD without a load balancer, the gateway external addresses can remain <pending>. Create a Route to the Management Center after its Service exists.

oc expose service ncache-mgmt-gateway --port=9801 --name=ncache-mgmt -n ncache
oc get route ncache-mgmt -n ncache

Open http://<route-host> using the hostname in the HOST/PORT column. On OpenShift Local, this is typically http://ncache-mgmt-ncache.apps-crc.testing. If the Route already exists, use the second command to retrieve its hostname. Run cache client applications inside the local cluster, since this HTTP Route exposes Management Center web access only.

Access Through a Load Balancer

For access through a public load balancer, configure gateway.mgmtCenterEndpoint. This value can be supplied during helm install or added afterward using helm upgrade.

If you have already installed NCache, use the following command. Replace <management-public-ip> with a public IPv4 address available through your cluster's load balancer infrastructure:

helm upgrade ncache oci://registry-1.docker.io/alachisoft/ncache-helm --version 5.3.8 --namespace ncache --reuse-values --set-string gateway.mgmtCenterEndpoint="<management-public-ip>"

Check the management gateway Service and confirm that its external endpoint has been assigned:

kubectl get svc --namespace ncache

Use the configured endpoint to open NCache Management Center at http://<management-public-ip>:9801 or, when HTTPS is configured, https://<management-public-ip>:9802.

After verifying the deployed caches in NCache Management Center, follow Getting Started to begin using NCache. Applications outside Kubernetes can connect through the client gateway using ConnectionOptions, as described in Configure the External Client. Verify the client connection by adding an item to the cache and retrieving it. For subsequent licensing changes, cache configuration updates, and image upgrades, see Manage Deployment.

Deploy Using YAML Files

After confirming cluster access, prepare and apply the server and gateway manifests using the following steps.

Step 1: Prepare the Deployment Files

Obtain the OpenShift deployment files, ncache.yaml, client-gatewayservice.yaml, and mgmt-gatewayservice.yaml, from the NCache Kubernetes repository. Run the YAML deployment commands from the directory containing these three files.

  • Use the ncache namespace for these manifests. Check that namespaced resources and the ncache-sa subject in the ClusterRoleBinding refer to ncache. If adapting older files that specify default, update those namespace values before applying them.
  • In the NCache container's environment variables, set NC_KEY to your deployment key:
- name: NC_KEY
  value: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  • Ensure that the StatefulSet's spec.serviceName is ncache-cacheserver, matching the headless Service in the same file. Update the existing field if necessary, retaining the other settings:
spec:
  serviceName: ncache-cacheserver
  • Set the NCache container image to alachisoft/ncache:5.3.801 and verify that it is accessible. If it requires registry credentials, create the ncache-secret image pull Secret in the ncache namespace; otherwise, remove the imagePullSecrets entry.
  • Keep replicas: 2 for the default two-server deployment and NC_START_DEFAULT_CACHE set to "true". The supplied OpenShift YAML uses preferred pod anti-affinity, allowing both pods to run on a single-node OKD cluster. For separate-node placement on a multi-node cluster, enable the supplied required anti-affinity block and disable the preferred block before applying the manifest.
  • If TLS is required, prepare the Secret and environment variables before applying the files, as described in Deploy Using YAML Files. Create the Secret in ncache and use --namespace ncache for the verification commands when following that procedure for OpenShift.

Retain the Service selectors and pod labels so that the gateways continue to route traffic to the NCache servers.

Prepare copies of client-gatewayservice.yaml and mgmt-gatewayservice.yaml for the load balancer used by your OpenShift cluster. On bare-metal clusters using MetalLB, retain the shared-IP annotations and configure a suitable address pool. For another load balancer, remove the MetalLB annotations and configure the provider's Service settings.

Retain type: LoadBalancer, the Service names, selectors, ports, and management session affinity. Set spec.loadBalancerIP in the management file only when requesting an address supported by that load balancer; otherwise, remove the empty field and allow address allocation.

The project and anyuid grant must be prepared as described under Deployment Process before applying these files.

Step 2: Deploy NCache

Apply the server manifest and both gateway manifests from the directory containing the prepared files:

kubectl apply --namespace ncache -f ncache.yaml
kubectl apply --namespace ncache -f client-gatewayservice.yaml
kubectl apply --namespace ncache -f mgmt-gatewayservice.yaml

Verify the Server Pods

Check that both server pods have started and inspect their worker-node placement:

kubectl rollout status statefulset/ncache --namespace ncache
kubectl get pods --namespace ncache -l app=ncache -o wide

The default deployment creates ncache-0 and ncache-1. If a pod fails to start, inspect its events and logs, and check the deployment key, image access, and any certificate settings:

kubectl describe pod "<pod-name>" --namespace ncache
kubectl logs "<pod-name>" --namespace ncache

Check the security context assigned to each NCache server pod and verify its runtime user. Replace <pod-name> with each server pod name in turn.

oc get pod "<pod-name>" -n ncache -o 'jsonpath={.metadata.annotations.openshift\.io/scc}'
oc exec "<pod-name>" -n ncache -- id

For this deployment, the applied constraint should be anyuid and the runtime user should be 1655 (ncache). If the pod is rejected or cannot start, inspect its events and confirm the service account, namespace, and permission grant before checking cache status.

Pod status does not confirm that the caches are ready. Verify cache status in NCache Management Center after opening the management endpoint in Step 4.

Step 3: Verify NCache Services

Check that the headless Service and both gateway Services exist:

kubectl get svc ncache-cacheserver ncache-client-gateway ncache-mgmt-gateway --namespace ncache

For clusters with load balancer support, wait until the gateway endpoints have been assigned, and confirm that they are reachable from the application and administrator networks. The client gateway exposes port 9800. The management gateway exposes ports 9801 and 9802 for Management Center and ports 9998 and 9999 for the portal.

The client gateway also exposes ports 9803-9997. Confirm that the load balancer and firewall configuration permit the ports required by your deployment.

Step 4: Access NCache Management Center

Access Through a Route

On OpenShift Local or single-node OKD without a load balancer, the gateway external addresses can remain <pending>. Create a Route to the Management Center after its Service exists.

oc expose service ncache-mgmt-gateway --port=9801 --name=ncache-mgmt -n ncache
oc get route ncache-mgmt -n ncache

Open http://<route-host> using the hostname in the HOST/PORT column. On OpenShift Local, this is typically http://ncache-mgmt-ncache.apps-crc.testing. If the Route already exists, use the second command to retrieve its hostname. Run cache client applications inside the local cluster, since this HTTP Route exposes Management Center web access only.

Access Through a Load Balancer

For access through a load balancer, use the management gateway's assigned external IP address or DNS hostname:

kubectl get svc ncache-mgmt-gateway --namespace ncache

Open http://<management-gateway-endpoint>:9801 or, when Management Center HTTPS is configured, https://<management-gateway-endpoint>:9802. The endpoint is the value reported in the Service's EXTERNAL-IP column.

In NCache Management Center, verify that the intended cache is running on both server nodes before using it. Follow Configure the External Client to connect an application through the client gateway using ConnectionOptions, then add an item to the cache and retrieve it to verify the connection. For licensing, cache changes, and subsequent updates, follow the YAML tabs in Manage Deployment.

See Also

Kubernetes Self-Deployment
Deploy TLS With NCache Kubernetes

Contact Us

PHONE

+1 214-619-2601   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Try NCache
Pricing
NCache Playground

Deployments
  • Cloud
  • Docker
  • Kubernetes
  • On-Premises
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • SignalR Backplane
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Blogs
  • Foundations
  • Videos
  • Comparisons
  • Shows
  • Whitepapers
  • Articles
  • Tech Talks
  • Magazine Articles
  • Third-Party Articles
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Docs
  • Schedule a Demo
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Terms of Use
  •  
  • Privacy Policy
  •  
  • Cookie Policy
© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.
  • Facebook
  • Twitter
  • Youtube
  • LinkedIn
  • RSS