lixin9311 opened a new issue #6372: Several bugs in script leading to failure 
to bootstrap pulsar in Kubernetes
URL: https://github.com/apache/pulsar/issues/6372
 
 
   **Describe the bug**
   Failed to run bookie & broker by `kubectl apply -f bookie.yml` and `kubectl 
apply -f broker.yml` 
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Follow the steps in 
http://pulsar.apache.org/docs/en/deploy-kubernetes/#pulsar-on-a-custom-kubernetes-cluster
   
   **Expected behavior**
   Pulsar cluster should be up running
   
   **Root cause**
   1. First BUG
   Env vars defined here 
https://github.com/apache/pulsar/blob/943c9035b77d9a11c77d2ba42c8970dc09d5d70b/deployment/kubernetes/generic/k8s-1-9-and-above/bookie.yaml#L25-L30
   are supposed read by `apply-config-from-env.py` and applied to configuration 
files.
   
https://github.com/apache/pulsar/blob/943c9035b77d9a11c77d2ba42c8970dc09d5d70b/deployment/kubernetes/generic/k8s-1-9-and-above/bookie.yaml#L87-L91
    However, those keys with a prefix already exist in the configuration files, 
and 
[`apply-config-from-env.py`](https://github.com/apache/pulsar/blob/e1f3409fd45b26bafb44c321f99f853ebbc50109/docker/pulsar/scripts/apply-config-from-env.py)
  will only append keys with a prefix. So the existed k-v pairs (e.g., 
`zkServers`) won't be updated by the python script.
   **Temporary fix**: Remove the prefix of env vars in the `bookie.yml` and 
`broker.yml`
   
   2. Second BUG
   The env var defined in
   
https://github.com/apache/pulsar/blob/943c9035b77d9a11c77d2ba42c8970dc09d5d70b/deployment/kubernetes/generic/k8s-1-9-and-above/bookie.yaml#L26
 will be read py `apply-config-from-env.py` and applied to `pulsar_env.sh`. 
However, the `PULSAR_MEM` var will remain with quotes `"`.
   Before running `bookie`, 
https://github.com/apache/pulsar/blob/e1f3409fd45b26bafb44c321f99f853ebbc50109/bin/pulsar#L47-L57
   will initialize some new env vars. But it loads `kbenv.sh` first instead of 
`pulsar_env.sh`, causing 
https://github.com/apache/pulsar/blob/e1f3409fd45b26bafb44c321f99f853ebbc50109/conf/bkenv.sh#L36
 `BOOKIE_MEM` will be initialized as same as `PULSAR_MEM` with quotes. Causing 
invalid arguments when running the bookie.
   **Temporary fix**: add a line `. conf/pulsar_env.sh` before launching 
`bin/pulsar bookie` in the `bookie.yml`
   **Fix**: need to source `pulsar_env.sh` before `bkenv.sh` in the `pulsar`
   ```yaml
                    args: 
                      - > 
                        bin/apply-config-from-env.py conf/bookkeeper.conf && 
                        bin/apply-config-from-env.py conf/pulsar_env.sh && 
                        . conf/pulsar_env.sh &&
                        bin/pulsar bookie 
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to