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

Deploy TLS With NCache Kubernetes

NCache supports TLS encryption for communication between client applications and cache servers in Kubernetes. Configure TLS using the Helm settings or the environment variables and certificate Secret for a YAML deployment. Mutual TLS is available when client certificate authentication is required.

This page explains how to prepare certificates, configure TLS for the selected deployment method, and verify secure client connections. To change TLS settings on an existing deployment, follow Update TLS Settings.

Prerequisites

Before enabling TLS, make sure that:

  • You have a Kubernetes cluster ready for an NCache Enterprise deployment or an existing Enterprise deployment to update.
  • kubectl is configured to access the cluster. Helm 3.14 or later is also installed and configured when using the Helm procedure.
  • You have selected the deployment method and platform, and have a deployment key for a new installation. The examples use the ncache namespace for Helm and default for YAML. OpenShift YAML deployments use ncache; use that namespace for Secret creation and all verification commands.
  • You have inspected the TLS settings for the selected deployment method.
  • If using custom certificates, you have the server certificate and any required trust chain and credentials in PEM format.
  • You have the certificates required by the selected procedure and create any required Secret in the deployment namespace before enabling TLS.
  • The NCache container image is accessible from the Kubernetes cluster.

Deploy Using Helm

For OpenShift, use oci://registry-1.docker.io/alachisoft/ncache-helm --version 5.3.8 in the Helm commands below, as specified in OpenShift Deployment. This public chart supports the certificate and CA values described here.

Step 1: Create TLS Secret

For TLS without mutual authentication, use the NCache-provided certificate or supply a custom server PEM bundle through tls.customCertificate, as shown in Step 5. The custom bundle must contain the private key, server certificate, intermediate certificates, and issuing CA certificate, in that order. No manually created certificate Secret is required for these configurations. When a custom certificate is supplied, the chart creates the Secret automatically.

For mutual TLS, you can supply certificates and passwords directly through Helm values as shown in Step 5, or use an existing Secret. For the Secret procedure, prepare a server PEM bundle containing its private key, certificate, and certificate chain, and a client PEM bundle containing its certificate and private key. For certificates signed by your own CA, also provide the issuing CA certificate as a separate file. Create a Secret in the deployment namespace before enabling mutual TLS:

kubectl create namespace ncache
kubectl create secret generic ncache-tls-secret --namespace ncache --from-file=server-certificate=server.pem --from-file=client-certificate=client.pem --from-file=issuer=ca.crt --from-literal=server-certificate-password='server certificate password' --from-literal=client-certificate-password='client certificate password'

Replace server.pem, client.pem, and ca.crt with your certificate file paths. If the namespace already exists, only the Secret creation command is required. This example uses the supported legacy issuer entry for the CA certificate. The direct Helm values in Step 5 allow separate server and client CA files.

Replace server certificate password and client certificate password with the passwords for the respective private keys. Omit the corresponding --from-literal argument if a private key is not encrypted. An encrypted server private key must use PKCS#8 format, identified by BEGIN ENCRYPTED PRIVATE KEY.

For the existing-Secret procedure, use tls.secretName to identify this Secret. Existing certificate-password entries and the legacy issuer entry remain supported.

Step 2: Mount TLS Secret in NCache Pods

The chart mounts the certificate Secret automatically. When using an existing Secret for mutual TLS, set tls.secretName to its name; the default is ncache-tls-secret.

For mutual TLS, the chart automatically supplies the client certificate and its password, when required, to the NCache commands it runs. The chart obtains these credentials from its certificate Secret, including when the certificates are supplied through Helm values, so no additional NCache command parameters are required. This also applies when mutual TLS was enabled outside Helm, such as through NCache Management Center, provided that the required certificate Secret is available. Client applications still require the certificate configuration described in Step 4.

Inspect the chart defaults using:

helm show values oci://registry-1.docker.io/ncachedev/ncachetest --version 5.3.801

Step 3: Configure TLS Settings

For standard TLS with the NCache-provided certificate, install NCache using the following command. If you require a custom server certificate or mutual TLS, review the settings below and use the corresponding command in Step 5 instead:

helm install ncache oci://registry-1.docker.io/ncachedev/ncachetest --version 5.3.801 --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="<platform>" --set tls.enabled=true --set tls.mutualEnabled=false --set tls.protocolVersion=tls12

Replace the deployment-key placeholder with your key and <platform> with on-prem, AKS, EKS, GKE, or OpenShift. Include any additional values required by your platform deployment guide.

