And hence I changed this Python code to use Kube Service ENV variable with redis:alpine docker hub image.
from flask import Flask
from redis import Redis
import os
app = Flask(__name__)
redis = Redis(host=os.environ.get('DB_SERVICE_HOST', 'redis'), port=os.environ.get('DB_SERVICE_PORT', 'port'))
@app.route('/')
def hello():
redis.incr('hits')
return 'Hello Container World! I have been seen %s times.\n' % redis.get('hits')
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)
And everything worked. So, you may review this when you have some time to fix whichever janankiram/web accordingly.
Thanks in advance.