i have defined these variables (Username and Passw...
# troubleshooting
s
i have defined these variables (Username and Password) in Imply Mgr Pod, and also Druid Pods .. restarted the cluster
i
Can you add output to your script to print out
whoami
command as well as the
env
command to ensure they are set for the correct user?
s
hi @Ian Roberts since all Druid process on the K8s cluster pods run as Grove user, so i set it those variables for that user.. for some reason i don't see the logs for user-init script triggered via Imply Mgr redirected to any Pod's container logs ?
i
hmm ok. If you ssh into the pod and become grove, does it show the variable when you execute the env command?
s
yes because i manually setup the variables in the container of Data, Master.. i do see them when i do echo .. Note: grove user is set as non interactive login in the setup.. so i am using sudo -u
i am wondering, if user-init script when triggered by Imply Mgr is executed probably by root user on druid services pods ?
very less chance
i
that is what I was thinking, maybe before grove is created, at pod startup? Can you set the env variables for all users somehow at pod creation?
s
earlier i tried to set up in /etc/environment on all Pods so all users will use them. but same issue. my doubt is, may be the script is not substituting the values in below setup
Copy code
sed -i "/^exec.*/i export KAFKA_JAAS_CONFIG=\"org.apache.kafka.common.security.plain.PlainLoginModule required username='${USERNAME}' password='${PASSWORD}';\"" "$RUNDRUID
when we use hard code it work
i
are you setting the env variables in the yaml? can you share that portion of the yaml where it is being set if so?
s
for testing purpose i am doing it manually, modifying helm chart in the yaml file is one option i can try.. but i was not sure if this is correct way and anyone have used it ?
i
I do not know what you mean by manually, after the pod is created you are setting for grove user?
s
yes i am login to each container of the Pod and running the command of export with grove user
for example i am using below command on each container ( Data, Query and Master)
Copy code
export KAFKA_USERNAME="1234"
sudo -E -u grove env | grep KAFKA_USERNAME


export KAFKA_PASSWORD="1233444"
sudo -E -u grove env | grep KAFKA_PASSWORD
this command is executed as root in each container..
and pods/containers are not restarted , it is just the Druid cluster via Imply Mgr
i
ok, so you restart the druid services then to pick up the user-init? In manager, under the logs for the druid service, do you see an imply-init log? there are several logs listed under servers->logs
I would expect any logging you add to the user-init script to be in that output of imply-init
user-init script runs as root from what I can tell fyi. Can you try setting the env variables for root AS WELL AS grove as a test?
s
yes i restart druid service (cluster) stop and start. Let me retry and see if imply-init log is there in the container.. i was until now looking at Pods logs
sure will set to both users and let you know how it goes
i
to summarize, current theory is user-init is being run as root which is trying to set env variables it does not have set as they are set for grove user. I THINK if you do this via the yaml, the variables are globally set and accessible but I may be wrong so that can be another thing to try
s
Sure Ian , on side note, i see below steps from AI assistance. I am not sure if this is tried by anyone and a working option ?
Copy code
# Replace `your_username` and `your_password` with your actual credentials.
# The keys used here (KAFKA_USERNAME, KAFKA_PASSWORD) will be the names
# of the environment variables inside your pods.
kubectl create secret generic kafka-credentials \
  --from-literal=KAFKA_USERNAME='your_username' \
  --from-literal=KAFKA_PASSWORD='your_password'

# Verify the secret was created. The output will show the keys but not the values.
kubectl describe secret kafka-credentials


druid:
  overlords:
    roleGroups:
      default:
        env:
          - name: KAFKA_USERNAME
            valueFrom:
              secretKeyRef:
                name: kafka-credentials # Name of the Secret created above
                key: KAFKA_USERNAME    # Key within the Secret
          - name: KAFKA_PASSWORD
            valueFrom:
              secretKeyRef:
                name: kafka-credentials
                key: KAFKA_PASSWORD

  middleManagers:
    roleGroups:
      default:
        env:
          - name: KAFKA_USERNAME
            valueFrom:
              secretKeyRef:
                name: kafka-credentials
                key: KAFKA_USERNAME
          - name: KAFKA_PASSWORD
            valueFrom:
              secretKeyRef:
                name: kafka-credentials
                key: KAFKA_PASSWORD

  # Include the Indexer role if your tasks run there
  indexers:
    roleGroups:
      default:
        env:
          - name: KAFKA_USERNAME
            valueFrom:
              secretKeyRef:
                name: kafka-credentials
                key: KAFKA_USERNAME
          - name: KAFKA_PASSWORD
            valueFrom:
              secretKeyRef:
                name: kafka-credentials
                key: KAFKA_PASSWORD



     #!/bin/bash
# ... (rest of your user-init script) ...

# Construct and export the KAFKA_JAAS_CONFIG environment variable
export KAFKA_JAAS_CONFIG="org.apache.kafka.common.security.plain.PlainLoginModule required username=\"${KAFKA_USERNAME}\" password=\"${KAFKA_PASSWORD}\";"

# ... (rest of your user-init script) ...
i
it should be but I am not aware of using that method, I believe the other way has been done. Secrets should be doable though. I think the key is understanding the users and who has what variable set first though.
s
i agree.. reason to test out manually first was for same reason.. if it work there we can above.. let me try to setup manually as you suggested above for all users and see if it helps
will keep u posted
thank you
i
👍 no problem