Create Cache Discovery Service in Openshift
For all the client applications to have access to the underlying pods, cache discovery service is created. It lets the applications communicate with the underlying pods. In order to create cache discovery service another YAML file is created with the configurations. A sample YAML file called discoveryservice.yaml is shown below.
kind: Service apiVersion: v1 # depends on underlying Kubernetes version metadata: name: cacheserver labels: app: cacheserver spec: clusterIP: None sessionAffinity: ClientIP 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-http port: 8251 targetPort: 8251 - name: management-bridge port: 8260 targetPort: 8260
Using Web Console
To create the cache discovery service through web portal:
- From the left panel, go to Services under the Networking section.
- Click on Create Service in order to create a new cache discovery service. Click Create.
- The cache discovery service is created successfully.
Using Command Line
In order to create the cache discovery service using the command line tool, run the following command:
oc create -f discoveryservice.yaml
In order to check if the service is created successfully run the following command:
oc get services
After creating the cache discovery service, the next step is to create management gateway, explained in the next chapter.