DNS
The DNS server is embedded in the simplecontainer agent. It is a fully functional DNS server. The port it uses is 53 and is exposed in the Docker network where the simplecontainer is running.
It is aware of all the containers running on the single Docker host and makes service discovery enabled.
Format of the DNS:
network.group.generatedName.cluster.private
Where:
network
is the network name of the Docker network where the container is deployedgroup
is the group of the container defined in the metageneratedName
is the name generated using container specificationgroup-name-index
.cluster.private
is the suffix inside the simplecontainer network
When the container is created the respective DNS name is added as the A record in the server. Also, when the container is removed, stopped, or dead the DNS recorded is removed hence the name resolution will fail.
Example
Let's examine the next minimal container definition:
kind: container
meta:
group: example
name: test
spec:
container:
image: busybox
tag: latest
replicas: 2
entrypoint: ["sleep"]
args: ["3600"]
This will create three DNS records:
bridge.example.example-test-1.cluster.private
bridge.example.example-test-2.cluster.private
bridge.example.test.cluster.private
The first two DNS records will return the IP of the specific container. The last record will return the IP addresses of both containers.
The records will be live in the DNS server only when the container reaches the RUNNING state otherwise, the DNS record will be discarded.