Exposing Redis Service
By default, the nature of Redis standalone/cluster setup is private and limited to the Kubernetes cluster only. But we do have a provision to expose it using the Kubernetes “Service” object. If we can expose the service by doing some configuration inside the helm values for redis standalone and cluster setup. This will create another service in parallel to the internal redis service to expose redis.
The service can be exposed with these service types:
- NodePort: Exposes the Service on each Node’s IP at a static port (the NodePort). A ClusterIP Service, to which the NodePort Service routes, is automatically created. You’ll be able to contact the NodePort Service, from outside the cluster, by requesting
: . - LoadBalancer: Exposes the Service externally using a cloud provider’s load balancer. NodePort and ClusterIP Services, to which the external load balancer routes, are automatically created.
Exposing Service
Customize or create the values file with the following content. The externalService configuration is a common method of exposing service for redis standalone and cluster setup:
Once the values file is customized or created we can apply or upgrade the redis setup. We need to pass the created file as an argument to the helm
command.
Once helm command is completed successfully, we can verify the external service by kubectl command. As we can see in the output, there is an IP in the “EXTERNAL-IP” coloumn.