title: Broker may not be available error Kafka schema registry
body: <p>I have defined Kafka and Kafka schema registry configuration using Kubernetes deployments and services. I used <a href="https://docs.confluent.io/current/installation/docker/docs/config-reference.html" rel="nofollow noreferrer">this link</a> as a reference for the environment variables set up. However, when I try to run Kafka with registry I see that the schema registry pods crashes with an error message in the logs:</p>
  
  <pre><code>[kafka-admin-client-thread | adminclient-1] WARN
  org.apache.kafka.clients.NetworkClient - [AdminClient
  clientId=adminclient-1] Connection to node -1
  (localhost/127.0.0.1:9092) could not be established. Broker may not be
  available.
      [main] ERROR io.confluent.admin.utils.ClusterStatus - Error while getting broker list.
      java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for
  a node assignment.
  </code></pre>
  
  <p>What could be the reason of this error?</p>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: kafka-service
  spec:
    ports:
      - name: client
        port: 9092
    selector:
      app: kafka
      server-id: "1"
  ---
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: kafka-1
  spec:
    selector:
      matchLabels:
        app: kafka
        server-id: "1"
    replicas: 1
    template:
      metadata:
        labels:
          app: kafka
          server-id: "1"
      spec:
        volumes:
          - name: kafka-data
            emptyDir: {}
        containers:
          - name: server
            image: confluentinc/cp-kafka:5.1.0
            env:
              - name: KAFKA_ZOOKEEPER_CONNECT
                value: zookeeper:2181
              - name: KAFKA_ADVERTISED_LISTENERS
                value: PLAINTEXT://localhost:9092
              - name: KAFKA_BROKER_ID
                value: "2"
              - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
                value: "1"
            ports:
              - containerPort: 9092
            volumeMounts:
              - mountPath: /var/lib/kafka
                name: kafka-data
  ---
  apiVersion: v1
  kind: Service
  metadata:
    name: schema-registry-service
  spec:
    ports:
      - name: client
        port: 8081
    selector:
      app: kafka-schema-registry
  ---
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: kafka-schema-registry
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: kafka-schema-registry
    template:
      metadata:
        labels:
          app: kafka-schema-registry
      spec:
        containers:
          - name: kafka-schema-registry
            image: confluentinc/cp-schema-registry:5.1.0
            env:
              - name: SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL
                value: zookeeper:2181
              - name: SCHEMA_REGISTRY_HOST_NAME
                value: localhost
              - name: SCHEMA_REGISTRY_LISTENERS
                value: "http://0.0.0.0:8081"
              - name: SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS
                value: PLAINTEXT://localhost:9092
            ports:
              - containerPort: 8081
  </code></pre>