schema-registry icon indicating copy to clipboard operation
schema-registry copied to clipboard

Docker image fails to start citing deprecated PORT but I am using LISTENERS in env

Open mikesparr opened this issue 7 years ago • 17 comments

Version

4.0.0

Issue

Applying: https://docs.confluent.io/current/installation/docker/docs/quickstart.html#schema-registry

Startup fails citing: PORT is deprecated. Please use SCHEMA_REGISTRY_LISTENERS instead.

Expected

No errors and successful startup

Recreate

Kubernetes deployment to Google cloud. Already have ZK and Kafka running fine in stateful set in their own node pool.

---
apiVersion: v1
kind: Service
metadata:
  name: schema-registry
  labels:
    app: schema-registry
spec:
  ports:
  - port: 8081
    name: server
  selector:
    app: schema-registry
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: schema-registry
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: schema-registry
    spec:
      nodeSelector:
        servertype: app
      containers:
      - name: schema-registry
        image: confluentinc/cp-schema-registry:4.0.0
        imagePullPolicy: Always
        ports:
        - containerPort: 8081
        env:
        - name: SCHEMA_REGISTRY_LISTENERS
          value: http://localhost:8081
        - name: SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL
          value: zk-cs.default.svc.cluster.local
        - name: SCHEMA_REGISTRY_HOST_NAME
          value: localhost

Full container log dump