The command enables standard TLS with TLS 1.2 without a separate values file. After installation, configure the client in Step 4, then verify the deployment in Steps 6 and 7.

The following table describes the available TLS settings and their defaults:

Helm Value Default Description
tls.enabled false Enables TLS. Without mutual authentication, NCache uses its own certificate unless a custom server certificate is supplied.
tls.mutualEnabled false Enables mutual TLS; requires tls.enabled=true and server and client certificates supplied through Helm values or an existing Secret.
tls.customCertificate Empty Custom server PEM bundle for standard or mutual TLS, supplied with --set-file.
tls.customCertificatePassword Empty Password for the encrypted private key in tls.customCertificate, when applicable.
tls.customCaCertificate Empty Server CA certificate supplied with --set-file.
tls.customClientCertificate Empty Client PEM bundle for mutual TLS supplied with --set-file.
tls.customClientCertificatePassword Empty Password for the client private key when encrypted.
tls.customClientCaCertificate Empty Client CA certificate for mutual TLS supplied with --set-file.
tls.secretName ncache-tls-secret Existing Secret containing the mutual TLS certificates and any required private-key passwords.
tls.protocolVersion tls12 Specifies the protocol version for standard and mutual TLS. Accepted values are tls12, tls13, and auto. Unsupported values are rejected during installation and upgrade.

TLS settings can also be changed through helm upgrade. Follow Update TLS Settings to apply changes to an existing deployment.

Step 4: Configure TLS for Client Deployment

Configure the client application to use TLS consistently with the NCache servers and to trust the server certificate. For mutual TLS in a .NET application, supply the client certificate credentials through ConnectionOptions when calling CacheManager.GetCache.

For mutual TLS, specify the client certificate path through TLSCertPath, using PEM format or, for .NET Framework applications, PFX format. If the certificate's private key is encrypted, provide its password through TLSCertPassword using your application's secure configuration.

Deploy the out-of-process Client Cache using the separate ncache-client-outproc.yaml manifest, as described in Deploy an Out-of-Process Client Cache with Kubernetes. If standard or mutual TLS is enabled on the cache servers, apply the corresponding TLS settings to the out-of-process Client Cache as well. The server deployment does not configure TLS for these separate client containers.

Step 5: Install NCache with TLS

Use this step only when installing with a custom server certificate or mutual TLS. Run one of the following commands for the required configuration. Replace the deployment-key placeholder and <platform> as described in Step 3, and include any additional values required by your platform deployment guide. If you installed with the NCache-provided certificate in Step 3, continue with Step 6.

To use a custom server certificate without mutual authentication, supply the server PEM bundle through tls.customCertificate:

helm install ncache oci://registry-1.docker.io/ncachedev/ncachetest --version 5.3.801 --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="<platform>" --set tls.enabled=true --set tls.mutualEnabled=false --set-file tls.customCertificate=server.pem --set-file tls.customCaCertificate=server-ca.crt

Replace server.pem with your server PEM bundle and server-ca.crt with the server CA certificate file. If its private key is encrypted, add --set-string tls.customCertificatePassword="<server-certificate-password>" to the command and replace the password placeholder with the private-key password.

To install NCache with mutual TLS using an existing Secret, use the Secret from Step 1. Replace ncache-tls-secret if you created it with a different name:

helm install ncache oci://registry-1.docker.io/ncachedev/ncachetest --version 5.3.801 --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="<platform>" --set tls.enabled=true --set tls.mutualEnabled=true --set-string tls.secretName="ncache-tls-secret"

To supply the mutual TLS certificates directly through Helm values, use the following installation command and replace each file path with your certificate file.

helm install ncache oci://registry-1.docker.io/ncachedev/ncachetest --version 5.3.801 --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="<platform>" --set tls.enabled=true --set tls.mutualEnabled=true --set-file tls.customCertificate=server.pem --set-file tls.customClientCertificate=client.pem --set-file tls.customCaCertificate=server-ca.crt --set-file tls.customClientCaCertificate=client-ca.crt

If a private key is encrypted, also supply --set-string tls.customCertificatePassword="<server-certificate-password>" or --set-string tls.customClientCertificatePassword="<client-certificate-password>", as applicable.

The updated on-premises deployment script accepts the same Helm options after the platform argument. For example, run the following in Bash, replacing on-prem with aks, eks, or gke for the corresponding script-supported platform.

