csrfr

csrfr

Distributed Services with Go: accessing the service outside the pods (Beta-4 pg.223)

Once deployed, I am not able to access the service outside the prolog pods. I can run the client successfully and access the service from a client running on one of the proglog pods.

However, I am not able to access the service from the following locations:

  1. Laptop: The client connection hangs and then returns connection error while dialing dial tcp: lookup proglog-0.proglog.mysvcs.svc.cluster.local: no such host. I am dialing using the EXTERNAL-IP address of proglog-0 from k8s in the client (This address works when used from a proglog pod).

  2. From a pod in the k8s cluster but not a proglog pod. It prints the following error repeatedly ERROR: 2020/10/31 18:59:29 [core] subconn returned from pick is not *acBalancerWrapper. Also, the acBalancerWrapper error appears when running the client from a proglog pod (where it usually works) from time to time.

Anyone faced this before, ideas?
At the moment I’m looking into GetServers returning the K8s DNS names (e.g. proglog-0.proglog.default.svc.cluster.local:8400 rather than the EXTERNAL-IP of the pods.

Marked As Solved

travisjeffery

travisjeffery

Author of Distributed Services with Go

Yeah we should return ErrNoSubConnAvailable like so:

func (p *Picker) Pick(info balancer.PickInfo) (
	balancer.PickResult, error) {
	p.mu.RLock()
	defer p.mu.RUnlock()
	var result balancer.PickResult
	if strings.Contains(info.FullMethodName, "Produce") ||
		len(p.followers) == 0 {
		result.SubConn = p.leader
	} else if strings.Contains(info.FullMethodName, "Consume") {
		result.SubConn = p.nextFollower()
	}
	if result.SubConn == nil {
		return result, balancer.ErrNoSubConnAvailable
	}
	return result, nil
}

so gRPC will block the RPC until a new picker is available with available sub connections.

Also Liked

travisjeffery

travisjeffery

Author of Distributed Services with Go

For 1. did you port-forward the pod/service to expose it outside k8s’ network? That’s what the $ kubectl port-forward pod/proglog-0 8400 8400 command in the book is for.

  1. Could be because leader election is still underway so a nil subconn is returned for it.
travisjeffery

travisjeffery

Author of Distributed Services with Go

For 2. I think the error handling should be improved. I’m looking into it.

Where Next?

Popular Pragmatic Bookshelf topics Top

telemachus
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks” While running the smoke tests in Chapter 2, I get these...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
brian-m-ops
#book-python-testing-with-pytest-second-edition Hi. Thanks for writing the book. I am just learning so this might just of been an issue ...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
brunogirin
When I run the coverage example to report on missing lines, I get: pytest --cov=cards --report=term-missing ch7 ERROR: usage: pytest [op...
New
Charles
In general, the book isn’t yet updated for Phoenix version 1.6. On page 18 of the book, the authors indicate that an auto generated of ro...
New
brunogirin
When installing Cards as an editable package, I get the following error: ERROR: File “setup.py” not found. Directory cannot be installe...
New
oaklandgit
Hi, I completed chapter 6 but am getting the following error when running: thread 'main' panicked at 'Failed to load texture: IoError(O...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New
jwandekoken
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below: d...
New

Other popular topics Top

AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
New
New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New

Sub Categories: