kube-consul-register by default adds some useful tags like pod name, node name, container name etc. It also adds the type as prefix. For example, pod:<pod-name>, node:<node-name>.
I wanted to route traffic to specific pods (managed by Statefulset) via Consul DNS. Currently, this can be achieved by querying pod:<pod-name>.<consul-service-name>.service.consul. The problem am facing is that the above domain name is invalid for certain resolvers like redis-cli.
In this PR I have made kube-consul-register to add the pod name without "pod:" prefix as one of the tags to Consul service. So we use <pod-name>.<consul-service-name>.service.consul to route traffic to a specific pod.
Routing to specific pods is much required in a cluster setup (like redis cluster) where we have multiple master / slave instances and the client requires the name of all those instances to interact with the cluster.
kube-consul-register by default adds some useful tags like pod name, node name, container name etc. It also adds the type as prefix. For example,
pod:<pod-name>
,node:<node-name>
.I wanted to route traffic to specific pods (managed by Statefulset) via Consul DNS. Currently, this can be achieved by querying
pod:<pod-name>.<consul-service-name>.service.consul
. The problem am facing is that the above domain name is invalid for certain resolvers likeredis-cli
.In this PR I have made kube-consul-register to add the pod name without "pod:" prefix as one of the tags to Consul service. So we use
<pod-name>.<consul-service-name>.service.consul
to route traffic to a specific pod.Routing to specific pods is much required in a cluster setup (like redis cluster) where we have multiple master / slave instances and the client requires the name of all those instances to interact with the cluster.