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

Question configuration example for clustering Kubernetes/Redis locker? #344

Open
pboers1988 opened this issue Jan 10, 2024 · 3 comments
Open
Labels
documentation Improvements or additions to documentation

Comments

@pboers1988
Copy link

pboers1988 commented Jan 10, 2024

In the documentation I can only find details about how to setup consul as a clustering locker. I was wondering if there are some working examples of how to setup Kubernetes as locker in the clustering configuration. I see there is code in the repository to support it, however there are no good examples in the tests or in the docs about how to configure it. The same can be said about redis. Does anyone have some pointers towards how to setup these lockers? Or is consul still the only locker that "really works"?

I would prefer to be able to use Kubernetes or redis as they are already part of the infrastructure that we are running. I could obviously try to reverse engineer, but maybe someone has a working example!
Thanks!

@pboers1988 pboers1988 changed the title Question configuration example for clustering Kubernetes/redis locker? Question configuration example for clustering Kubernetes/Redis locker? Jan 10, 2024
@hellt
Copy link
Collaborator

hellt commented Jan 10, 2024

I think there are no docs specifically about the k8s locker option.
Maybe you can get what you need from the comments in the PR that added this capability karimra/gnmic#560 (comment)

(or maybe wait till @karimra comes back online)

@karimra karimra added the documentation Improvements or additions to documentation label Jan 10, 2024
@karimra
Copy link
Collaborator

karimra commented Jan 10, 2024

There are no dedicated doc pages for those two lockers, that needs to be added.

Meanwhile here is a short explanation of the config options with their defaults:

  • kubernetes locker
clustering:
  # 
  locker:
    type: k8s
    # namespace where the leases will be created
    namespace: default
    # lease-duration, defines the duration of a lease
    lease-duration: 10s
    # defines how often leases are renewed.
    # If the set values is eq or higher than the `lease-duration`, lease-duration/2 applies.
    # Otherwise the set value applies.
    renew-period: 
    # defines a simple backoff duration in case of errors
    retry-timer: 2s
    # enable extra logging
    debug: false
  • redis locker:
clustering:
  # 
  locker:
    type: redis
    # single address or a seed list of host:port addresses of cluster/sentinel nodes.
    # if more than one address is set, the locker uses a redis cluster client.
    servers:
      - 
    # specifies a master name to create a sentinel backed redis FailoverClient
    master-name:
    # a password that should match `requirepass` in redis server config (Redis 5.0 or lower)
    # or the user password (Redis 6.0 or higher)
    password:
    # sets the expiration time of a Redis mutex
    lease-duration: 10s
    # defines the frequency of Redis mutex expiration refresh.
    # If the set values is eq or higher than the `lease-duration`, lease-duration/2 applies.
    # Otherwise the set value applies.
    renew-period: 
    # defines a simple backoff duration in case of errors.
    retry-timer: 2s
    # poll timer of registered Redis services.
    poll-timer: 10s
    # enable extra logging
    debug: false

When writing this I realized that the redis locker could use some updates to add some extra config options.

@pboers1988
Copy link
Author

pboers1988 commented Jan 15, 2024

Update 2
Found the missing RBAC in karimras issue karimra/gnmic#560 (comment)

Update
I'm mistaken, I'm still overlooking a setting. Getting the following error:

│ 2024/01/15 12:41:56.662043 /home/runner/work/gnmic/gnmic/pkg/lockers/k8s_locker/k8s_registration.go:49: [k8s_locker] watch ended with error: unknown (get endpoints)

Any ideas?


Thanks! I reverse-engineered the interface through the go files last week :) and now I'm attempting to lock down the service account. I've narrowed down the what the account needs by feeding it privledges until it stops erroring. Am I missing anything else?

kind: Role
metadata:
  annotations:
    meta.helm.sh/release-name: gnmic
  labels:
    app.kubernetes.io/instance: gnmic
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: gnmic
    app.kubernetes.io/version: 0.34.3
  name: gnmic-role
rules:
- apiGroups:
  - coordination.k8s.io
  resources:
  - leases
  verbs:
  - create
  - get
  - list
  - update
  - delete
- apiGroups:
  - ""
  resources:
  - endpoints
  verbs:
   - get
   - list  

Thanks!

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

No branches or pull requests

3 participants