export CHART_VERSION="5.3.801"
export NCACHE_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
bash deploy-ncache.sh on-prem --namespace ncache --create-namespace --set tls.enabled=true --set tls.mutualEnabled=true --set-file tls.customCertificate=server.pem --set-file tls.customClientCertificate=client.pem --set-file tls.customCaCertificate=/path/server-ca.crt --set-file tls.customClientCaCertificate=/path/client-ca.crt

For standard TLS with a custom certificate, supply tls.customCertificate and tls.customCaCertificate and retain tls.mutualEnabled=false. Run one installation command for your selected configuration, then continue with Step 6.

The protocol version defaults to tls12. To use TLS 1.3, add --set tls.protocolVersion=tls13 to the selected installation command before running it.

Apply client-side configuration through the client application's own deployment process.

Step 6: Verify the Server Pods and Caches

The chart applies TLS as part of installation; a separate manual service restart is not required for this procedure. Check that the NCache server pods are ready and investigate failed configuration jobs:

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

Follow Verify an Update to confirm the configuration job completed, then verify that the configured caches are running in NCache Management Center before testing client connectivity.

Step 7: Verify TLS Deployment

Connect to a deployed cache from a client configured for TLS, then add an item and retrieve it to verify the connection. For mutual TLS, also verify that the configured client certificate is accepted. Use the NCache Management Center to inspect cache status and logs for connection or certificate errors.

If further diagnosis is needed, inspect the pod logs using the actual pod name:

kubectl logs "<pod-name>" -n ncache

Important Considerations

  • TLS and mutual TLS are disabled by default.
  • For TLS without mutual authentication, NCache uses its own certificate unless a custom server PEM bundle is supplied through tls.customCertificate.
  • Mutual TLS accepts server and client certificates and their passwords through Helm values or an existing Secret. Supply the server and client CA certificates for their respective trust chains. The legacy issuer configuration remains supported.
  • The chart automatically supplies certificate credentials to the NCache commands it runs. Client applications require their own certificate configuration.
  • tls.protocolVersion defaults to tls12 and accepts tls12, tls13, or auto.
  • TLS settings can be changed through helm upgrade. Applying TLS changes can restart caches, so plan for an interruption to client operations.
  • Client applications must use TLS settings consistent with the server deployment.
  • This chart workflow is single-site only and does not define bridge TLS settings.

Troubleshooting

Pod Fails During Startup

Incorrect certificate inputs or inaccessible certificate resources can prevent startup.

Workaround: Check the chart's certificate requirements and inspect the pod events using the actual pod name.

kubectl describe pod "<pod-name>" -n ncache

Certificate is Not Found

A custom certificate may be unavailable if its value does not use the chart's accepted input format or references an unavailable resource.

Workaround: For TLS without mutual authentication, verify the PEM bundle supplied through tls.customCertificate. For mutual TLS using an existing Secret, confirm that the Secret identified by tls.secretName exists in the deployment namespace and contains server-certificate, client-certificate, and the corresponding password entries for encrypted private keys.

Client Cannot Connect to Cache

Client applications may fail to connect when client and server TLS settings, certificate trust, or mutual TLS credentials are inconsistent.

Workaround: Verify the client TLS configuration, trust chain, and certificate validity. For mutual TLS, verify that both server and client certificates have been supplied correctly. If the certificates are signed by your own CA, confirm that the appropriate server and client CA certificates are supplied. Existing configurations can continue to use the legacy issuer entry.

Management Center is Not Accessible

The NCache Management Center may be unavailable if the gateway endpoint is unreachable or the NCache pods are not ready.

Workaround: Check the gateway services and pods. Use the Management Center endpoint and port documented for the installed chart. Management Center uses HTTP 9801 and HTTPS 9802; the portal uses HTTPS 9998 and HTTP 9999. HTTPS load balancers forward to HTTP 9801 for Management Center and HTTP 9999 for the portal, with sticky sessions. See Firewalls and Ports.

kubectl get svc -n ncache
kubectl get pods -n ncache

Deploy Using YAML Files

For an Enterprise YAML deployment, prepare the certificate Secret in the deployment namespace (ncache for OpenShift and default for the on-premises examples) and configure the NCache container's TLS environment variables before applying ncache.yaml. Use this procedure with the platform deployment guide.

Step 1: Prepare the Certificate Secret

