Hi @sanju_techie the second option you tried should've worked, interesting. The error message you got is from Nginx itself;
<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n<hr><center>nginx</center>
Would you be able to provide the Ingress configuration of Nginx, the Kubernetes service configuration, and the redacted command you're using to install/enroll your agents?
Could you also look at the Nginx logs to see what request is resulting in the 504 error? This would probably help with debugging.