Sign inSign up

evalsocket/oldmonk

By evalsocket

•Updated over 6 years ago

Image
0

1.2K

evalsocket/oldmonk repository overview

⁠Oldmonk - a QueueAutoScaler Operator for Kubernetes

Oldmonk Go Report Card License Gitpod Ready-to-Code Netlify Status

NOTE : Not production ready.

⁠Oldmonk

⁠What is Oldmonk

Oldmonk is all about turning day 2 operations into code! Not just that, it means you start thinking about day 2 on day 1. This is a dream come true for any Operations team! Oldmonk leverages the strength of automation and combines it with the power of queue based workflows.

⁠Purpose

The Oldmonk provides the ability to implement these queue based deployment for any resources in Kubernetes. oldmonk does not care if you have a plain Kubernetes, a cloud based Kubernetes (like GKE), or a complete PaaS platform based on Kubernetes (like OpenShift). Oldmonk also does not care how you want to structure your data, how many queue you want to use.

Oldmonk can handle straight-up (static) yaml files with the complete definition or create dynamic ones based on your templating engine. Oldmonk supports Helm Charts, but can easily be extended to support others.

These templates will be merged and processed with a set of environment-specific parameters to get a list of resource manifests. Then these manifest can be created/updated/deleted in Kubernetes.

⁠Docs

⁠Example

The configuration is described in the QueueAutoScaler CRD, here is an example:

apiVersion: oldmonk.evalsocket.in/v1
kind: QueueAutoScaler
metadata:
  name: lifecycle
spec:
  type : "BEANSTALKD"
  option :
    tube: 'default'
    key : 'current-jobs-ready'
  secrets : 'rabbitmq'
  maxPods : 6
  minPods : 1
  scaleDown :
    amount : 1
    threshold : 3
  scaleUp :
    amount : 1
    threshold : 4
  deployment : 'demo-app'
  autopilot : false
⁠Support
  • Rabbitmq
  • SQS
  • Beanstalk
  • Nats.io (Not Tested on scale)

⁠Prerequisites

⁠Get started in 5 Min

Install Operator sdk⁠, create a GKE cluster⁠ and connect cluster

cd ./demo
# Start beanstalkd container using docker-compose
docker-compose up -d
cd ../
make manager
make install
operator-sdk up local
# Run it and Open a new terminal
# Terminal  2
watch kubectl get deployment
# Terminal  3
watch kubectl get QueueAutoScaler
# Terminal  4
kubectl apply -f example/demo/demo.yaml #custom resource for demo we are only deploying nginx image but in real case it's your worker image
# Open http://127.0.0.1 and add job in default tube. cross the thresold of 4 and check terminal 1 log and also get deployment watch
# After verifing the autoscale delete all jobs from default tube and again watch terminal1 and deployment
kubectl delete -f example/demo/demo.yaml
# It will also delete the deployment with crd defination
## Examples / Demos

We've created several examples for you to test out Oldmonk. See [EXAMPLES](example/) for details.

## Monitoring

### Monitoring with Prometheus

[Prometheus](https://prometheus.io/) is an open-source systems monitoring and alerting toolkit.

Prometheus collects metrics from monitored targets by scraping metrics HTTP endpoints.

- [configuring-prometheus](https://prometheus.io/docs/introduction/first_steps/#configuring-prometheus)
- `scrape_configs` controls what resources Prometheus monitors.
- `kubernetes_sd_configs` Kubernetes SD configurations allow retrieving scrape targets. Please see [kubernetes_sd_configs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#endpoints) for details.
- Additionally, `relabel_configs` allow advanced modifications to any target and its labels before scraping.

By default, the metrics in Operator SDK are exposed on `0.0.0.0:8383/metrics`

For more information, see [Metrics in Operator SDK](https://github.com/operator-framework/operator-sdk/blob/v0.8.1/doc/user/metrics/README.md)

#### Usage:

scrape_configs:

  • job_name: 'kubernetes-service-endpoints' kubernetes_sd_configs:
    • role: endpoints relabel_configs:
      • source_labels: [__meta_kubernetes_namespace] action: keep regex: test-oldmonk-operator
You can find additional examples on their [GitHub page](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml).

#### Verify metrics port:
kubectl exec `POD-NAME` curl localhost:8383/metrics  -n `NAMESPACE`

(e.g. `kubectl exec oldmonk-operator-5b9b664cfc-6rdrh curl localhost:8383/metrics  -n oldmonk-operator`)

## Deploying to Kubernetes

#Replace image from Makefile make docker-build make docker-push make install


## Deploying CRD

kubectl apply -f config/beanstalk.yaml



### Vanilla Manifests

You have to first clone or download the repository contents. The kubernetes deployment and files are provided inside `deploy/crd/` folder.

## Help

**Got a question?**
File a GitHub [issue](https://github.com/evalsocket/oldmonk/issues), or send us an [email](mailto:[email protected]).

## Ref 

  - [Uswitch/sqs-autoscaler-controller](https://github.com/uswitch/sqs-autoscaler-controller)

Tag summary

Content type

Image

Digest

Size

51.4 MB

Last updated

over 6 years ago

docker pull evalsocket/oldmonk