Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added instructions to install KRR in-cluster #387

Merged
merged 4 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
pavangudiwada marked this conversation as resolved.
Show resolved Hide resolved
* 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.
pavangudiwada marked this conversation as resolved.
Show resolved Hide resolved

Create all the necessary Kubernetes services using the following command to run KRR as a Kubernetes Job.
pavangudiwada marked this conversation as resolved.
Show resolved Hide resolved

```
kubectl apply -f https://raw.githubusercontent.com/robusta-dev/krr/refs/heads/main/docs/krr-in-cluster/krr-in-cluster-job.yaml

```
</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
Loading