bakayolo / proxless

HTTP Proxy - Enable Serverless in your Kubernetes Cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proxless

Reduce your kubernetes cost by making all your deployments on-demand with Proxless.
Deploy Proxless in front of your services and it will scale down the associated deployments when they are not requested and scale them back up when they are.

No need a CRD, no need a huge stack, the proxless deployment is the only thing u need.

Openshift friendly

Disclaimer

Proxless is provided in alpha mode.
Using it on your production cluster is done at your own risks.

In 1 minute

Proxless is a simple proxy written in golang and consume a minimum of resources.
You don't need to run anything other than proxless deployment and it will not modify your existing resources.

Proxless looks for the services in the cluster that have a specific annotation and scale up and down their associated deployment.

Note: in order for proxless to be fully high available, all the replicas need to sync up the lastUsed time for each request between each other. In order to achieve that, a non persistent standalone redis is needed. This configuration is fully optional and provided in the helm chart.

Check the documentation for more information.

Namespace scoped or cluster wide

  • Namespace scoped
    • env var NAMESPACE_SCOPED must be true - proxless will only look for services within its namespace.
    • a Role is required.
  • Cluster wide
    • env var NAMESPACE_SCOPED is `false - proxless will look for any services in the cluster.
    • a ClusterRole is required. See here.

Quickstart

Requirements

Tested with K8S 1.14+

Deploy Proxless

Kubectl

$ kubectl apply -f deploy/kubectl/proxless.yaml

This will deploy a proxless scoped to your namespace.
Use the helm chart below to make it cluster wide.

Helm

You can use our helm chart for a more configurable approach.
With the chart, you will be able to configure the High Availability and choose if you want proxless to be installed cluster wide or not.

Deploy Example

Deploy the example.
It's a basic nginx pod doing a proxy_pass to a hello-world api pod.
By default, the 2 pods are scaled down.

Kubectl

$ kubectl apply -f example/kubectl/example.yaml

Port-forward to your proxless deployment.

$ kubectl port-forward svc/proxless 8080:80
Forwarding from 127.0.0.1:8080 -> 80
Forwarding from [::1]:8080 -> 80

Test it

$ curl -H "Host: www.example.io" localhost:8080
{"message":"Hello"}

$ curl -H "Host: example.io" localhost:8080
{"message":"Hello"}

More information here

Development Setup

Duplicate the .env.example file into a .env file and modify the variables accordingly

Then run

$ go run cmd/main.go

Blog and Presentation

Meta

Benjamin APPREDERISSE - @benhazard42

Distributed under the MIT license. See LICENSE for more information.

Contributing

  1. Fork it (https://github.com/bappr/kube-proxless/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

About

HTTP Proxy - Enable Serverless in your Kubernetes Cluster

License:MIT License


Languages

Language:Go 97.5%Language:Shell 1.2%Language:Dockerfile 0.7%Language:HTML 0.7%