Create Discovery Service for NCache Clients in EKS
Outside a Kubernetes cluster, all connections and communications are static IP based. But inside the cluster, every deployment pod is assigned a dynamic IP address at runtime that client applications are unaware of.
The purpose of a discovery service is to give these client applications access to the pods running the NCache service inside the Elastic Kubernetes cluster. These IP addresses in turn, are used by the client applications to create the cache handles and start performing cache operations. So, before you deploy the actual client, you need to create this discovery service inside your EKS cluster.
Create Discovery Service YAML File
The first step into creating a headless discovery service for your EKS cluster is to create a YAML file. This file contains the required information a client application needs to connect to this service. Let's call this file cachediscovery.yaml and this is what it looks like:
The parameters required to create this YAML file ready to be deployed are explained in the Properties table.
kind: Service apiVersion: v1 # depends on underlying Kubernetes version metadata: name: cacheserver labels: app: cacheserver spec: clusterIP: None selector: app: ncache # same label as provided in the ncache deployment yaml ports: - name: management-tcp port: 8250 targetPort: 8250 - name: management-http port: 8251 targetPort: 8251 - name: client-port port: 9800 targetPort: 9800
clusterIP tag is set to none here which shows that this service will not have any public IP assigned to it. This factor is what makes this service a headless service.
Create Discovery Service inside Cluster
After creating the YAML file, you need to deploy this resource inside your EKS cluster. Follow the steps mentioned below to set up this discovery service.
To create a fully-functional discovery service that the EKS cluster uses to communicate with NCache clients outside of the cache cluster, execute the following command in AWS command line interface.
kubectl create -f [dir]/cachediscovery.yaml
To get a list and status of all running services, execute the following command:
kubectl get service
After creating a headless discovery service for NCache clients, you need to create Access for NCache Management, explained in the next chapter.