'Redis sentinel can not run in k8s with environment variables in config file

I try to run a redis sentinel in k8s pod and it show:

        *** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 27
>>> 'sentinel monitor mymaster $REDIS_MASTER_IP 6379 2'
Can't resolve master instance hostname.

the line 27 of config file is:

sentinel monitor mymaster $REDIS_MASTER_IP 6379 2

The value of this variable is the svc name ('alink-redis') for this deployment.
When I use echo $REDIS_MASTER_IP it can print alink-redis.
I can ping alink-redis and get the ip of svc.

If I try to change $REDIS_MASTER_IP to alink-redis in config file.
Then the sentinel can run.

So why and if it could be resolved?



Solution 1:[1]

OK. I have get the answer for developer. Config file not support environment variables.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lystormenvoy