'Unable to connect Zookeeper in gke cluster
I am getting the below error while deploying the Apache Zookeeper bitnami charts Unable to connect Zookeeper
To connect to your ZooKeeper server run the following commands:
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=zookeeper,app.kubernetes.io/instance=zookeeper,app.kubernetes.io/component=zookeeper" -o jsonpath="{.items[0].metadata.name}")
kubectl exec -it $POD_NAME -- zkCli.sh
error:
error: error executing jsonpath "{.items[0].metadata.name}": Error executing template: array index out of bounds: index 0, length 0. Printing more information for debugging the template:
template was:
{.items[0].metadata.name}
object given to jsonpath engine was:
map[string]interface {}{"apiVersion":"v1", "items":[]interface {}{}, "kind":"List", "metadata":map[string]interface {}{"resourceVersion":"", "selfLink":""}}
error: pod, type/name or --filename must be specified
Solution 1:[1]
Try running this command you will go inside the POD and further will be able to run that zkCli.sh file
kubectl exec -it zookeeper-0 -- /bin/bash
or
kubectl exec -it zookeeper-0 -- /bin/sh
Or you can also try once
kubectl exec -it zookeeper-0 -- zkCli.sh
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Harsh Manvar |