HELASEID - Headless Automatic Service Discovery © by G. Ginanjar
HELASEID (Headless Automatic Service Discovery) is a lightweight, containerized Python-based solution for dynamically updating Kubernetes endpoints for headless services. It continuously monitors the health of service instances and updates the corresponding Kubernetes Endpoints object accordingly.
The name HELASEID is inspired by two powerful supervillains:
- Hela (Marvel) : Beautiful yet resourceful.
- Darkseid (DC) : Resilient and strategic.
This tool embodies their strengths�efficiency, adaptability, and robustness.
- Automated Health Checks: Monitors service health via TCP probes.
- Kubernetes Endpoint Management: Dynamically updates the
Endpointsobject. - Microsoft Teams Integration: Sends alerts on failures.
- Lightweight & Efficient: Runs with minimal CPU and memory footprint.
- Configurable via Kubernetes ConfigMap & Secrets: Environment-based configuration.
HELASEID follows a simple yet effective architecture:
- Loads configuration from Kubernetes
ConfigMap. - Performs health checks on configured service IPs.
- Updates Kubernetes
Endpointsto reflect live instances. - Sends notifications to Microsoft Teams when failures occur.
- Kubernetes cluster (tested on v1.24+)
kubectlaccess with permissions to modifyEndpoints- Microsoft Teams Webhook (optional for alerts)
- Deploy Kubernetes Manifests:
git clone git@bitbucket.org:mandiri-sekuritas/helaseid.git
cd helaseid
kubectl apply -f manifests/- Verify Deployment:
kubectl get pods -n datastream- Check Logs:
kubectl logs -f deployment/datastream-helaseid-dev -n datastreamHELASEID uses a ConfigMap (datastream-helaseid-dev) to define environment variables:
apiVersion: v1
kind: ConfigMap
metadata:
name: datastream-helaseid-dev
namespace: datastream
data:
config.env: |
IPS=("10.188.2.3" "10.188.2.4" "10.188.2.5")
PORT=9092
MAX_RETRY=10
INTERVAL=0.01
LOG_LEVEL=INFO
NAMESPACE=datastream
SERVICE_NAME=datastream-redpanda-api-devIPS- List of service instance IPs to monitor.PORT- Service port to check health.MAX_RETRY- Maximum retries before marking unhealthy.INTERVAL- Interval between health checks.LOG_LEVEL- Logging verbosity (DEBUG,INFO,ERROR).NAMESPACE- Kubernetes namespace.SERVICE_NAME- Kubernetes service name.
To enable Teams notifications, add a Kubernetes Secret with a webhook URL:
apiVersion: v1
kind: Secret
metadata:
name: datastream-hslc-dev
type: Opaque
data:
TEAMS_WEBHOOK_URL: <Base64-encoded-webhook-URL>To test outside Kubernetes, build and run the container:
docker build -t helaseid:latest .
docker run --rm -e IPS="10.188.2.3 10.188.2.4" -e PORT=9092 helaseid- Support for multi-cluster service discovery.
- Dynamic IP retrieval via Kubernetes API.
- Metrics export for Prometheus integration.
- Support multi-zone/multi-region discovery with dynamic preferences and master pinning.
