3

I have a question regarding how to use go-micro with Kubernetes. AFAIK, Kubernetes already has kube-dns for service discovery and kube-proxy with Service abstraction to expose the pods.

Is it possible to use go-micro, but skip the kubernetes go-micro plugin to register itself to the Kubernetes API server?

Because I am not sure why it is necessary in first place. The fact is that kubelet will do that for us automatically (by livenessProbe and readinessProbe check, it can then determine pod is healthy or not), by only including the healthy pod to the endpoint of service.

I am asking the question because we're also using istio-proxy. We got micro-services errors whenever the pod is starting, due to istio-proxy is not yet ready to route the traffic (even the traffic to kube api, since it intercepts the egress traffic from our main container (it uses the go-micro Kubernetes plugin)).

2018/10/17 04:37:55 Can't create server! reason: Patch https://10.32.64.1:443/api/v1/namespaces/data-cdp/pods/cdp-booking-context-svc-stable-864645684b-xd2tb: dial tcp 10.32.64.1:443: connect: connection refused

It then causes the main container (go-micro kube plugin app) in the crashloopback multiple times, until the istio-proxy is ready. This is not a big issue, but it troubles my mind about the motivation behind the registration thing.

Rico
  • 58,485
  • 12
  • 111
  • 141
Agung Pratama
  • 3,666
  • 7
  • 36
  • 77
  • Did you get the answer for this? I also having same query for one of my service deployed on kubernetes infra. – Rajaneesh Singh Feb 16 '21 at 05:54
  • 1
    @RajaneeshSingh yup, basically go-micro does this to have client-side load balancing (for grpc especially). If you already use istio/linkerd as sidecar, then you won't need this behavior. but if you don't use istio/linkerd, to do client side load balancing, go-micro utilize the kube-api to store the service discovery information into the service/pod/deploy annotation (i forgot which) – Agung Pratama Feb 16 '21 at 09:39
  • Ok. Thanks Agung. In my scenario, we have 5-6 services mostly talking in AMQP & exposing REST for external world via istio ingress. We are thinking a new service in go-micro just because of pluggable arch (may need gRPC transport in future) and that service deals with k8s CRDs too. I didn;t get service discovery part needs to be registered while creating service instance in go-micro. Maybe I dont need it first place just because of k8s have discovery. What do you think? – Rajaneesh Singh Feb 17 '21 at 14:21
  • 1
    @RajaneeshSingh yes, i think you can ignore the kubernetes plugin, since you mention you already use istio (it can do grpc load balance). – Agung Pratama Mar 03 '21 at 08:17

0 Answers0