Proxless

Reduce cost in your k8s cluster

Who am I

- Benjamin APPREDERISSE 🇫🇷

- Lead Engineering @KintoHub

 

- FullStack Backend Engineer

- ~5 years XP with Kubernetes

 

Worth mentioning:

- I ❤️ 🧀

Who are we

"All-in-one platform to combine and deploy your backend services, websites, cronjobs, databases and everything your app needs in one place."

What we need

User

- Only pay for what they are using

- Don't pay for idle resources

 

Us

- Cheaper free tier

- Reducing load on infra

- Reducing debugging time

- Don't overload the controllers

Knative

- https://knative.dev/

- Created by Google
- OSS Project

 

 

- 3 (now 2) primary components:

-> Build - create image from your source code - deprecated in favor of Tekton Pipeline
-> Eventing - subscription, delivery and management of events

-> Serving - automatic scaling of containers through a request-driven model for serving workloads based on demand.

Knative Serving

- Disclaimer: Tested 2018 / mid 2019

 

- Custom Resource Definition needed - override your existing deployments and services

 

- No Helm Chart and no easy way to configure the install (now Kubernetes operator in alpha mode)

 

- Lack of docs or docs outdated

Knative Serving

- Only support Istio (now also support Ambassador, Contour, Gloo, Kong, Kourier in alpha or beta mode)

 

- Big stack -> (activator, autoscaler, autoscaler-hpa, controller, istio-webhook, networking-istio, webhook)

 

- Break Network Policies -> 1 global ingress gateway

 

- Can't configure dynamically multiple domain names

- https://github.com/bappr/proxless

- https://proxless.io

 

- OSS Project

- Goland

- Act as a proxy in front of your services

- No CRD

- No big stack - single kubernetes deployment (for non HA)

- Multi-tenant - namespace scoped or cluster wide

- Easy to use, easy to debug

- Integrate with your existing deployments

- Mode HA (requires redis non persistent)

Enter Proxless

How to

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

apiVersion: v1
kind: Service
metadata:
  name: example
  annotations:
    proxless/domains: "example.io,www.example.io"
    proxless/deployment: "example"
    proxless/ttl-seconds: "120"
    proxless/readiness-timeout-seconds: "30"
spec:
  selector:
    app: example
  ports:
    - protocol: "TCP"
      port: 80
      targetPort: 80

{DemoTime}

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello
spec:
  selector:
    matchLabels:
      app: hello
      tier: backend
      track: stable
  replicas: 0
  template:
    metadata:
      labels:
        app: hello
        tier: backend
        track: stable
    spec:
      containers:
        - name: hello
          image: "gcr.io/google-samples/hello-go-gke:1.0"
          ports:
            - name: http
              containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: hello
  annotations:
    proxless/deployment: "hello"
spec:
  selector:
    app: hello
    tier: backend
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
spec:
  selector:
    matchLabels:
      app: hello
      tier: frontend
      track: stable
  replicas: 0
  template:
    metadata:
      labels:
        app: hello
        tier: frontend
        track: stable
    spec:
      containers:
        - name: nginx
          image: "bappr/proxless-nginx-example"
          env:
            - name: BACKEND_HOST
              value: "http://hello-proxless"
---
apiVersion: v1
kind: Service
metadata:
  name: frontend
  annotations:
    proxless/domains: "example.io,www.example.io"
    proxless/deployment: "frontend"
    proxless/ttl-seconds: "120"
    proxless/readiness-timeout-seconds: "30"
spec:
  selector:
    app: hello
    tier: frontend
  ports:
    - protocol: "TCP"
      port: 80
      targetPort: 80

What's next

- Deploy on KintoHub

 

- Websockets

- GRPC

 

- More configs (Start time / Stop time)


- Better integration with Kubernetes

Made with Slides.com