Service Discovery
Configuring hostname for a container
By default, a container will have a hostname assigned to the name of a service in the domain .weave.local
. Names in the .weave.local
domain are searchable by DNS lookup requests within a cluster.
It is possible to configure a different name using hostname
field for a service configuration, for example:
Now all other containers within a cluster may discover IP address(es) of all containers for the example echo
service by echo-server
or echo-server.weave.local
host name.
Name server address
In general, it is not required to explicitly configure DNS server IP address for processes in containers. However, there are exceptions, for example HAProxy resolvers setting requires it explicitly configured. This can be done by passing OVERNODE_BRIDGE_IP environment variable as an environment variable or as a command line argument for a container. For example:
Unique host name
If the same service is placed for multiple nodes and you would like to have unique host names for each container of the same service, you can use OVERNODE_ID environment variable in the hostname value, for example:
Inspecting DNS records
To do DNS lookup in the .weave.local
domain, use dns-lookup command, for example:
To list all the available DNS records, use status command:
Managing DNS records
dns-add and dns-remove commands let you to manipulate DNS records in the .weave.local
domain from a command line, for example: