From 6c10f99e2f1f99e791b1cafb3b45fc8198d3658c Mon Sep 17 00:00:00 2001
From: Pavan Gudiwada <25551553+pavangudiwada@users.noreply.github.com>
Date: Mon, 30 Dec 2024 12:13:47 +0530
Subject: [PATCH] Added instructions to install KRR in-cluster
---
README.md | 19 +++
docs/krr-in-cluster/krr-in-cluster-job.yaml | 122 ++++++++++++++++++++
2 files changed, 141 insertions(+)
create mode 100644 docs/krr-in-cluster/krr-in-cluster-job.yaml
diff --git a/README.md b/README.md
index 35ae0388..e5fbe112 100644
--- a/README.md
+++ b/README.md
@@ -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.
+
+ In-Cluster
+
+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
+
+```
+
+
+
From Source
diff --git a/docs/krr-in-cluster/krr-in-cluster-job.yaml b/docs/krr-in-cluster/krr-in-cluster-job.yaml
new file mode 100644
index 00000000..a73ffae2
--- /dev/null
+++ b/docs/krr-in-cluster/krr-in-cluster-job.yaml
@@ -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