Skip to content

Commit

Permalink
Merge pull request #33 from ksctl/dev
Browse files Browse the repository at this point in the history
SYNC: move the latest dev to prod
  • Loading branch information
dipankardas011 authored Dec 3, 2024
2 parents 0c498ca + 9048d1e commit 9b3aca0
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* @dipankardas011
* @Horiodino
* @dipankardas011 @Horiodino
8 changes: 8 additions & 0 deletions content/en/blog/findings/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Our Findings
weight: 20
---

{{% pageinfo %}}
Ksctl documentation
{{% /pageinfo %}}
33 changes: 33 additions & 0 deletions content/en/blog/findings/cluster-autoscaling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: About K8s Cluster Autoscaling
date: 2024-01-23
description: >
Our Findings on how does the K8s Cluster Autoscaling works.
---


## Pod Auto-scaler

[https://cloud.google.com/kubernetes-engine/docs/concepts/horizontalpodautoscaler](https://cloud.google.com/kubernetes-engine/docs/concepts/horizontalpodautoscaler)
[https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale)

## Cluster Auto-Scaler

This blog might help [The Guide To Kubernetes Cluster Autoscaler by Example](https://www.kubecost.com/kubernetes-autoscaling/kubernetes-cluster-autoscaler/)

* Information from slack channel (*Kubernetes* **\#karpenter**, **\#auto-scaler**)
* How does **Karpenter** do it?
* Karpenter scales using pending pod pressure.
* There are two primary controllers for scale up and scale down
* Provisioning\_trigger controller, which will create the nodeclaims or initialize a scale request.[https://github.com/kubernetes-sigs/karpenter/blob/main/pkg/controllers/provisioning/controller.go\#L58](https://github.com/kubernetes-sigs/karpenter/blob/main/pkg/controllers/provisioning/controller.go#L58) , The provisioning trigger controller watches for pending pods, and in response to those pending pods it checks if it can schedule them on the existing nodes, if not, karpenter will solve scheduling by creating addtional nodeclaims. We have another set of controllers called the node lifecycle controllers that watch for these nodeclaims, and will launch vms for a given nodeclaim.
* Disruption Controller, which will tell karpenter to scale down the nodes. For scale down, we poll the cluster every 10 seconds via the disruption controller. [https://github.com/kubernetes-sigs/karpenter/blob/main/pkg/controllers/disruption/controller.go\#L126](https://github.com/kubernetes-sigs/karpenter/blob/main/pkg/controllers/disruption/controller.go#L126) We will iterate through all of our disruption methods and see if we can initiate some disruption action based on various factors.
* How **Cluster-auto-scaler** does it?
* for scale up, the CAS looks for pending pods. for scale down, it looks for under-utilized nodes (as calculated by resource usage).
* Note that resource usage is sum(resource\_requests) / node\_allocatable
* It has nothing to do with "real" utilization
* Basically CA's job is to make all the pods able to schedule using as few nodes as possible, all it looks at is scheduling
* You can use HPA/VPA to update pods based on actual resource usage and that will in turn trigger CA to add/remove nodes
* Also found a **paper on CO\_2 efficient karpenter**
* Andreasen, J. V. (2024). Carbon Efficient Karpenter: Optimizing Kubernetes Cluster Autoscaling for Carbon Efficiency \[Computer software\]. [https://github.com/JacobValdemar/carbon-efficient-karpenter-thesis](https://github.com/JacobValdemar/carbon-efficient-karpenter-thesis)


39 changes: 39 additions & 0 deletions content/en/docs/Concepts/how does core functionalities.md

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions content/en/docs/Contribution guidelines/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ description: How to contribute to the ksctl
Repository: ksctl/ksctl
{{% /pageinfo %}}

## Project structure

### pkg/

It contains the importable functionality of ksctl

* *Controllers* (as this will be the only way to interact with the ksctlcore
* *Utility* functions with *consts* and *errors*
* *Logger*
* *Types*

### internal/

It contains the *cloudProvider*, *K8sDistro*, *StorageDriver* specific implementations

### test/

It contains the e2e and e2e test helper code and also the mock test files



## Test out both All Mock and Unit tests and lints
```bash
Expand Down
6 changes: 6 additions & 0 deletions content/en/docs/architecture/api-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ Core Design Components

### High Available Cluster creation & deletion
![light mode](/img/ksctl-ha-sequence.svg)


### Architecture change to event based for much more capabilities

{{< alert title="Note:" >}}Currently This is WIP{{< /alert >}}
![img](/img/ksctl-cluster-automation.svg)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/FortAwesome/Font-Awesome v0.0.0-20240716171331-37eff7fa00de h1:JvHOfdSqvArF+7cffH9oWU8oLhn6YFYI60Pms8M/6tI=
github.com/FortAwesome/Font-Awesome v0.0.0-20240716171331-37eff7fa00de/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/google/docsy v0.11.0 h1:QnV40cc28QwS++kP9qINtrIv4hlASruhC/K3FqkHAmM=
github.com/google/docsy v0.11.0/go.mod h1:hGGW0OjNuG5ZbH5JRtALY3yvN8ybbEP/v2iaK4bwOUI=
github.com/google/docsy/dependencies v0.7.2 h1:+t5ufoADQAj4XneFphz4A+UU0ICAxmNaRHVWtMYXPSI=
github.com/google/docsy/dependencies v0.7.2/go.mod h1:gihhs5gmgeO+wuoay4FwOzob+jYJVyQbNaQOh788lD4=
github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
github.com/twbs/bootstrap v5.3.3+incompatible h1:goFoqinzdHfkeegpFP7pvhbd0g+A3O2hbU3XCjuNrEQ=
github.com/twbs/bootstrap v5.3.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
10 changes: 10 additions & 0 deletions static/img/ksctl-cluster-automation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9b3aca0

Please sign in to comment.