redis-cluster icon indicating copy to clipboard operation
redis-cluster copied to clipboard

It should be $(HOSTNAME) but not $(hostname)

Open matthklo opened this issue 5 years ago • 3 comments

It should be $(HOSTNAME) but not $(hostname) in both readinessProbe and livenessProbe part of redis-cluster.yml. I think $(hostname) will be resolved as empty string which makes the redis-cli command ends up as blocking in the interactive mode.

matthklo avatar Mar 20 '19 10:03 matthklo

I don't think your assumption is correct though, hostname is a function that is invoked in the container. If it somehow returns an empty string, maybe it should be something else entirely, but $(HOSTNAME) would invoke the function HOSTNAME, which doesn't seem right.

sanderploegsma avatar Mar 21 '19 14:03 sanderploegsma

Well, maybe I was wrong because I'm new to Kubernetes. But according to the doc here, the pattern '$(something)' in config should be replaced with the content of the environment variable named 'something'. In your case, '$(hostname)' will be replaced with the content of the environment variable named 'hostname', which does not exist. I guess what you intended to use was '$(HOSTNAME)', since the HOSTNAME environment variable will be defined on container starts.

matthklo avatar Mar 21 '19 17:03 matthklo

Hmm, interesting. I don't recall it working this way in earlier Kubernetes versions. Anyway, I didn't intend to use the value of the environment variable HOSTNAME, but instead I wanted to execute /bin/hostname, which should print the hostname of the pod.

sanderploegsma avatar Mar 21 '19 23:03 sanderploegsma