Skip to content

Commit

Permalink
Added instructions to install KRR in-cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
pavangudiwada committed Dec 30, 2024
1 parent 4c657aa commit 6c10f99
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,25 @@ us-central1-docker.pkg.dev/genuine-flight-317411/devel/krr:v1.8.3
We do **not** recommend installing KRR from source in airgapped environments due to the headache of installing Python dependencies. Use one of the above methods instead and contact us (via Slack, GitHub issues, or email) if you need assistance.
</details>

<details>
<summary>In-Cluster</summary>

Apart from running KRR as a CLI tool you can also run KRR inside your cluster. We suggest installing KRR via the Robusta platform. It gives you a free UI with some features like the following
* View application usage history graphs on which recommendations are based.
* Get application, namespace and cluster level recommendations.
* YAML configuration to apply the suggesetd recommendation and more

You can also run KRR in-cluster as a Kubernetss Job, if you don't want to view results easily in a UI.

Create all the necessary Kubernetes services using the following command to run KRR as a Kubernetes Job.

```
kubectl apply -f
```
</details>


<details>
<summary>From Source</summary>

Expand Down
122 changes: 122 additions & 0 deletions docs/krr-in-cluster/krr-in-cluster-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: krr-cluster-role
namespace: default
rules:
- apiGroups:
- ""
resources:
- configmaps
- daemonsets
- deployments
- namespaces
- pods
- replicasets
- replicationcontrollers
- services
verbs:
- get
- list
- watch

- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- list
- watch

- apiGroups:
- apps
resources:
- daemonsets
- deployments
- deployments/scale
- replicasets
- replicasets/scale
- statefulsets
verbs:
- get
- list
- watch

- apiGroups:
- extensions
resources:
- daemonsets
- deployments
- deployments/scale
- ingresses
- replicasets
- replicasets/scale
- replicationcontrollers/scale
verbs:
- get
- list
- watch
- apiGroups:
- batch
resources:
- cronjobs
- jobs
verbs:
- get
- list
- watch
- apiGroups:
- "autoscaling"
resources:
- horizontalpodautoscalers
verbs:
- get
- list
- watch

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: krr-service-account
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: krr-cluster-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: krr-cluster-role
subjects:
- kind: ServiceAccount
name: krr-service-account
namespace: default

---
apiVersion: batch/v1
kind: Job
metadata:
name: krr
namespace: default
spec:
template:
spec:
containers:
- command:
- /bin/sh
- -c
- "python krr.py simple --max-workers 3 --width 2048 "
image: robustadev/krr:v1.17.0
imagePullPolicy: Always
name: krr
resources:
limits:
memory: 2Gi
requests:
memory: 1Gi
restartPolicy: Never
serviceAccount: krr-service-account
serviceAccountName: krr-service-account

0 comments on commit 6c10f99

Please # to comment.