Create Deployment in Azure AKS
NCache can be incorporated with the Azure AKS cluster as a deployment pod. Once deployed, you can perform all managerial operations on your cache cluster inside your Azure AKS cluster. Here's how you can create an NCache deployment pod.
Create NCache Deployment YAML File using Azure AKS
Once the provided credentials have been saved locally (shown in the previous chapter), you need to deploy NCache. For this purpose, you need to create a YAML file, let's call it ncache.yaml. This file contains the information required to deploy NCache.
Your ncache.yaml should look somewhat like this:
Note
The parameters required to create this YAML file ready to be deployed are mentioned in the Properties table.
kind: Deployment
apiVersion: apps/v1 # it depends on the underlying Azure AKS version
metadata:
name: ncache
labels:
app: ncache
spec:
replicas: 2
selector:
matchLabels:
app: ncache
template:
metadata:
labels:
app: ncache
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: ncache
image: docker.io/alachisoft/ncache:enterprise-server-linux-5.0.2
resources:
limits:
memory: "200Mi"
cpu: "2"
requests:
memory: "100Mi"
cpu: "1"
ports:
- name: management-tcp # for tcp communication
containerPort: 8250
- name: management-http # for http communication
containerPort: 8251
- name: client-port # for client communication
containerPort: 9800
- name: management-bridge # for bridge communication
containerPort: 8260
Creating NCache Deployment
After ncache.yaml has been created, run the following command in Shell. This command fetches the deployment file and creates a pod.
kubectl create -f [dir]/ncache.yaml
Properties
Following are the properties of the parameters specific to Kubernetes. The required parameters to create the YAML file are explained below:
Parameters | Description |
---|---|
kind |
This can be many different types like a Deployment, a Service, a DaemonSet or a StatefulSet. |
apiVersion |
Specifies the version of the deployed kind and it depends on the underlying version of Kubernetes. |
metadata |
Specifies details of the deployment. |
name |
Specifies the name of your deployment. |
labels |
Specifies key-value pair of resources that are used for identification purposes inside the Kubernetes cluster. |
spec |
Specifies logical details of the deployment. |
imagePullSecrets |
Specifies the private registry from where the image needs to be pulled. |
replicas |
Specifies the number of replica pods to be created at the time of deployment. |
template |
Specifies the information required for pulling images and creating port connections. |
nodeSelector |
Specifies the node on which the underlying container needs to be hosted. |
clusterIP |
Specifies the cluster IP required for external communication. Setting its value as None means that the service will not be accessible outside the cluster. |
selector |
Specifies the parameters that define the selection criteria of the services. |
type |
Specifies the type of the service to be created. |
sessionAffinity |
Specifies the parameter that decides the persistence of a session. |
containers |
Specifies parameters required for initializing images and ports. |
image |
Specifies the path of the image that needs to be pulled. |
resources |
Specifies CPU or memory allocation for a container. |
limits |
Specifies CPU or memory limit. |
requests |
Specifies CPU or memory request for a container. |
ports |
Specifies the name and port number of the port required for communication. There can be one or multiple ports depending on your deployment. |
containerPort |
Specifies the port number of the deployment ports. |
port |
Specifies a port number. |
targetPort |
Specifies the port that needs to be targeted against the provided port number. |
After creating NCache deployment, the next step is to create a discovery service for NCache clients, as explained in the next chapter.
See Also
Create Kubernetes Cluster in Azure
Create Discovery Service in AKS
Create Gateway Service in AKS
Create NCache Client Deployment in AKS