@Dipten Halder
Please check the following, if it doesn't resolve your issues please let me know and we can work with you directly to investigate further:
- Check the environment variables: Make sure the pod has the correct environment variables set up for the managed identity, such as
AZURE_CLIENT_ID
,AZURE_TENANT_ID
, andAZURE_AUTHORITY_HOST
. You can use thekubectl exec
command to inspect the pod’s environment variables. - Verify the managed identity: Ensure that the pod has a valid managed identity assigned to it, and that the identity has the appropriate permissions to access the PostgreSQL database. You can use the
kubectl get azureidentity
andkubectl get azureidentitybinding
commands to check the identity and binding status. - Test the access token: Try to obtain an access token from the pod using the
az login
andaz account get-access-token
commands. If the token is successfully retrieved, use it to connect to the PostgreSQL database using a tool likepsql
orpgAdmin
. If the token is invalid or expired, you may need to refresh it or troubleshoot the token exchange service. - Review the logs: Examine the logs of the pod and the PostgreSQL database to look for any errors or warnings related to the authentication or connection. You can use the
kubectl logs
command to view the pod’s logs, and the Azure portal to access the database’s logs.