Prepare a server PEM bundle containing the private key, server certificate, intermediate certificates, and issuing CA certificate, in that order. For mutual TLS, also prepare a client PEM bundle containing its private key, certificate, and any intermediate certificates. Prepare separate server and client CA files for the Secret entries shown below. For standard TLS, omit the client certificate, client CA, and client password arguments.

Create the Secret using the entry names referenced by the supplied manifest:

kubectl create secret generic ncache-tls-secret --namespace default --from-file=server-certificate=server.pem --from-file=client-certificate=client.pem --from-file=server-ca-certificate=server-ca.crt --from-file=client-ca-certificate=client-ca.crt --from-literal=server-certificate-password='server certificate password' --from-literal=client-certificate-password='client certificate password'

Replace the sample file paths with your certificate files and replace server certificate password and client certificate password with the passwords for the respective private keys. Omit the corresponding --from-literal argument if a private key is not encrypted.

Step 2: Configure the Server Manifest

In ncache.yaml, set NC_ENABLE_TLS to "true". For standard TLS, retain NC_MUTUAL_TLS as "false":

- name: NC_ENABLE_TLS
  value: "true"
- name: NC_MUTUAL_TLS
  value: "false"

For mutual TLS, set both values to "true":

- name: NC_ENABLE_TLS
  value: "true"
- name: NC_MUTUAL_TLS
  value: "true"

Update the existing entries rather than adding duplicate environment variables. Retain the Secret volume and its mount. Set the following path values to the files mounted inside the container; the updated on-premises manifest leaves these path values empty, while the OpenShift manifest already sets the server and client certificate paths. Add the separate CA path entries when supplying those files:

  • NC_TLS_CUSTOM_CERTIFICATE points to /usr/local/share/ca-certificates/server-certificate.
  • NC_TLS_CUSTOM_CA_CERTIFICATE points to /usr/local/share/ca-certificates/server-ca-certificate.
  • NC_TLS_CLIENT_CA_CERTIFICATE points to /usr/local/share/ca-certificates/client-ca-certificate for mutual TLS.
  • NC_TLS_CLIENT_CERTIFICATE points to /usr/local/share/ca-certificates/client-certificate.
  • NC_TLS_CUSTOM_PASSWORD reads server-certificate-password from ncache-tls-secret.
  • NC_TLS_CLIENT_PASSWORD reads client-certificate-password from the same Secret.

For mutual TLS with the Secret entry names from Step 1, set the four certificate path entries as follows. These are paths inside the NCache containers. The --from-file arguments in Step 1 use paths on the machine running kubectl.

- name: NC_TLS_CUSTOM_CERTIFICATE
  value: "/usr/local/share/ca-certificates/server-certificate"
- name: NC_TLS_CUSTOM_CA_CERTIFICATE
  value: "/usr/local/share/ca-certificates/server-ca-certificate"
- name: NC_TLS_CLIENT_CERTIFICATE
  value: "/usr/local/share/ca-certificates/client-certificate"
- name: NC_TLS_CLIENT_CA_CERTIFICATE
  value: "/usr/local/share/ca-certificates/client-ca-certificate"

For standard TLS with a custom server certificate, configure the server certificate and server CA paths and leave the client certificate and client CA paths empty. For mutual TLS, also configure the client certificate and client CA paths. Use the Secret entry names shown in Step 1 so that the mounted filenames match these paths. Existing password entries and the legacy issuer configuration remain supported.

Step 3: Apply and Verify the Deployment

For a new deployment, apply the prepared server manifest and the platform's gateway files as described in its deployment guide. To update existing servers, follow the YAML procedure in Update TLS Settings, including the controlled pod replacements.

Check the server pods and gateway Services:

kubectl get pods --namespace default -l app=ncache -o wide
kubectl get svc --namespace default

Verify that all intended caches are running in NCache Management Center. If a pod fails to start, inspect its events and logs:

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

Step 4: Configure and Verify Clients

Configure the client application to trust the server certificate. For mutual TLS, supply the client certificate through ConnectionOptions, following Configure TLS for Client Deployment.

If an out-of-process Client Cache is used, apply the corresponding standard or mutual TLS settings to that separate client deployment as well. The server manifest does not configure its TLS settings.

Connect to the intended cache, add an item, and retrieve it. For mutual TLS, confirm that the configured client certificate is accepted. Investigate certificate and connection errors before allowing application traffic.

See Also

Evaluation Period Management
License Management
Network Installation with PowerShell

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