Docs

Documentation versions (currently viewingVaadin 24)

Hostname Guidelines

How to choose proper hostnames for Control Center applications and services.

When deploying applications to a Kubernetes cluster, it’s important to choose proper hostnames for your applications and services. This page provides guidelines for choosing hostnames for your Control Center applications and services.

Hostname Necessity

A hostname has two requirements: external access; and service communication. Regarding external access, the hostname acts as the application’s URL and makes it accessible from outside the cluster (e.g., via a browser or API calls). As for service communication, other services or microservices may need to communicate with your Vaadin application via this hostname.

A valid hostname must resolve to an IP address that can be accessed from the browser or external services.

Cloud Environments

If your Kubernetes cluster is hosted on a cloud platform (e.g., Google Kubernetes Engine, Amazon EKS, Azure AKS), you can add a DNS record that points to the cluster’s public IP.

To do this, get the public IP address of your service from your cloud provider’s dashboard. Then add a DNS record (e.g., app.mydomain.com) pointing to this public IP. For example, you might use:

https://app.mydomain.com

Make sure your firewall rules or security settings allow external traffic to this IP address on the appropriate ports.

Local Development & Testing

If you’re working with a local Kubernetes cluster (e.g., Minikube, Docker Desktop), you can use a local hostname and configure your operating system’s hosts file to resolve it to the loopback address.

The next two sub-sections provide the steps for configuring the hosts file depending on your operating system. Be sure to use a consistent hostname throughout your development environment to avoid a misconfiguration.

Whichever system you use, after editing the file, you can access your application locally by using the hostname, http://app.local.

Linux & macOS

When using a Unix based system like Linux or macOS, you’ll need to open the hosts file with administrative privileges like so:

sudo nano /etc/hosts

There you’ll have to add the following line to map app.local to your loopback address:

127.0.0.1   app.local

Windows

If you’re using a Windows system, you’ll instead need to start Notepad as an administrator. Using it, open the hosts file located at C:\Windows\System32\drivers\etc\hosts.

Add the following line to that file:

127.0.0.1   app.local