charon-relay

by Obol Labs

Helm chartv0.9.1App 1.11.3Apache-2.0Verified publisher

Charon is an open-source Ethereum Distributed validator middleware written in golang. This chart deploys a libp2p relay server.

About this chart

Charon Relay

Charon is an open-source Ethereum Distributed validator middleware written in golang. This chart deploys a libp2p relay server.

Homepage: https://obol.tech/

Source Code

Values

KeyTypeDefaultDescription
affinityobject{}Affinity for pod assignment # ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity # # Example: # affinity: # podAntiAffinity: # requiredDuringSchedulingIgnoredDuringExecution: # - labelSelector: # matchExpressions: # - key: app.kubernetes.io/name # operator: In # values: # - charon # topologyKey: kubernetes.io/hostname #
centralMonitoringobject{"enabled":false,"existingSecret":{"key":"token","name":""},"image":"prom/prometheus:v2.55.1","promEndpoint":"https://vm.monitoring.gcp.obol.tech/write","token":""}Central Monitoring
centralMonitoring.enabledboolfalseSpecifies whether central monitoring should be enabled
centralMonitoring.existingSecretobject{"key":"token","name":""}Use an existing Kubernetes Secret for the monitoring token instead of a plain value
centralMonitoring.existingSecret.keystring"token"Key in the secret containing the token
centralMonitoring.existingSecret.namestring""Name of the existing secret
centralMonitoring.imagestring"prom/prometheus:v2.55.1"Prometheus image (used in agent mode for scraping and remote write)
centralMonitoring.promEndpointstring"https://vm.monitoring.gcp.obol.tech/write"https endpoint to obol central prometheus
centralMonitoring.tokenstring""The authentication token to the central prometheus (ignored if existingSecret is set)
clusterSizeint3The number of nodes in the relay cluster
config.autoP2pKeystring"true"Automatically create a p2pkey (secp256k1 private key used for p2p authentication and ENR) if none found in data directory. (default true)
config.httpAddressstring"0.0.0.0:3640"Listening address (ip and port) for the relay http server serving runtime ENR. (default "127.0.0.1:3640")
config.logFormatstring"json"Log format; console, logfmt or json (default "console")
config.logLevelstring"debug"Log level; debug, info, warn or error (default "info")
config.lokiobject{"existingSecret":{"key":"url","name":""}}Use an existing Kubernetes Secret for the Loki URL instead of plain lokiAddresses value
config.loki.existingSecret.keystring"url"Key in the secret containing the Loki URL
config.loki.existingSecret.namestring""Name of the existing secret containing the Loki URL
config.lokiAddressesstring""Enables sending of logfmt structured logs to these Loki log aggregation server addresses. This is in addition to normal stderr logs.
config.lokiServicestring""Service label sent with logs to Loki.
config.monitoringAddressstring"0.0.0.0:3620"Listening address (ip and port) for the monitoring API (prometheus, pprof). (default "127.0.0.1:3620")
config.p2pAllowliststring""Comma-separated list of CIDR subnets for allowing only certain peer connections. Example: 192.168.0.0/16 would permit connections to peers on your local network only. The default is to accept all connections.
config.p2pDenyliststring""Comma-separated list of CIDR subnets for disallowing certain peer connections. Example: 192.168.0.0/16 would disallow connections to peers on your local network. The default is to accept all connections.
config.p2pDisableReuseportstring""Disables TCP port reuse for outgoing libp2p connections.
config.p2pMaxConnectionsstring"16384"Libp2p maximum number of peers that can connect to this relay. (default 16384)
config.p2pMaxReservatoinsstring"512"Updates max circuit reservations per peer (each valid for 30min) (default 512)
config.p2pRelayLogLevelstring"debug"
config.p2pRelaysstring""Comma-separated list of libp2p relay URLs or multiaddrs. (default [https://0.relay.obol.tech/enr])
config.p2pTcpAddressstring"0.0.0.0:3610"Comma-separated list of listening TCP addresses (ip and port) for libP2P traffic. Empty default doesn't bind to local port therefore only supports outgoing connections.
config.p2pUdpAddressstring""Listening UDP address (ip and port) for QUIC libP2P traffic. When set, enables QUIC transport and the relay advertises a /udp//quic-v1 multiaddr. Requires a separate UDP LoadBalancer service exposing this port.
containerSecurityContextobjectSee values.yamlThe security context for containers
fullnameOverridestring""Provide a name to substitute for the full names of resources
httpRoute.annotationsobject{}
httpRoute.backendRef.namestring"haproxy"
httpRoute.backendRef.portint80
httpRoute.enabledboolfalse
httpRoute.filterslist[]
httpRoute.hostnameslist[]
httpRoute.matcheslist[]
httpRoute.parentRefslist[]
imageobject{"pullPolicy":"IfNotPresent","repository":"obolnetwork/charon","tag":"v1.11.3"}Charon image ropsitory, pull policy, and tag version
imagePullSecretslist[]Credentials to fetch images from private registry # ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
initContainerImagestring"alpine/kubectl:1.35.2"Init container image
livenessProbeobject{"enabled":true,"httpGet":{"path":"/livez"},"initialDelaySeconds":10,"periodSeconds":5}Configure liveness probes # ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
nameOverridestring""Provide a name in place of lighthouse for app: labels
nodeSelectorobject{}Node labels for pod assignment # ref: https://kubernetes.io/docs/user-guide/node-selection/
podAnnotationsobject{}Pod annotations
podDisruptionBudgetobject{"enabled":true,"maxUnavailable":1,"minAvailable":0}Enable pod disruption budget # ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb
priorityClassNamestring""Used to assign priority to pods # ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
rbacobject{"clusterRules":[{"apiGroups":[""],"resources":["nodes"],"verbs":["get","list","watch"]}],"enabled":true,"name":"","rules":[{"apiGroups":[""],"resources":["services"],"verbs":["get","list","watch"]}]}RBAC configuration. # ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/
rbac.clusterRuleslist[{"apiGroups":[""],"resources":["nodes"],"verbs":["get","list","watch"]}]Required ClusterRole rules
rbac.clusterRules[0]object{"apiGroups":[""],"resources":["nodes"],"verbs":["get","list","watch"]}Required to obtain the nodes external IP
rbac.enabledbooltrueSpecifies whether RBAC resources are to be created
rbac.namestring""The name of the cluster role to use. If not set and create is true, a name is generated using the fullname template
rbac.ruleslist[{"apiGroups":[""],"resources":["services"],"verbs":["get","list","watch"]}]Required Role rules
rbac.rules[0]object{"apiGroups":[""],"resources":["services"],"verbs":["get","list","watch"]}Required to get information about the serices nodePort.
readinessProbeobject{"enabled":true,"httpGet":{"path":"/readyz"},"initialDelaySeconds":5,"periodSeconds":3}Configure readiness probes # ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
resourcesobject{}Pod resources limits and requests
securityContextobjectSee values.yamlThe security context for pods
serviceobject{"ports":{"http":{"name":"relay-http","port":3640,"protocol":"TCP","targetPort":3640},"monitoring":{"name":"monitoring","port":3620,"protocol":"TCP","targetPort":3620},"p2pTcp":{"name":"p2p-tcp","port":3610,"protocol":"TCP","targetPort":3610}},"type":"LoadBalancer","udpAnnotations":{}}Charon service ports
service.udpAnnotationsobject{}Annotations for UDP LoadBalancer services (created when config.p2pUdpAddress is set)
serviceAccountobject{"annotations":{},"enabled":true,"name":""}Service account # ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.enabledbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use. If not set and create is true, a name is generated using the default template
serviceMonitorobject{"annotations":{},"enabled":false,"interval":"1m","labels":{},"namespace":"","path":"/metrics","relabelings":[],"scheme":"http","scrapeTimeout":"30s","tlsConfig":{}}Prometheus Service Monitor # ref: https://github.com/coreos/prometheus-operator
serviceMonitor.annotationsobject{}Additional ServiceMonitor annotations
serviceMonitor.enabledboolfalseIf true, a ServiceMonitor CRD is created for a prometheus operator. https://github.com/coreos/prometheus-operator
serviceMonitor.intervalstring"1m"ServiceMonitor scrape interval
serviceMonitor.labelsobject{}Additional ServiceMonitor labels
serviceMonitor.namespacestring""Alternative namespace for ServiceMonitor
serviceMonitor.pathstring"/metrics"Path to scrape
serviceMonitor.relabelingslist[]ServiceMonitor relabelings
serviceMonitor.schemestring"http"ServiceMonitor scheme
serviceMonitor.scrapeTimeoutstring"30s"ServiceMonitor scrape timeout
serviceMonitor.tlsConfigobject{}ServiceMonitor TLS configuration
storageClassNamestring"standard"Persistent volume storage class (default "standard")
tolerationsobject{}Tolerations for pod assignment # ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
updateStrategystring"RollingUpdate"Allows you to configure and disable automated rolling updates for containers, labels, resource request/limits, and annotations for the Pods in a StatefulSet.

Prerequisites

  • An operational Kubernetes GKE cluster with these add-ons, nginx-ingress, external-dns, and cert-manager with let'sEncrypt issuer
  • A valid public domain name (i.e obol.tech)

Deployment Architecture

  • HAProxy, to establish a header-base sticky session between the charon DV nodes and the relay server
  • Charon nodes, running in relay mode and deployed as statefulsets

How to use this chart

Add Obol's Helm Charts

helm repo add obol https://obolnetwork.github.io/helm-charts
helm repo update

Install the Chart

To install the chart with the release name charon-relay

helm upgrade --install charon-relay obol/charon-relay \
  --set='clusterSize=3' \
  --create-namespace \
  --namespace charon-relay

Cluster health check

Ensure the relay node is up and healthy

kubectl -n charon-relay get pods

Deploy HAProxy

Retrieve the relay nodes public IPs then update the backend relays section in the haproxy values.yaml

kubectl -n charon-relay get svc --no-headers=true -o "custom-columns=NAME:.metadata.name,IP:.status.loadBalancer.ingress[*].ip" | awk '/relay/{print $2}'

Create custom values.yaml to override haproxy configuration with the relay nodes public IPs

replicaCount: 3
service:
  type: ClusterIP
  externalTrafficPolicy: Local
configuration: |-
  global
      log stdout format raw local0
      maxconn 1024
  defaults
      log global
      timeout client 60s
      timeout connect 60s
      timeout server 60s
  frontend fe_main
      bind :8080
      default_backend relays
  backend relays
      mode http
      balance hdr(Charon-Cluster)
      server charon-relay-0 {charon-relay-0-IP}:3640 check inter 10s fall 12 rise 2
      server charon-relay-1 {charon-relay-1-IP}:3640 check inter 10s fall 12 rise 2
      server charon-relay-2 {charon-relay-2-IP}:3640 check inter 10s fall 12 rise 2
ingress:
  enabled: true
  ingressClassName: nginx
  annotations:
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    cert-manager.io/cluster-issuer: "letsencrypt"
    nginx.ingress.kubernetes.io/app-root: /enr
    cert-manager.io/issue-temporary-certificate: "true"
    acme.cert-manager.io/http01-edit-in-place: "true"
  tls: true

Deploy the haproxy helm chart

helm upgrade --install haproxy bitnami/haproxy \
  --set='ingress.hostname=charon-relay.example.com' \
  --create-namespace \
  --namespace charon-relay \
  -f values.yaml

Uninstall the Chart

To uninstall and delete the charon-relay and haproxy charts

helm uninstall charon-relay haproxy

The command removes all the Kubernetes components associated with the chart and deletes the releases.

Deploy charon-relay with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has charon-relay on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcharon-relay is pinned at v0.9.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply