Create Discovery Service for NCache Clients
The purpose of a discovery service is to give client application access to the pods running the cache service inside the Azure Kubernetes cluster.
Create Discovery Service YAML File
Create a YAML file for headless discovery service. Let's call this file discoveryservice.yaml and this is what it should look like:
The parameters required to create this YAML file ready to be deployed are mentioned in the Properties table.
kind: Service apiVersion: v1 # underlying Kubernetes version metadata: name: cacheserver labels: app: cacheserver spec: clusterIP: None selector: app: ncache # same label as provided in the ncache YAML file ports: - name: management-tcp port: 8250 targetPort: 8250 - name: client-port port: 9800 targetPort: 9800 - name: management-bridge port: 8260 targetPort: 8260
clusterIP tag equals none, meaning that this service will not have any public IP assigned to it. This is what makes this service a headless service.
Create Discovery Service
- Run the following command to create a discovery service that the AKS cluster uses for external communication with NCache clients.
kubectl create -f [dir]/discoveryservice.yaml
- After all required services have been deployed, you can check whether the created pods are live or not by running the following command in Azure Cloud Shell:
kubectl get pods -o wide
- To get a list of all deployed services, run the following command:
kubectl get service
After successful creation of cache discovery service, the next step is to create NCache client deployment, explained in the next chapter.