Giter Site home page Giter Site logo

k8s-autoscaling-jobs-public's Introduction

k8s-autoscaling-jobs

Requirement: This repo consists of an api-server and background job, which need to run on a horizonantally scalable k8s cluster. The api-server takes an incoming request and creates a pod of the background job which uses a single CPU core for "some" processing. We need to ensure that we have a highly available API for accepting the incoming request. We also need to scale up and scale down the cluster depending on the number of jobs we have pending/processing at any given moment.

Creating cluster

$ cd eks-infra
$ terraform plan
$ terraform apply

To configure local kubectl with the cluster created with above commands.

$ aws eks --region $(terraform output -raw region) update-kubeconfig --name $(terraform output -raw cluster_name)

To create the monitoring stack

helm install prometheus-community/kube-prometheus-stack \
--create-namespace --namespace prometheus \
--generate-name \
--set prometheus.service.type=LoadBalancer \
--set grafana.service.type=LoadBalancer \

Create secret for pulling docker images from github registry.

kubectl create secret docker-registry docker-registry-creds --docker-server=https://ghcr.io --docker-username=<username> --docker-password=<token> --docker-email=<email>

Install pod autoscaler.

$ cd k8s
$ jinja2 --format json autoscaler.yaml ../eks-infra/terraform.tfstate | kubectl apply -f -

To schedule pods

$ curl -X POST http://$(kubectl get svc --field-selector metadata.name="kubernetes-node-server-replicaset-service" --no-headers | awk '{ print $4 }')/api/job

Destroy the created cluster.

$ cd eks-infra
$ terraform destroy

k8s-autoscaling-jobs-public's People

Contributors

tachyonflare avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.