3

I want to use consul/registration using registrator for service discovery on my kubernetes nodes. Need help in how should I setup consul.

I have a deployed kubernetes with 1 master and 2 minions on openstack using kubeadm. For consul and registration , do i need to run the consul container on each node master and minion? how will they communicate among each other?

sarora
  • 41
  • 2
  • 6
  • 1
    Just out of curiosity, why would you not use the default service discovery that kubernetes has? (with etcd and so on.) – iamnat Dec 22 '16 at 12:51
  • based on my study of consul vs etcd i found the below : When using etcd or Zookeeper it's up to you how your service directory works, both what information is stored and how to structure it. Specialized service discovery systems like Flynn's discoverd or Netflix's Eureka provide more structure around service semantics. Consul is sort of a hybrid, since it's really a specialized service discovery system built-in to a general configuration store. & consul has health checks too. – sarora Dec 22 '16 at 13:17
  • 3
    Kubernetes has service discovery (Service resource) and config store primitives (ConfigMap), and health checks as well. You really shouldn't need to add Consul into the mix unless you are doing something unusual. I would recommend doing some more reading on Kubernetes features before trying to go down this path. – Pixel Elephant Dec 22 '16 at 15:45
  • 1
    As @iamnat and Pixel said, Kubernetes run a proxy on each host in the cluster. The proxy plays the role of a server-side discovery load balancer. In order to make a request to a service, the client routes the request via the proxy using the host's ip address and the service's assigned port. The proxy then transparently forwards the request to an available service instance running somewhere in the cluster. – Lakshman Diwaakar Dec 23 '16 at 10:47
  • thank you for the reply i have started using kube-dns for service discovery – sarora Jan 03 '17 at 07:08
  • @iamnat A use case for it would be tying your legacy infra into your k8s clusters and your k8s cluster into your legacy infra, specifically if your legacy is already using consul. – Kuberchaun May 05 '17 at 16:20
  • @PixelElephant what about the argument of not being locked into Kubernetes for everything, and the other argument of being in a transition mode where some services in our org are still announcing to consul. Forgive me if I'm missing the obvious, but my team is facing a similar question (k8s discovery vs everything we already built on top of consul) – Roy Kachouh May 23 '17 at 13:20

1 Answers1

0

You may want to look at using https://github.com/tczekajlo/kube-consul-register over using Registrator.

Allows you to register or deregister services/nodes/containers and apply all the benefits of Consul. You can run externally and in-cluster as a Replica Set or Deployment.

Brandon Clark
  • 788
  • 1
  • 13
  • 26