redis-cluster
redis-cluster copied to clipboard
It should be $(HOSTNAME) but not $(hostname)
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.
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.
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.
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.