HostAlias: Customizing /etc/hosts via LCP.json

Released 09/21/2023

Liferay Cloud now supports custom hostname-to-IP mapping for your applications, providing a seamless method to update the /etc/hosts file of your container pods. This enhancement offers users granular control over networking aspects without compromising infrastructure stability or security.

How it Works

  1. Configurable LCP.json: Liferay Cloud's LCP.json configuration file has been expanded to include the hostAliases property, which lets users define custom hostname-to-IP mappings.

    {
    "hostAliases":[{
    "ip":"10.XX.XX.XXX",
    "hostnames":["customdomain.example.com"]
    }]
    }
    Dynamic Kubernetes Deployment: During deployment, Liferay Cloud processes the hostAliases configuration from LCP.json and appropriately incorporates it into the Kubernetes deployment. Resultantly, every pod arising from this deployment will have its /etc/hosts file updated with the custom hostname-to-IP mapping.
  2. Seamless Integration:

    • For the Customer: This approach allows customers to map internal IPs to specific domain entries, offering flexibility akin to editing an /etc/hosts entry, but at the Kubernetes pod level.

    • For Liferay Cloud: The platform gains more adaptability, enabling users to fine-tune their deployed application's networking facets without risking the foundational security or stability.

Test Scenario & Validation

After implementing this feature, when an application is deployed with the hostAliases property in its LCP.json, users can access the application's container, inspect the /etc/hosts file, and verify the desired mappings.

Conclusion

By introducing this feature, Liferay Cloud offers an efficient solution to customize hostname-to-IP mappings without the need for other methods like public DNS or manual adjustments, ensuring that your applications run smoothly and effectively within the Liferay Cloud environment.

Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0