Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peer pods autodiscovery within kubernetes cluster #48

Open
udhos opened this issue Sep 1, 2022 · 1 comment
Open

Peer pods autodiscovery within kubernetes cluster #48

udhos opened this issue Sep 1, 2022 · 1 comment

Comments

@udhos
Copy link
Contributor

udhos commented Sep 1, 2022

Hi,

I am experimenting with a simple standalone package to automatically keep pod peers up-to-date within a kubernetes cluster:

https://github.com/udhos/kubegroup

Recipe currently looks like this:

groupcachePort := ":5000"

// 1. get my groupcache URL
myURL, errURL = kubegroup.FindMyURL(groupcachePort)

// 2. spawn groupcache peering server
pool := groupcache.NewHTTPPool(myURL)
server := &http.Server{Addr: groupcachePort, Handler: pool}
go func() {
    log.Printf("groupcache server: listening on %s", groupcachePort)
    err := server.ListenAndServe()
    log.Printf("groupcache server: exited: %v", err)
}()

// 3. spawn peering autodiscovery
go kubegroup.UpdatePeers(pool, groupcachePort)

// 4. create groupcache groups, etc: groupOne := groupcache.NewGroup()

Does it look reasonable!?

@thrawn01
Copy link
Contributor

It does look reasonable! We did something similar with https://github.com/mailgun/gubernator/blob/master/kubernetes.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants