• Products
  • Solutions
  • Customers
  • Resources
  • Company
  • Pricing
  • Download
Try Playground
  • Create NCache Client Deployment in AKS
Show / Hide Table of Contents
  • Deploying NCache in Azure Kubernetes Service
  • Create Azure Resource Group
  • Create Kubernetes Cluster in Azure
  • Deploy NCache Resources in AKS
    • Manually Deploy NCache in AKS
      • Create NCache Deployment in AKS
      • Create Discovery Service for NCache Clients in AKS
      • Create Gateway Service for NCache Management in AKS
    • Deploy NCache in AKS Through Operator
      • Create Service Account in AKS
      • Create Role Definition in AKS
      • Create Role Binding in AKS
      • Create NCache Operator in AKS
      • Create Custom Resource in AKS
  • Create NCache Client Deployment in AKS
  • Create Cache Cluster in AKS
  • Monitor NCache Cluster and Clients in AKS
  • Adding Cache Servers in AKS at Runtime
  • Removing Cache Severs in AKS at Runtime

Create Cache Client Deployment in Azure Kubernetes Service

To run the NCache client in your Azure Kubernetes Service cluster, you need to deploy your client application in the cluster. There are multiple ways of creating NCache client deployment and these vary depending upon your requirements.

Use NCache Client Dockerfile for Azure Kubernetes Service

You can create your NCache client dockerfile that contains the commands to create a container image using either runtime .NET/.NET SDK. This allows you to use both InProc and OutProc caches.

Follow the steps mentioned below to start creating your client dockerfile.

  • Access the dockerfile provided by Alachisoft.

  • Place the NCache installation setup in the Resources folder.

Note

In the case of .NET SDK, you need to change the base image tag as shown below and this will allow access to runtime and other packages like the PowerShell tool.

FROM mcr.microsoft.com/dotnet/core/sdk

Method 1

  • Add your client application to the Resources folder.
  • Go to startup.sh in the Resources folder.
  • Add the name of your client application in place of sleep infinity.
  • Save the startup.sh file.

Method 2

  • In the dockerfile, add the path to your client application under the COPY command and save the file.
COPY [application path]
  • Go to the startup.sh file, replace the sleep infinity tag with the path of your application and save the file.
Tip

You can simply add your client application path in the ENTRYPOINT section of the dockerfile and spare the need of using startup.sh altogether.

After you have finished editing the client dockerfile, go to your build environment and execute the following commands. These commands convert your client application's dockerfile into a container image and upload it to the container registry.

docker build . -t [image tag]
docker push [repository]:[image tag]
Note

You need to have docker installed on your machine to create your client docker image and you need to run this command from inside the directory containing your dockerfile.

.NET SDK to Access PowerShell

The plus point about using .NET SDK is that it comes packed with not only runtime but also PowerShell tool. Hence, in order to automate scripting, it is recommended to use .NET SDK environment.

Execute the following command on a shell platform to get access to the PowerShell tool inside your Azure Kubernetes Service cluster:

kubectl exec pod-name -- pwsh -NoExit

You can verify that you have entered PowerShell by the tag PS:>.

Now, you need to import the NCache PowerShell module to start using NCache specific PowerShell tools.

Note

To use the NCache PowerShell module, NCache must be installed on your machine.

Import-Module /opt/ncache/bin/tools/ncacheps

This will allow you to execute PowerShell commands on any of the pods present inside the Kubernetes cluster. From here on, you can start, stop, add, and remove nodes all while staying inside the Azure Kubernetes Service cluster.

Embed NCache Client Libraries in the Application

In case you do not have NCache installed on the machine that is running your client application, then you can use NuGet packages to deploy NCache clients in your Kubernetes cluster. This only allows access to InProc caches.

Install NuGet packages provided by Alachisoft in your client application to use NCache without running NCache as a client.

  • You will find the required NuGet packages at NCache NuGet Packages

  • To install these packages in your client application, follow the steps mentioned in Install NuGet in Microsoft Visual Studio.

Once the packages have been successfully installed, create a docker image of your client application.

Create Client Deployment YAML file

Here, you need to create another YAML file for deploying the client in your Azure Kubernetes Service cluster. Let's call this file client.yaml.

Note

The parameters required to create this YAML file ready to be deployed are mentioned in the Properties table.

kind: Deployment
apiVersion: apps/v1beta1    # it depends on the underlying Azure Kubernetes Service version
metadata:
  name: client
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: client
    spec:
      imagePullSecrets:
      - name: client-private
      nodeSelector:
        "beta.kubernetes.io/os": linux
      containers:
      - name: client
        image: # Your docker client image here
        ports:
        - name: port1
          containerPort: 8250
        - name: port2
          containerPort: 8251
        - name: port3
          containerPort: 9800

To deploy this file as a pod in the Kubernetes cluster, execute the following command in the Azure Kubernetes Service Cloud Shell:

kubectl create -f [dir]/client.yaml

The next step is to create an NCache cache cluster, explained in the next chapter.

See Also

Create Discovery Service in AKS
Create Cache Cluster in AKS
Monitor NCache Cluster and Clients in AKS
Adding Cache Servers in AKS at Runtime

In This Article
  • Use NCache Client Dockerfile for Azure Kubernetes Service
    • Method 1
    • Method 2
  • Embed NCache Client Libraries in the Application
  • Create Client Deployment YAML file
  • See Also

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

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

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top