Skip to content

Commit

Permalink
Addition of Readme File for Helm Chart (#263)
Browse files Browse the repository at this point in the history
* ADDED README FILE

* Removed Extra nodepool yaml file, fixed spacing

* Added example field and comments in values.yaml

* Add comments in ReadMe File

* Modifed README file

* Added example in README file

* Added Example folder and modified README file
  • Loading branch information
hiteshmakol1 authored Jan 2, 2025
1 parent 905122a commit 44318da
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 69 deletions.
63 changes: 63 additions & 0 deletions charts/karpenter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

# Karpenter

Karpenter is an open-source Kubernetes cluster autoscaler built for efficiency and speed. This Helm chart installs Karpenter in your Kubernetes cluster and can be used to manage your node pools for dynamically scaling your infrastructure. This chart supports automated deployment of Karpenter, including the creation of NodePools, EC2NodeClasses, IAM roles, and other necessary resources.

To install Karpenter, use the following commands:

```shell
$ helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/
$ helm install karpenter ot-helm/karpenter --namespace kube-system
```

To upgrade the setup:

```shell
$ helm upgrade karpenter ot-helm/karpenter --install --namespace kube-system
```

To uninstall the chart:

```shell
$ helm delete karpenter --namespace kube-system
```

### Pre-Requisites

- Kubernetes => 1.18+
- Helm => 3.X
- Karpenter Operator => 0.1.0
- Open ID Connector (EKS) => https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html
- IAM Roles for Karpenter
- Add tags to subnets and security groups
- Update aws-auth ConfigMap

### Parameters

| **Name** | **Value** | **Description** |
|--------------------------------------------------------------------|:-------------------------------|------------------------------------------------|
| `karpenter.settings.clusterName` | `my-cluster` | The name of your Kubernetes cluster |
| `karpenter.serviceAccount.annotations.eks.amazonaws.com/role-arn` | Required | IAM role ARN for Karpenter controller |
| `karpenter.controller.resources.requests.cpu` | `1` | CPU request for Karpenter controller |
| `karpenter.controller.resources.requests.memory` | `1Gi` | Memory request for Karpenter controller |
| `karpenter.controller.resources.limits.cpu` | `1` | CPU limit for Karpenter controller |
| `karpenter.controller.resources.limits.memory` | `1Gi` | Memory limit for Karpenter controller |
| `nodePools` | [] | List of NodePools to be created |
| `nodePools.name` | default-nodepool | Name of the NodePool |
| `nodePools.labels` - If not required can be omitted | {} | Labels for the NodePool |
| `nodePools.annotations` - If not required can be omitted | {} | Annotations for the NodePool |
| `nodePools.requirements` - Can be empty [] | [] | Node requirements like CPU, memory, etc. |
| `nodePools.taints` - If not required can be omitted | [] | Taints for the NodePool |
| `nodePools.expireAfter` | 720h | Expiration duration for idle NodePools |
| `nodePools.limits.cpu` - Required Field | "1000m" | CPU limit for the NodePool |
| `nodePools.limits.memory`- If not required can be omitted | "2Gi" | Memory limit for the NodePool |
| `nodePools.disruption.consolidationPolicy` - Required Field | WhenEmptyOrUnderutilized | Consolidation policy for underutilized nodes |
| `nodePools.disruption.consolidateAfter` - Required Field | 1m | Time before consolidating underutilized nodes |


### Notes:

- Refer to Example Folder for a example values.yaml file
- Karpenter automatically creates and manages NodePools as part of the installation process.
- Make sure to configure the IAM roles required by Karpenter for it to interact with EC2 instances and manage resources along with all prerequisites.
- The chart will ensure the Karpenter controller and NodePools are deployed correctly with all required configurations.
67 changes: 67 additions & 0 deletions charts/karpenter/example/example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Custom values for chart
clusterName: test-cluster
awsPartition: aws
awsAccountId: 384961113000
karpenterVersion: 1.1.1

# Karpenter chart overrides
karpenter:
settings:
clusterName: test-cluster
serviceAccount:
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::384961113000:role/KarpenterControllerRole-test-cluster
controller:
resources:
requests:
cpu: "1"
memory: "1Gi"
limits:
cpu: "1"
memory: "1Gi"

nodePools:
- name: default
requirements:
- key: kubernetes.io/arch
operator: In
values:
- "amd64"
- key: kubernetes.io/os
operator: In
values:
- "linux"
- key: karpenter.sh/capacity-type
operator: In
values:
- "on-demand"
- key: karpenter.k8s.aws/instance-category
operator: In
values:
- "t"
- "m"
- "r"
- key: karpenter.k8s.aws/instance-generation
operator: Gt
values:
- "2"
nodeClass:
group: karpenter.k8s.aws
kind: EC2NodeClass
name: default # Name of the ec2nodeclass
expireAfter: 720h
limits:
cpu: "1000"
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
annotations:
example.com/owner: "my-team"
example.com/maintainer: "[email protected]"
# taints:
# - key: "example.com/special-taint"
# value: "special-value"
# effect: "NoExecute"
labels:
environment: production
team: "engineering"
68 changes: 0 additions & 68 deletions charts/karpenter/templates/node-pool.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion charts/karpenter/templates/nodePool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ spec:
disruption:
consolidationPolicy: {{ .disruption.consolidationPolicy | default "WhenEmptyOrUnderutilized" }}
consolidateAfter: {{ .disruption.consolidateAfter | default "1m" }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/karpenter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ karpenter:
# NodePools define groups of nodes with specific requirements
nodePools:
- name: default # Name of the node pool, used for identification
limits: # Required Field
cpu: "1000"
memory: "1000Gi"
disruption: # Required Field
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
requirements: # Node pool requirements for instance types and other properties
- key: kubernetes.io/arch
operator: In # Specifies the architecture for nodes
Expand Down

0 comments on commit 44318da

Please sign in to comment.