# Helm

#### WARNING
Helm doesn’t support managing CustomResourceDefinition resources ([#5871](https://github.com/helm/helm/issues/5871), [#7735](https://github.com/helm/helm/issues/7735)).
Helm only creates CRDs on the first install and never updates them, while keeping the CRDs up to date (with any update) is absolutely essential.
In order to update them, users have to do it manually every time.

In this example we will install Scylla stack on Kubernetes. This includes the following components:

- Scylla Operator
- Scylla Manager
- Scylla

We will use Minikube K8s cluster, but this could be any K8s cluster supported by the Scylla Operator.

## Prerequisites

- Kubernetes 1.16+
- Helm 3+

## TL;DR

```default
helm repo add scylla https://scylla-operator-charts.storage.googleapis.com/stable
helm repo update
kubectl apply -f examples/common/cert-manager.yaml 
helm install scylla-operator scylla/scylla-operator --create-namespace --namespace scylla-operator
helm install scylla-manager scylla/scylla-manager --create-namespace --namespace scylla-manager
helm install scylla scylla/scylla --create-namespace --namespace scylla
```

## Deploy Cert Manager

This step is optional if you want to use your own certificate.
If you don’t have one, make sure to not disable autogeneration using Scylla Operator Helm Chart.

First deploy Cert Manager, you can either follow [upsteam instructions](https://cert-manager.io/docs/installation/kubernetes/) or use following command:

```console
kubectl apply -f examples/common/cert-manager.yaml
```

Once it’s deployed, wait until all Cert Manager pods will enter into Running state:

```console
kubectl wait -n cert-manager --for=condition=ready pod -l app=cert-manager --timeout=60s
```

## Helm Chart repository

To install Scylla Helm Chart repository execute the following commands:

```default
helm repo add scylla https://scylla-operator-charts.storage.googleapis.com/stable
helm repo update
```

Then you can search through repository, it should contain at least three Helm charts:

```default
helm search repo scylla
NAME                   CHART VERSION   APP VERSION     DESCRIPTION                                       
scylla/scylla          1.0.1           v1.0.1          Scylla is a close-to-the-hardware rewrite of Ca...
scylla/scylla-manager  1.0.1           v1.0.1          Scylla Manager automates database operations.     
scylla/scylla-operator 1.0.1           v1.0.1          Scylla Operator is a Kubernetes Operator for ma...
```

All these charts should be installable without any need of customizing (defaults are provided).
Although Helm is used for this particular reason, so lets customize them a bit.

## Scylla Operator Chart

This chart is very simple, most interesting customizable fields are `image`, `resources` and `webhook`.
All others can be looked up in Chart source in Scylla Operator repository.

### image

Image allows to define which Scylla Operator image will be used. By default it downloads the image from main
Docker Hub repository, using version defined in Helm Chart.
You can also change `pullPolicy` if default one does not
fullfill your needs. In [Kubernetes documentation](https://kubernetes.io/docs/concepts/containers/images/) you
can read more about different pull policies.

Image URL will be composed based on these fields in follwing pattern:
`repository/scylla-operator:tag`

```yaml
image:
  repository: scylladb
  pullPolicy: IfNotPresent
  tag: ""
```

### resources

You can customize how much resources will be allocated for Operator pods via `resource` field:

```yaml
resources:
  limits:
    cpu: 100m
    memory: 128Mi
  requests:
    cpu: 100m
    memory: 32Mi
```

To read more about resource specification, follow [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/).

### webhook

Webhook field allows to decide whether you want to use autogenerated self-signed certificate using Cert Manager or
whether you want to provide your own certificate.

`createSelfSignedCertificate` specifies whether a self-signed certificate should be created using Cert Manager
`certificateSecretName`: name of a secret containing custom certificate.

```yaml
webhook:
  createSelfSignedCertificate: true
  certificateSecretName: ""
```

### Customization

You can customize all these fields and others by providing file containing desired values.
Please refer to the [values.yaml](https://raw.githubusercontent.com/scylladb/scylla-operator/v1.18/helm/scylla-operator/values.yaml) file in Scylla Operator repository for all available fields.

You can copy the default `values.yaml` file and modify it to your needs.

### Installation

To deploy Scylla Operator using default values execute the following command:

```default
helm install scylla-operator scylla/scylla-operator --create-namespace --namespace scylla-operator
```

To deploy Scylla Operator using customized values file (as described in the [Customization]() section), execute the following command:

```default
helm install scylla-operator scylla/scylla-operator --values <path-to-values-file> --create-namespace --namespace scylla-operator
```

## Scylla Helm Chart

Scylla Chart allows to customize and deploy Scylla cluster.
By default Scylla Helm charts deploys working Scylla cluster, but of course we can customize it.

### Customization

Versions of images used in the cluster can be set via `scyllaImage` and `agentImage`:

```yaml
scyllaImage:
  repository: scylladb/scylla
  tag: 2025.1.5

agentImage:
  repository: scylladb/scylla-manager-agent
  tag: 3.5.1
```

A minimal Scylla cluster can be expressed as:

```yaml
datacenter: us-east-1
racks:
- name: us-east-1b
  members: 2
  storage:
    capacity: 5G
  resources:
    limits:
      cpu: 1
      memory: 1Gi
    requests:
      cpu: 1
      memory: 1Gi
```

Above cluster will use 2025.1.5 Scylla, 3.5.1 Scylla Manager Agent sidecar and will have a single rack having 2 nodes.
Each node will have a single CPU and 1 GiB of memory.

For other customizable fields, please refer to chart source ([values.yaml](https://raw.githubusercontent.com/scylladb/scylla-operator/v1.18/helm/scylla/values.yaml)) in Scylla Operator repository
and [ScyllaCluster CRD](https://operator.docs.scylladb.com/v1.18/api-reference/groups/scylla.scylladb.com/scyllaclusters.md).
The CRD’s `spec.rack` and Helm chart `rack` should have the same fields.

You can copy the default `values.yaml` file and modify it to your needs.

### Installation

To deploy Scylla cluster using default values execute the following command:

```default
helm install scylla scylla/scylla --create-namespace --namespace scylla
```

To deploy Scylla cluster using customzied values file execute the following command:

```default
helm install scylla scylla/scylla --values <path-to-values-file> --create-namespace --namespace scylla
```

Scylla Operator will provision this cluster on your K8s environment.

## Scylla Manager Helm Chart

Scylla Manager Chart allows to customize and deploy Scylla Manager in K8s environment.
Besides Scylla Manager, it deploys an additional Scylla cluster for the Manager’s needs.

To read more about Scylla Manager see [Manager guide](https://operator.docs.scylladb.com/v1.18/architecture/manager.md).

### Scylla Manager

To set version of used Scylla Manager you can use `image` field:

```yaml
image:
  repository: scylladb
  pullPolicy: IfNotPresent
  tag: 3.5.1
```

To control how many resources are allocated for Scylla Manager use `resource` field:

```yaml
resources:
  limits:
    cpu: 500m
    memory: 500Mi
  requests:
    cpu: 500m
    memory: 500Mi
```

### Scylla

To customize internal Scylla instance dedicated to Scylla Manager, see guide above customizing Scylla Helm Chart.
It’s definition should land as a `scylla` field.

All others customizable fields can be looked up in Chart source ([values.yaml](https://raw.githubusercontent.com/scylladb/scylla-operator/v1.18/helm/scylla-manager/values.yaml)) in Scylla Operator repository.
You can copy the default `values.yaml` file and modify it to your needs.

### Installation

To deploy Scylla Manager using default values execute the following command:

```default
helm install scylla-manager scylla/scylla-manager --create-namespace --namespace scylla-manager
```

To deploy Scylla Manager using customized values file execute the following command:

```default
helm install scylla-manager scylla/scylla-manager --values <path-to-values-file> --create-namespace --namespace scylla-manager
```

## Results

Scylla need some time to bootstrap all nodes, but after some time you should be ready to roll. It was simple isn’t it?
You can validate if everything was set up correctly by looking at the all resources created in used namespaces.

Scylla Operator:

```shell
$ kubectl -n scylla-operator get all

NAME                                   READY   STATUS    RESTARTS   AGE
pod/scylla-operator-5dbcb54f5c-vjm4m   1/1     Running   0          51s
pod/scylla-operator-5dbcb54f5c-wfjbw   1/1     Running   0          51s

NAME                              TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE
service/scylla-operator-webhook   ClusterIP   10.105.207.130   <none>        443/TCP   51s

NAME                              READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/scylla-operator   2/2     2            2           51s

NAME                                         DESIRED   CURRENT   READY   AGE
replicaset.apps/scylla-operator-5dbcb54f5c   2         2         2       51s

```

Operator is running!

Scylla Manager:

```shell
$ kubectl -n scylla-manager get all 

NAME                                             READY   STATUS    RESTARTS   AGE
pod/scylla-manager-669db64dd-bcm4v               1/1     Running   0          89s

NAME                            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
service/scylla-manager          ClusterIP   10.105.231.53   <none>        80/TCP,5090/TCP     89s
service/scylla-manager-client   ClusterIP   None            <none>        9180/TCP,5090/TCP   89s

NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/scylla-manager              1/1     1            1           89s

NAME                                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/scylla-manager-669db64dd               1         1         1       89s


```

Good to go, ready to serve!

Scylla itself:

```shell
$ kubectl -n scylla get all        

NAME                                READY   STATUS    RESTARTS   AGE
pod/scylla-us-east-1-us-east-1b-0   2/2     Running   0          5m58s
pod/scylla-us-east-1-us-east-1b-1   2/2     Running   0          4m29s

NAME                                    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                                                           AGE
service/scylla-client                   ClusterIP   None           <none>        9180/TCP,5090/TCP                                                 5m59s
service/scylla-us-east-1-us-east-1b-0   ClusterIP   10.43.149.92   <none>        7000/TCP,7001/TCP,7199/TCP,10001/TCP,9042/TCP,9142/TCP,9160/TCP   5m58s
service/scylla-us-east-1-us-east-1b-1   ClusterIP   10.43.49.0     <none>        7000/TCP,7001/TCP,7199/TCP,10001/TCP,9042/TCP,9142/TCP,9160/TCP   4m29s

NAME                                           READY   AGE
statefulset.apps/scylla-us-east-1-us-east-1b   2/2     5m59s
```

Two running nodes, exactly what we were asking for.

## Monitoring

To spin up a Prometheus monitoring refer to [monitoring guide](https://operator.docs.scylladb.com/v1.18/resources/scylladbmonitorings.md).

Helm charts can create ServiceMonitors needed to observe Scylla Manager and Scylla.
Both of these Helm Charts allow specifying whether you want to create a ServiceMonitor:

```yaml
serviceMonitor:
  create: false
```

Change `create` to `true` in your `values.yaml` file and update your current deployment using:

```shell
helm upgrade --install scylla --namespace scylla scylla/scylla -f <path-to-values-file> 
```

Helm should notice the difference, install the ServiceMonitor, and then Prometheus will be able to scrape metrics.

## Upgrade

Please refer to the [upgrade guide](https://operator.docs.scylladb.com/v1.18/installation/upgrade.md#upgrade-via-helm) to learn how to upgrade your Helm installations.

## Cleanup

To remove these applications you can simply uninstall them using Helm CLI:

```shell
helm uninstall scylla -n scylla
helm uninstall scylla-manager -n scylla-manager
helm uninstall scylla-operator -n scylla-operator
```
