tczekajlo / kube-consul-register

a tool to register Kubernetes PODs as Consul Services
Apache License 2.0
105 stars 50 forks source link

Services registered to other namespaces even when "-watch-namespace" is set. #20

Closed killcity closed 5 years ago

killcity commented 6 years ago

I've got two namespaces, both with pods running consul agent and kube-consul-register. kube-consul-register is set to use single and pods for mode and source. If I launch the pods in test namespace, everything looks great. When I launch in prod namespace, I start seeing services from test being advertised to prod.

Both deployments have their own ConfigMaps and Manifests. Each manifest points consul-agent to a different upstream cluster.

Here is the bit I set in the manifest for test.

...
args:
          - "-watch-namespace=test"
          - "-logtostderr=true"
          - "-configmap=test/kube-consul-register"

I'm not sure if I'm doing something wrong or whether this is a bug.

Cheers

tczekajlo commented 6 years ago

Please try set pod_label_selector option in ConfigMap.

killcity commented 6 years ago

That worked wonderfully. Thanks! Is the functionality for watching specific namespaces indeed not functional? Thanks again for creating this tool, as it's a lifesaver.

tczekajlo commented 6 years ago

There is a small bug, I'll try to fix it in free time but for now, we can use pod_label__selector as a workaround.

Thanks, I'm glad to hear that my tool is useful for you :)

killcity commented 6 years ago

Thanks!