schema-registry | 2017-12-12T21:56:58.197141088Z | + exit 1
-- | -- | --
schema-registry | 2017-12-12T21:56:58.197067310Z | PORT is deprecated. Please use SCHEMA_REGISTRY_LISTENERS instead.
schema-registry | 2017-12-12T21:56:58.196970477Z | + echo 'PORT is deprecated. Please use SCHEMA_REGISTRY_LISTENERS instead.'
schema-registry | 2017-12-12T21:56:58.196864343Z | + [[ -n tcp://10.7.254.107:8081 ]]
schema-registry | 2017-12-12T21:56:58.196756693Z | fi
schema-registry | 2017-12-12T21:56:58.196687774Z | exit 1
schema-registry | 2017-12-12T21:56:58.196601344Z | echo "PORT is deprecated. Please use SCHEMA_REGISTRY_LISTENERS instead."
schema-registry | 2017-12-12T21:56:58.196471339Z | then
schema-registry | 2017-12-12T21:56:58.196382744Z | if [[ -n "${SCHEMA_REGISTRY_PORT-}" ]]
schema-registry | 2017-12-12T21:56:58.196259954Z |  
schema-registry | 2017-12-12T21:56:57.588478695Z | + dub path /etc/schema-registry/ writable
schema-registry | 2017-12-12T21:56:57.588294063Z | dub path /etc/"${COMPONENT}"/ writable
schema-registry | 2017-12-12T21:56:56.927485565Z | + dub ensure SCHEMA_REGISTRY_HOST_NAME
schema-registry | 2017-12-12T21:56:56.927253650Z | dub ensure SCHEMA_REGISTRY_HOST_NAME
schema-registry | 2017-12-12T21:56:55.943434339Z | + dub ensure-atleast-one SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS
schema-registry | 2017-12-12T21:56:55.943427861Z | dub ensure-atleast-one SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS
schema-registry | 2017-12-12T21:56:55.943394039Z |  
schema-registry | 2017-12-12T21:56:55.933701901Z | ===> Configuring ...
schema-registry | 2017-12-12T21:56:55.933696636Z | uid=0(root) gid=0(root) groups=0(root)
schema-registry | 2017-12-12T21:56:55.933681579Z | + /etc/confluent/docker/configure
schema-registry | 2017-12-12T21:56:55.933676950Z | /etc/confluent/docker/configure
schema-registry | 2017-12-12T21:56:55.933672481Z | + echo '===> Configuring ...'
schema-registry | 2017-12-12T21:56:55.933666848Z | echo "===> Configuring ..."
schema-registry | 2017-12-12T21:56:55.933651447Z |  
schema-registry | 2017-12-12T21:56:55.926230099Z | ===> User
schema-registry | 2017-12-12T21:56:55.926225805Z | _=/usr/bin/env
schema-registry | 2017-12-12T21:56:55.926221510Z | ZULU_OPENJDK_VERSION=8=8.17.0.3
schema-registry | 2017-12-12T21:56:55.926217218Z | ZK_CS_SERVICE_PORT_CLIENT=2181
schema-registry | 2017-12-12T21:56:55.926212953Z | ZK_CS_SERVICE_PORT=2181
schema-registry | 2017-12-12T21:56:55.926208573Z | ZK_CS_SERVICE_HOST=10.7.253.115
schema-registry | 2017-12-12T21:56:55.926204310Z | ZK_CS_PORT_2181_TCP_PROTO=tcp
schema-registry | 2017-12-12T21:56:55.926200100Z | ZK_CS_PORT_2181_TCP_PORT=2181
schema-registry | 2017-12-12T21:56:55.926195747Z | ZK_CS_PORT_2181_TCP_ADDR=10.7.253.115
schema-registry | 2017-12-12T21:56:55.926191586Z | ZK_CS_PORT_2181_TCP=tcp://10.7.253.115:2181
schema-registry | 2017-12-12T21:56:55.926187270Z | ZK_CS_PORT=tcp://10.7.253.115:2181
schema-registry | 2017-12-12T21:56:55.926182725Z | SHLVL=1
schema-registry | 2017-12-12T21:56:55.926175500Z | SCHEMA_REGISTRY_SERVICE_PORT_SERVER=8081
schema-registry | 2017-12-12T21:56:55.926171119Z | SCHEMA_REGISTRY_SERVICE_PORT=8081
schema-registry | 2017-12-12T21:56:55.926166895Z | SCHEMA_REGISTRY_SERVICE_HOST=10.7.254.107
schema-registry | 2017-12-12T21:56:55.926162682Z | SCHEMA_REGISTRY_PORT_8081_TCP_PROTO=tcp
schema-registry | 2017-12-12T21:56:55.926158489Z | SCHEMA_REGISTRY_PORT_8081_TCP_PORT=8081
schema-registry | 2017-12-12T21:56:55.926153673Z | SCHEMA_REGISTRY_PORT_8081_TCP_ADDR=10.7.254.107
schema-registry | 2017-12-12T21:56:55.926136153Z | SCHEMA_REGISTRY_PORT_8081_TCP=tcp://10.7.254.107:8081
schema-registry | 2017-12-12T21:56:55.926131966Z | SCHEMA_REGISTRY_PORT=tcp://10.7.254.107:8081
schema-registry | 2017-12-12T21:56:55.926127762Z | SCHEMA_REGISTRY_LISTENERS=http://localhost:8081
schema-registry | 2017-12-12T21:56:55.926123390Z | SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=zk-cs.default.svc.cluster.local
schema-registry | 2017-12-12T21:56:55.926119145Z | SCHEMA_REGISTRY_HOST_NAME=localhost
schema-registry | 2017-12-12T21:56:55.926114952Z | SCALA_VERSION=2.11
schema-registry | 2017-12-12T21:56:55.926110626Z | PYTHON_VERSION=2.7.9-1
schema-registry | 2017-12-12T21:56:55.926103507Z | PYTHON_PIP_VERSION=8.1.2

mikesparr avatar Dec 12 '17 22:12 mikesparr

Hi,

I have the same error. Anyone can fix this ? Thank you so much

Best Regards, VietNC

vietwow avatar Dec 28 '17 08:12 vietwow

I ran into this same thing. It was due to kubernetes generating the SCHEMA_REGISTRY_PORT env var based on the name of the pod.

I was able to resolve this by naming my pod/service to something other than 'schema-registry'.

jimhub avatar Dec 29 '17 18:12 jimhub

I did change the service name, but still see the same error. It has issue with KAFKA_PORT not SCHEMA_REGISTRY_PORT

I got another similar issue with Kafka Rest , similar error (https://github.com/confluentinc/cp-docker-images/issues/286) with similar fix (rename the service name), but that fix works for kafka-rest.

can we have a fix together by confluentinc?

Seems the error comes from confluentinc/cp-kafka:4.0.1, not schema-registry itself

https://github.com/confluentinc/cp-docker-images/blob/master/debian/kafka/include/etc/confluent/docker/configure#L61-L65

+ [[ -n '' ]]
 if [[ -n "${KAFKA_HOST-}" ]]
then
  echo "host is deprecated. Please use KAFKA_ADVERTISED_LISTENERS instead."
  exit 1
fi
+ [[ -n '' ]]
 if [[ -n "${KAFKA_PORT-}" ]]
then
  echo "port is deprecated. Please use KAFKA_ADVERTISED_LISTENERS instead."
  exit 1
fi
+ [[ -n tcp://172.xx.xxx.xx:9092 ]]
+ echo 'port is deprecated. Please use KAFKA_ADVERTISED_LISTENERS instead.'
port is deprecated. Please use KAFKA_ADVERTISED_LISTENERS instead.
+ exit 1

ozbillwang avatar Jun 28 '18 14:06 ozbillwang

Looks like the kubenetes will automatically set the env name APPNAME_PORT, i.e. KAFKA_PORT in this case, the workaround is to change your app name to something else other than kafka.

forainychen avatar Aug 27 '18 18:08 forainychen

I'm seeing this same issue trying to deploy 5.0.0 of the schema-registry. I don't have a service or pod name with schema-registry of kafka-rest

Config

apiVersion: apps/v1
kind: Deployment
metadata:
  name: control-center
spec:
  selector:
    matchLabels:
      app: control-center
  replicas: 1
  template:
    metadata:
      labels:
        app: control-center
    spec:
      containers:
        - name: rest-proxy
          image: confluentinc/cp-kafka-rest:latest
          ports:
            - name: rest-proxy-port
              containerPort: 8082
              hostPort: 8082
          env:
            - name: KAFKA_REST_HOST_NAME
              value: rest-proxy
            - name: KAFKA_REST_BOOTSTRAP_SERVERS
              value: kafka-zk-vm:9092
            - name: KAFKA_REST_LISTENERS
              value: http://0.0.0.0:8082
            - name: KAFKA_REST_SCHEMA_REGISTRY_URL
              value: http://avro-schema-registry:8081
        - name: avro-schema-registry
          image: confluentinc/cp-schema-registry:5.0.0
          ports:
            - name: schema-port
              containerPort: 8081
              hostPort: 8081
          env:
            - name: SCHEMA_REGISTRY_HOST_NAME
              value: avro-schema-registry
            - name: SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL
              value: kafka-zk-vm:2181
            - name: SCHEMA_REGISTRY_LISTENERS
              value: http://0.0.0.0:8081
        - name: control-center
          image: confluentinc/cp-enterprise-control-center:5.0.0
          ports:
            - name: control-port
              containerPort: 9021
              hostPort: 9021
          env:
            - name: CONTROL_CENTER_ZOOKEEPER_CONNECT
              value: kafka-zk-vm:2181
            - name: CONTROL_CENTER_BOOTSTRAP_SERVERS
              value: kafka-zk-vm:9092
            - name: CONTROL_CENTER_REPLICATION_FACTOR
              value: "1"
            - name: CONTROL_CENTER_INTERNAL_TOPICS_PARTITIONS
              value: "1"
            - name: CONTROL_CENTER_MONITORING_INTERCEPTOR_TOPIC_PARTITIONS
              value: "1"
            - name: CONFLUENT_METRICS_TOPIC_REPLICATION
              value: "1"
            - name: CONTROL_CENTER_PORT
              value: "9021"
            - name: CONTROL_CENTER_CONNECT_CLUSTER
              value: kafka-connect:8083
---
apiVersion: v1
kind: Service
metadata:
  name: control-center
spec:
  # type: LoadBalancer
  type: NodePort
  ports:
    - port: 9021
      targetPort: 9021
      protocol: TCP
  selector:
    app: control-center

Container Dump

===> ENV Variables ...
ALLOW_UNSIGNED=false
AVRO_SCHEMA_REGISTRY_PORT=tcp://10.3.245.8:8081
AVRO_SCHEMA_REGISTRY_PORT_8081_TCP=tcp://10.3.245.8:8081
AVRO_SCHEMA_REGISTRY_PORT_8081_TCP_ADDR=10.3.245.8
AVRO_SCHEMA_REGISTRY_PORT_8081_TCP_PORT=8081
AVRO_SCHEMA_REGISTRY_PORT_8081_TCP_PROTO=tcp
AVRO_SCHEMA_REGISTRY_SERVICE_HOST=10.3.245.8
AVRO_SCHEMA_REGISTRY_SERVICE_PORT=8081
BACKEND_PORT=tcp://10.3.240.57:8069
BACKEND_PORT_8069_TCP=tcp://10.3.240.57:8069
BACKEND_PORT_8069_TCP_ADDR=10.3.240.57
BACKEND_PORT_8069_TCP_PORT=8069
BACKEND_PORT_8069_TCP_PROTO=tcp
BACKEND_SERVICE_HOST=10.3.240.57
BACKEND_SERVICE_PORT=8069
COMPONENT=schema-registry
CONFLUENT_DEB_VERSION=1
CONFLUENT_MAJOR_VERSION=5
CONFLUENT_MINOR_VERSION=0
CONFLUENT_MVN_LABEL=
CONFLUENT_PATCH_VERSION=0
CONFLUENT_PLATFORM_LABEL=
CONFLUENT_VERSION=5.0.0
CONTROL_CENTER_PORT=tcp://10.3.245.58:9021
CONTROL_CENTER_PORT_9021_TCP=tcp://10.3.245.58:9021
CONTROL_CENTER_PORT_9021_TCP_ADDR=10.3.245.58
CONTROL_CENTER_PORT_9021_TCP_PORT=9021
CONTROL_CENTER_PORT_9021_TCP_PROTO=tcp
CONTROL_CENTER_SERVICE_HOST=10.3.245.58
CONTROL_CENTER_SERVICE_PORT=9021
CUB_CLASSPATH=/etc/confluent/docker/docker-utils.jar
FRONTEND_PORT=tcp://10.3.245.3:8080
FRONTEND_PORT_8080_TCP=tcp://10.3.245.3:8080
FRONTEND_PORT_8080_TCP_ADDR=10.3.245.3
FRONTEND_PORT_8080_TCP_PORT=8080
FRONTEND_PORT_8080_TCP_PROTO=tcp
FRONTEND_SERVICE_HOST=10.3.245.3
FRONTEND_SERVICE_PORT=8080
HOME=/root
HOSTNAME=control-center-77fdb4fddc-m2qcg
KAFKA_CONNECT_PORT=tcp://10.3.243.201:8083
KAFKA_CONNECT_PORT_8083_TCP=tcp://10.3.243.201:8083
KAFKA_CONNECT_PORT_8083_TCP_ADDR=10.3.243.201
KAFKA_CONNECT_PORT_8083_TCP_PORT=8083
KAFKA_CONNECT_PORT_8083_TCP_PROTO=tcp
KAFKA_CONNECT_SERVICE_HOST=10.3.243.201
KAFKA_CONNECT_SERVICE_PORT=8083
KAFKA_CONTROL_CENTER_PORT=tcp://10.3.254.82:9021
KAFKA_CONTROL_CENTER_PORT_9021_TCP=tcp://10.3.254.82:9021
KAFKA_CONTROL_CENTER_PORT_9021_TCP_ADDR=10.3.254.82
KAFKA_CONTROL_CENTER_PORT_9021_TCP_PORT=9021
KAFKA_CONTROL_CENTER_PORT_9021_TCP_PROTO=tcp
KAFKA_CONTROL_CENTER_SERVICE_HOST=10.3.254.82
KAFKA_CONTROL_CENTER_SERVICE_PORT=9021
KAFKA_VERSION=2.0.0
KUBERNETES_PORT=tcp://10.3.240.1:443
KUBERNETES_PORT_443_TCP=tcp://10.3.240.1:443
KUBERNETES_PORT_443_TCP_ADDR=10.3.240.1
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_SERVICE_HOST=10.3.240.1
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_PORT_HTTPS=443
LANDING_PAGE_PORT=tcp://10.3.255.64:8080
LANDING_PAGE_PORT_8080_TCP=tcp://10.3.255.64:8080
LANDING_PAGE_PORT_8080_TCP_ADDR=10.3.255.64
LANDING_PAGE_PORT_8080_TCP_PORT=8080
LANDING_PAGE_PORT_8080_TCP_PROTO=tcp
LANDING_PAGE_SERVICE_HOST=10.3.255.64
LANDING_PAGE_SERVICE_PORT=8080
LANG=C.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
PYTHON_PIP_VERSION=8.1.2
PYTHON_VERSION=2.7.9-1
SCALA_VERSION=2.11
SCHEMA_REGISTRY_HOST_NAME=avro-schema-registry
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=kafka-zk-vm:2181
SCHEMA_REGISTRY_LISTENERS=avro-schema-registry:8081
SCHEMA_REGISTRY_PORT=tcp://10.3.245.211:8081
SCHEMA_REGISTRY_PORT_8081_TCP=tcp://10.3.245.211:8081
SCHEMA_REGISTRY_PORT_8081_TCP_ADDR=10.3.245.211
SCHEMA_REGISTRY_PORT_8081_TCP_PORT=8081
SCHEMA_REGISTRY_PORT_8081_TCP_PROTO=tcp
SCHEMA_REGISTRY_SERVICE_HOST=10.3.245.211
SCHEMA_REGISTRY_SERVICE_PORT=8081
SHLVL=1
ZULU_OPENJDK_VERSION=8=8.30.0.1

...

[ -n "${HOST:-}" ] && [ -z "${SCHEMA_REGISTRY_HOST_NAME:-}" ] && \
	export SCHEMA_REGISTRY_HOST_NAME=$HOST || true # we don't want the setup to fail if not on Mesos
++ '[' -n '' ']'
++ true


echo "===> ENV Variables ..."
+ echo '===> ENV Variables ...'
env | sort
+ env
+ sort

echo "===> User"
+ echo '===> User'
id
+ id

echo "===> Configuring ..."
+ echo '===> Configuring ...'
/etc/confluent/docker/configure
+ /etc/confluent/docker/configure

dub ensure-atleast-one SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS
+ dub ensure-atleast-one SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS
dub ensure SCHEMA_REGISTRY_HOST_NAME
+ dub ensure SCHEMA_REGISTRY_HOST_NAME
dub path /etc/"${COMPONENT}"/ writable
+ dub path /etc/schema-registry/ writable

if [[ -n "${SCHEMA_REGISTRY_PORT-}" ]]
then
  echo "PORT is deprecated. Please use SCHEMA_REGISTRY_LISTENERS instead."
  exit 1
fi
+ [[ -n tcp://10.3.245.211:8081 ]]
+ echo 'PORT is deprecated. Please use SCHEMA_REGISTRY_LISTENERS instead.'
PORT is deprecated. Please use SCHEMA_REGISTRY_LISTENERS instead.
+ exit 1

Neither the pod or the service have a name of that would generate SCHEMA_REGISTRY_PORT env variable. Is there something I'm missing?

DevonPeroutky avatar Oct 03 '18 18:10 DevonPeroutky

@jimhub , How can we pass the master.eligibility=false should it be passed as an environment variable in helm chart. I tried passing but the schema-registry still has an environment variable in my helm chart but the logs still show it as master.eligibility set to true,

Environment:
  SCHEMA_REGISTRY_HOST_NAME:                      (v1:status.podIP)
  SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS:  PLAINTEXT://xx.xx.xx.xx:9092,PLAINTEXT://xx.xx.xx.xx:9092,PLAINTEXT://xx.xx.xx.xx:9092
  SCHEMA_REGISTRY_LISTENERS:                     http://0.0.0.0:8083
  SCHEMA_REGISTRY_MASTER_ELIGIBILITY:            false

diddle-doo avatar Oct 15 '18 16:10 diddle-doo

I got the hint for the solution here: https://github.com/confluentinc/cp-docker-images/issues/286

I had a service called "schema-registry" with a port named "schema-registry-port". After I deleted the service the pod was starting.

baltendo avatar Nov 01 '18 23:11 baltendo

I got the hint for the solution here: confluentinc/cp-docker-images#286

I had a service called "schema-registry" with a port named "schema-registry-port". After I deleted the service the pod was starting.

I renamed the service from schema-registry and it solved my issue.

ShahNewazKhan avatar Feb 08 '20 04:02 ShahNewazKhan

@jimhub , How can we pass the master.eligibility=false should it be passed as an environment variable in helm chart. I tried passing but the schema-registry still has an environment variable in my helm chart but the logs still show it as master.eligibility set to true,

Environment:
  SCHEMA_REGISTRY_HOST_NAME:                      (v1:status.podIP)
  SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS:  PLAINTEXT://xx.xx.xx.xx:9092,PLAINTEXT://xx.xx.xx.xx:9092,PLAINTEXT://xx.xx.xx.xx:9092
  SCHEMA_REGISTRY_LISTENERS:                     http://0.0.0.0:8083
  SCHEMA_REGISTRY_MASTER_ELIGIBILITY:            false

Hello; @diddle-doo were you able to fix the problem in Helm? The problem is still exist. How can I fix the bug in Helm? Which file should I edit? Thanks

tirelibirefe avatar May 20 '20 02:05 tirelibirefe

helm install schema-registry incubator/schema-registry -f $CHART_PATH/incubator/schema-registry/overrides.yaml

The content of $CHART_PATH/incubator/schema-registry/overrides.yaml is

nameOverride: sr
fullnameOverride: schema-registry-sr
# ...

Hopefully for anyone arriving here, this will give you a bit of extra mileage

DarrenBishop avatar Sep 01 '20 15:09 DarrenBishop

If changing the name doesn't work, check if the old services with the name schema-registry are actually removed from kubernetes. Run the command kubectl get svc and check. Renaming the service from schema-registry to something else works.

gurleensethi avatar Nov 19 '20 13:11 gurleensethi

I have renamed the Container name inside the deployment manifest and that seems to fix the issue

name: kafka-container ports: - containerPort: 9092

Binyamse avatar Feb 17 '21 08:02 Binyamse

For anyone facing into the same issue - there's much simpler solution. Starting from Kubernetes v1.13 (much time ago :) ), there's an enableServiceLinks: false option for pod template, which disables automatic service discovery environment variables population. Works! More info here.

vitalikaz avatar Apr 22 '21 11:04 vitalikaz

@vitalikaz Many thanks! That did it! And it looks pretty nice! 🥇

image

snukone avatar Apr 27 '21 15:04 snukone

For anyone facing into the same issue - there's much simpler solution. Starting from Kubernetes v1.13 (much time ago :) ), there's an enableServiceLinks: false option for pod template, which disables automatic service discovery environment variables population. Works! More info here.

Thanks, this saved my day !

mmaia avatar Dec 23 '21 01:12 mmaia

@ozbillwang kudos for pointing to the exact file. I could not connect the dots without this.

wind57 avatar Aug 10 '22 20:08 wind57

Same issue with cp-kafka (0.6.1), I used to change fullnameOverride from kafka to another

Tarasovych avatar Oct 20 '22 05:10 Tarasovych