Kubernetes and Docker Deployment

NCache fully supports various flavors of Kubernetes including Azure Kubernetes Service (AKS), AWS Elastic Kubernetes Server (EKS), Google Kubernetes Engine (GKE), Red Hat OpenShift Kubernetes, and more. NCache also fully supports Docker.

Azure Kubernetes Service
Elastic Kubernetes Service
Red Hat OpenShift
Google Kubernetes Engine

Deploy NCache in a Kubernetes Cluster

You can deploy NCache inside a Kubernetes cluster and access this NCache deployment both from applications running inside Kubernetes and also from outside. You can also manage and monitor these NCache clusters running Kubernetes from outside Kubernetes. The following diagram shows the deployment of NCache in a Kubernetes Cluster. This picture is the same on Azure Kubernetes Service, Amazon Elastic Kubernetes Service, Google Kubernetes Engine (GKE), Red Hat OpenShift Kubernetes, and any other Kubernetes environment.

NCache Kubernetes Cluster Concepts

Below are some of the concepts to understand in the above deployment of NCache in Kubernetes.

  1. NCache Discovery Service: This is a headless service that lets applications running inside the Kubernetes cluster access NCache server Pods by using its DNS name. NCache server Pods don’t have a fixed ip-address as it is assigned every time a Pod is started or restarted. That is why the Discovery Service plays a critical role in helping clients talk to NCache server Pods.
  2. NCache Management / Monitoring Gateway: A Gateway Service is required to manage and monitor NCache that is running inside the Kubernetes cluster from outside. All the management/monitoring operations are routed through this gateway to NCache server pods. The gateway can be configured to always send the traffic to a specific NCache server Pod so NCache Management Center can connect to it from outside.
  3. NCache Kubernetes Operator (coming): NCache provides an operator that handles license activation and deactivation of all the pods inside an NCache deployment. The operator is aware of NCache deployment and activates a specific number of NCache server-only licenses ahead of time so it can utilize them as NCache server Pods are started or restarted.

Kubernetes Flavors Supported

  1. Azure Kubernetes Service (AKS): NCache supports AKS deployments.
    - Get YAML
    - AKS Video
    - AKS Docs
  2. AWS Elastic Kubernetes Service (EKS): NCache supports EKS deployments.
    - Get YAML
    - EKS Video
    - EKS Docs
  3. Red Hat OpenShift Kubernetes: NCache supports OpenShift deployments.
    - Get YAML
    - OpenShift Video
    - OpenShift Docs
  4. Google Kubernetes Engine (GKE): NCache supports GKE deployments.
    - Get YAML
    - GKE Video
    - GKE Docs

Docker Support

NCache fully supports Docker in the following ways.

1. Docker Images on Docker Hub

  • - NCache Enterprise
    • .NET Edition
    • docker pull alachisoft/ncache:latest
    • OS: Linux (Debian), Windows Server Core 2019
    • Java Edition
    • docker pull alachisoft/ncache:latest-java
    • OS: Linux (Ubuntu), Windows Server Core 2019
  • - NCache Professional
    • docker pull alachisoft/ncache:latest-professional
    • OS: Linux (Debian), Windows Server Core 2019
  • - NCache Open Source
    • docker pull alachisoft/ncache:opensource-server-5.0.4

2. Docker File for Custom Docker Images

In most situations, you are fine just using the standard Docker Image of NCache from Docker Hub. But, in some cases, you may want to create a custom Docker Image that includes your own software or other variations of even standard OS software.

One example of this is the flavor of Linux. NCache Docker Image on Docker Hub uses Debian Linux but you may want another flavor of Linux for your NCache servers; NCache works fine on multiple flavors of Linux. Or, you may want to create a custom Docker Image for your application server (NCache Client) that contains not only your own application but also NCache client software.

In all such cases, Alachisoft provides you with various Dockerfiles which you can edit and customize to fit your needs.

Dockerfiles for NCache
Here are a few examples of these Dockerfiles that you can edit to create a custom Docker Image.

Dockerfiles Example
Here is how a typical Dockerfile "NCache Enterprise Server for Windows Server Core" looks like.

# Setting base image for NCache.
FROM microsoft/dotnet-framework:4.7.2-runtime

# Setting work directory to copy setups and resources for configuring NCache.

# Make sure that the 2 folders ("resources" and "setup") exist in the same directory as the Dockerfile.
# Make sure that "IPBinding.ps1" script resides in the "resources" folder.
# Make sure that Microsoft Visual C++ 2010 x64 Redistributable setup is placed in the "setup" folder. It can be downloaded from https://www.microsoft.com/en-us/download/details.aspx?id=14632.
# Make sure that NCache setup resides in the "setup" folder. It can be downloaded from http://www.alachisoft.com/download-ncache.html.
# Copying resources and setups into the work directory of the container.
COPY resources .
COPY setup .

# Exposing ports used by NCache for communication.
# Exposing the port at which NCache service will listen for incoming client connection requests.
# Exposing the port at which NCache service will listen for incoming management connection requests (NCache Manager, Monitor and Tools).
# Exposing the port at which Bridge service will listen for incoming connection requests from cache processes.
# Exposing the port at which Bridge service will listen for incoming Management connection requests (NCache Manager and Tools).

# Installing Microsoft Visual C++ 2010 x64 Redistributable (Prerequisite of NCache).
RUN vcredist_x64.exe /norestart /q

# Installing NCache setup.
# The parameter "INSTALLMODE" represents the NCache installation mode and has the following values:
# Rename this parameter to "EDITION" if you are building image for NCache version 4.8 or older.
#		Enterprise Server Install mode = "0"
#		Enterprise Remote Client Install mode = "3"
# The parameter "KEY" is the install key and is sent to user through e-mail once they download NCache setup. In case if user does not get a key, contact us at http://www.alachisoft.com/company/contact-us.html.
# The parameter "USERFIRSTNAME" represents the first name of the user.
# The parameter "USERLASTNAME" represents the last name of the user.
# The parameter "COMPANYNAME" represents the company the user works for.
# The parameter "EMAILADDRESS" represents the e-mail address of the user.
# The parameter "INSTALLDIR" represents the installation directory where NCache will be installed.
# the parameter "/qn" specifies that NCache will be installed silently without user interaction and will not prompt the user for anything.
RUN msiexec /i ncache.ent.x64.msi INSTALLMODE="0" KEY="XXXXXXXXXX" USERFIRSTNAME="John" USERLASTNAME="Smith" COMPANYNAME="Alachisoft" EMAILADDRESS="john@alachisoft.com" INSTALLDIR="C:\Program Files\NCache" /qn

# Currently, the IP during NCache installation is stored in the configuration files and it can not be made static at that point.
# However, the IP can be made static once the container is started.
# An IP Binding change task is scheduled to run when the container instance is started. This task replaces the IP with the actual IP assigned to the container.
# Creating one time executing IP Binding task that will change the IP in NCache Configuration files on the first time the container is started.
RUN schtasks /Create /TN IPBinding /SC ONSTART /TR "c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe C:\app\IPBinding.ps1" /ru SYSTEM

# Entry point for the container, once all the required configurations have been made.
CMD start -Verbose

What to Do Next?

© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.