I was trying to launch a schema-registry within a kubernetes cluster and every time I wanted to expose the pod’s port through a service, I was greeted by the nice title message:
if [[ -n "${SCHEMA_REGISTRY_PORT-}" ]]
then
echo "PORT is deprecated. Please use SCHEMA_REGISTRY_LISTENERS instead."
exit 1
fi
This happened because I had named my service schema-registry also (which was kind of not negotiable at the time) and kubernetes happily sets the SCHEMA_REGISTRY_PORT environment variable to the value of the port you want to expose. But it turns out that this very named variable has special meaning within the container.
Fortunately, I was not the only one bitten by this error, albeit for a different variable name, but I also used the same ugly hack:
$ kubectl -n kafka-tests get deployment schema-registry -o yaml
:
spec:
containers:
- command:
- bash
- -c
- unset SCHEMA_REGISTRY_PORT; /etc/confluent/docker/run
env:
- name: SCHEMA_REGISTRY_LISTENERS
value: http://0.0.0.0:8081/
: