I have all my JSON files located in Redis cache.
I want to get it served through Nginx.
# redis-cli -h redis-master
redis-master:6379> get "zips/80202.json"
"{"zipCode":"80202","City":"DENVER","StateCode":"CO"}"
I would like to request the url to be like,
http://nginx-host/zips/80202.json
where nginx-host
and redis-master
are the services in Kubernetes.
expecting response with,
{"zipCode":"80202","City":"DENVER","StateCode":"CO"}
I am not finding a clear idea on how to configure Nginx. I am running with Kubernetes containers, so services are local with no authentication required to the Redis servers.
2
Answers
Here is the nginx configuration used to serve with redis key,
To serve redis data (key:value) pairs via Nginx, you will need the following:
https://github.com/NodeRedis/node-redis. This client will help
retrieve data from redis. You will have to NodeJs Express to give you the API layer
via the ingress controller (if you want to access it from outside
your K8s cluster