Kubernetes Endpoint Controller is a program written in Golang that watches Kubernetes service annotations and creates Kubernetes endpoints based on those annotations. This program is meant to watch Cosmos blockchain nodes and determine their health and dynamically remove/add endpoint targets.
Controller will generate Endpoint with correct targets and port assignments based on annotations and service resource.
- HTTP health check on endpoints
- GRPC health check on endpoints
- Blockchain node falling behind
- Kubernetes cluster version 1.16 or later
kubectl
version 1.16 or later- Golang version 1.20 or later
- Docker version 20.10 or later
- Clone the repository:
git clone https://github.com/example/endpoint-controller.git
- Deploy the example
kubectl apply -f k8s
Controller uses environment variables to configure how it behaves
Variable | Description | Default |
---|---|---|
SYNC_PERIOD | Reconcile period in seconds | 30 |
BLOCK_MISS | Allowed missed blocks amount | 6 |
- Annotate a service with the required endpoints information
endpoint-controller/enable
is set totrue
endpoint-controller/targets
is a list of Endpoint target IPs
annotations:
endpoint-controller/enable: "true"
endpoint-controller/targets: "1.1.1.1,2.2.2.2,3.3.3.3"
- Check that the controller has created the endpoint
kubectl get endpoints my-service
go build -o bin/endpoint-controller .
or
docker build -t endpoint-controller:latest .