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

Gravity cluster with remote Kubernetes clusters #927

Open
CygnusHyoga opened this issue Feb 28, 2024 · 0 comments
Open

Gravity cluster with remote Kubernetes clusters #927

CygnusHyoga opened this issue Feb 28, 2024 · 0 comments

Comments

@CygnusHyoga
Copy link

CygnusHyoga commented Feb 28, 2024

In kubernetes it is normal to expose external services via LoadBalancer with External IP (for example metallb).

With gravity, when you want to create a cluster of, for example, 3 nodes in different kubernetes clusters, it has not been possible, at least for me.

Since if I do not define the INSTANCE_IP variable, it takes the IP of the pod. If I define the INSTANCE_IP variable with the external IP of the LoadBalancer service, the pod does not start, since it does not have that IP locally.

Would it be possible to define a variable such as EXTERNAL_IP or something similar to be able to identify with gravity instances that are not in the same kubernetes cluster? Thanks!

gravity1:

env:
  TZ: Europe/Madrid
  INSTANCE_IDENTIFIER: gravity1
  INSTANCE_IP: 192.168.66.254
  LISTEN_ONLY: "true"
  ADMIN_PASSWORD: xxx
  ADMIN_TOKEN: xxx
service:
  type: LoadBalancer
  ports:
    - targetPort: http
      protocol: TCP
      name: http
      port: 8008
    - targetPort: metrics
      protocol: TCP
      name: metrics
      port: 8009
    - targetPort: dns-tcp
      protocol: TCP
      name: dns-tcp
      port: 53
    - targetPort: dns-udp
      protocol: UDP
      name: dns-udp
      port: 53
    - targetPort: etcd
      protocol: TCP
      name: etcd
      port: 2380
  annotations:
      external-dns.alpha.kubernetes.io/hostname: gravity1.example.com
  loadBalancerIP: 192.168.66.254
  externalTrafficPolicy: Local
  sessionAffinity: None
  topologyKeys: []
#  - kubernetes.io/hostname
#  - topology.kubernetes.io/zone
#  - topology.kubernetes.io/region
#  - '*'

gravity2:

env:
  TZ: Europe/Madrid
  INSTANCE_IDENTIFIER: gravity2
  INSTANCE_IP: 192.168.66.206
  LISTEN_ONLY: "true"
  ADMIN_PASSWORD: xxx
  ADMIN_TOKEN: xxx
  ETCD_JOIN_CLUSTER: xxx,http://192.168.66.254:8008
service:
  type: LoadBalancer
  ports:
    - targetPort: http
      protocol: TCP
      name: http
      port: 8008
    - targetPort: metrics
      protocol: TCP
      name: metrics
      port: 8009
    - targetPort: dns-tcp
      protocol: TCP
      name: dns-tcp
      port: 53
    - targetPort: dns-udp
      protocol: UDP
      name: dns-udp
      port: 53
    - targetPort: etcd
      protocol: TCP
      name: etcd
      port: 2380
  annotations:
      external-dns.alpha.kubernetes.io/hostname: gravity2.example.com
  loadBalancerIP: 192.168.66.206
  externalTrafficPolicy: Local
  sessionAffinity: None
  topologyKeys: []
#  - kubernetes.io/hostname
#  - topology.kubernetes.io/zone
#  - topology.kubernetes.io/region
#  - '*'

gravity3:

env:
  TZ: Europe/Madrid
  INSTANCE_IDENTIFIER: gravity3
  INSTANCE_IP: 192.168.66.204
  LISTEN_ONLY: "true"
  ADMIN_PASSWORD: xxx
  ADMIN_TOKEN: xxx
  ETCD_JOIN_CLUSTER: xxx,http://192.168.66.254:8008
service:
  type: LoadBalancer
  ports:
    - targetPort: http
      protocol: TCP
      name: http
      port: 8008
    - targetPort: metrics
      protocol: TCP
      name: metrics
      port: 8009
    - targetPort: dns-tcp
      protocol: TCP
      name: dns-tcp
      port: 53
    - targetPort: dns-udp
      protocol: UDP
      name: dns-udp
      port: 53
    - targetPort: etcd
      protocol: TCP
      name: etcd
      port: 2380
  annotations:
      external-dns.alpha.kubernetes.io/hostname: gravity3.example.com
  loadBalancerIP: 192.168.66.204
  externalTrafficPolicy: Local
  sessionAffinity: None
  topologyKeys: []
#  - kubernetes.io/hostname
#  - topology.kubernetes.io/zone
#  - topology.kubernetes.io/region
#  - '*'

error example gravity1:

{"level":"warn","ts":1709153942.5891697,"logger":"instance","msg":"failed to start etcd","instance":"gravity1","version":"0.8.1-b50a27b6","instance":"gravity1","error":"listen tcp 192.168.66.254:2380: bind: cannot assign requested address"}
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

1 participant