Resolving UnresolvedAddressException when connecting to services from cloud functions
If you're encountering a java.nio.channels.UnresolvedAddressException when trying to connect to services from a cloud function, this is typically caused by using internal Kubernetes service names that are not accessible from external cloud functions. Root Cause Cloud functions cannot resolve internal Kubernetes service names. Services need to be exposed with publicly accessible hostnames for cloud functions to connect to them. Solution Update your environment variables to use the exposed hostnames instead of internal Kubernetes service names: Public Services For services that can be exposed publicly, update the following environment variables: AUTH_KEYCLOAK_URL : Use kc-shrd01.cloud.yourcompany.com RABBITMQ_HOST : Use mq-shrd01.cloud.yourcompany.com SCROLLLOG_HOST : Use es-shrd01.cloud.yourcompany.com Internal Services For services that should not be exposed publicly (such as calcdata, db2rest, and pbac), internal hostnames will be created: CALC_DATABLM_URL : Use calcdata-dev01.cloud.yourcompany.com DB2REST_URL : Use db2rest-dev01.cloud.yourcompany.com PBAC_URL : Use pbac-dev01.cloud.yourcompany.com Implementation After updating your environment variables with the correct hostnames, redeploy your cloud function. The connection should be successful once the proper exposed hostnames are configured. Note that this same issue may occur with other services like RabbitMQ, so ensure all service connections use the appropriate exposed hostnames rather than internal Kubernetes service names.
Last updated
Was this helpful?

