Unable to set username password for Elastic in azure container app

Unable to set username password for Elastic in conatiner app. As to launch the container app, I am passing below environment varibles.

xpack.security.enabled = false
discovery.type = single-node

If I make xpack.security.enabled = true to set the username password, then the app is failing to launch with below msg:
upstream connect error or disconnect/reset before headers. retried and the latest reset reason : connection termination.
Sometimes it is showing 502 error.

Thanks, @chand_techie. Do you have the text of the error message you receive when you get the 502 error?

Try with new volume for security, it should work.

This issue possible when you are running the single node with xpack.security.enabled = false , elasticsearch will doesn't create security indices. If you are trying to restart with enable true with existing data it will cause the issue.

If you need current data, create a snapshot of the current indices and with new data volume run the container again.

1 Like

Hi Jessgarson,

Only 1 time so far i got the 502 error, I have tried to replicate the scenario where pass the xpac.security.enabled = true. Getting below msg on the browser while launching the elastic:
upstream connect error or disconnect/reset before headers. retried and the latest reset reason: connection termination

@JinnaBalu --- even If I dnt attach any volume in my container app, just to check if the elastic gets launched or not .. its not working. I have tried passing with xpac.security.enabled as true and container showing running status but on browser, I am not getting below msg : upstream connect error or disconnect/reset before headers. retried and the latest reset reason: connection termination.

Thanks for following up, @chand_techie. You may want to try double checking your logs, as well as checking your resource contstraints too.

Here are a few resources that may be helpful here, too:

@jessgarson, thanks for the reply. I had a working Elastic setup with username and password which is working perfectly fine in a IAAS VM in Azure.

Looking here for a solution where we are hosting elastic on Container app (PAAS) in Azure. I have followed the below document link, where it is mentioned to Elastic on container app we need to pass xpac.security.enabled=false, if I set up this as true my elastic app doesn't launch.
Doc link: {azureossd_github_io/2024/08/13/Setting-up-a-basic-Elasticsearch-container-on-Container-Apps/} (Kindly replace _ with dot as the forum is not allowing me to post a link)

How we can setup the username password with Elastic hosting on container app. Could you please help me in this regard.

Thanks. Can you say a bit more about you are passing in your username and password? I saw this related stack overflow post that suggests trying:

elasticsearch-reset-password -u elastic --interactive