Gravity cluster with remote Kubernetes clusters
CygnusHyoga opened this issue · 1 comments
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"}