Sign inSign up

biarca/registrator

By biarca

•Updated over 9 years ago

The gliderlabs/registrator:master is customized to use IP from environment variables.

Image
0

670

biarca/registrator repository overview

⁠gliderlabs/registrator

The registrator auto-registers the docker containerized services to service discovery tools such as consul, etcd, etc. This service auto-registration of docker containerized services is much needed feature for the environments where the docker containers are managed by orchestration tools like kubernetes⁠, etc.

⁠Changes made

The gliderlabs/registrator:master⁠ is customized to accept the pod IP from the environment variables.

⁠Why does it require to use IP from environment variables?

The registrator will register the docker containerized services with the service discovery tools by grabbing the container IP address and exposed ports from the docker inspect information (low-level information of docker object). But, the docker containers which are managed by the kubernetes will not show up the container IP address under docker inspect information. In some kubernetes cluster managed environments, the docker containers network information will be offloaded to another container whos reference is given under HostConfig.NetworkMode value.

In GKE (Google Container Engine), the docker containers will not show up container IP address either in the container inspect information or in the offloaded container inspect information.

⁠How to use this customized gliderlabs/registrator?

This example information is given based on the consul service discovery perspective.

The POD_IP is the environment variable.

Run the registrator service as shown:

$ registrator -useIpFromEnv=POD_IP consul://<consul-agent-ip>:8500

Add the following k8s spec configuration in each deployment file to register the service:

...
    env:          
    - name: POD_IP
      valueFrom:
        fieldRef:
          fieldPath: status.podIP
...

When the registrator run with the flag -useIpFromEnv=POD_IP, the registrator uses this IP address (the value of POD_IP env) as container IP address and registers with consul agent service.

For more information, you can visit the official gliderlabs/registrator github⁠ or docs⁠ links.

Tag summary

Content type

Image

Digest

Size

9.4 MB

Last updated

over 9 years ago

docker pull biarca/registrator:v7