> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streamnative.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy StreamNative Platform on native Kubernetes clusters

After creating a Kubernetes cluster, you can deploy StreamNative Platform.

## Prerequisites

* [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl): v1.16 or higher
* [Helm](https://helm.sh/docs/intro/install/): v3.0 or higher
* Kubernetes server v1.16 or higher
* cert-manager operator: v1.0.0 or higher
* Vault operator: v1.5.0 or higher
* Function Mesh operator: v0.1.7 (recommended)
* Pulsar operator: v0.9.0 (recommended)

## Install StreamNative Platform

This section describes how to install StreamNative Platform in online mode.

### Install StreamNative Platform using original images within operators

<Note title="Note">
  By default, the `helm upgrade --install` command installs the latest operators. If you want to install a specific operator, use the `--version` option to specify the operator image version. For details about the version relationship between operator images and StreamNative Platform 1.9.0, see [StreamNative Platform version matrix](id:sn-version-matrix).
</Note>

This section describes how to install StreamNative Platform using original images within the operators.

1. Install the StreamNative repositories.

   ```bash theme={null}
   helm repo add streamnative https://charts.streamnative.io
   helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com
   helm repo add jetstack https://charts.jetstack.io
   helm repo add function-mesh http://charts.functionmesh.io/
   helm repo update
   ```

2. Create a Kubernetes namespace.

   ```bash theme={null}
   kubectl create namespace <k8s_namespace>
   ```

3. Install the Vault operator.

   The Vault operator creates and maintains highly-available Vault clusters on Kubernetes, allowing you to easily deploy and manage Vault clusters for your applications.

   ```bash theme={null}
   helm upgrade --install vault-operator banzaicloud-stable/vault-operator -n <k8s_namespace>
   ```

4. Install the cert-manager.

   The cert-manager is a native [Kubernetes](https://kubernetes.io/) certificate management controller. It helps issue certificates from [HashiCorp Vault](https://www.vaultproject.io/). The cert-manager ensures that certificates are valid and up-to-date, and attempts to renew certificates at a configured time before expiry.

   The cert-manager requires a number of CRD resources to be installed into your cluster as part of installation. To automatically install and manage the CRDs as part of your Helm release, you must add the `--set installCRDs=true` flag to your Helm installation command.

   ```bash theme={null}
   helm upgrade --install cert-manager jetstack/cert-manager -n <k8s_namespace> --set installCRDs=true
   ```

5. Install the Pulsar operator.

   ```bash theme={null}
   helm upgrade --install pulsar-operator streamnative/pulsar-operator -n <k8s_namespace>
   ```

6. Install the Function Mesh operator.

   [Function Mesh](https://functionmesh.io/docs/) is a serverless and purpose-built framework for orchestrating multiple [Pulsar Functions](https://pulsar.apache.org/docs/functions-overview/) and [Pulsar IO connectors](https://pulsar.apache.org/docs/io-overview/) for stream processing applications.

   ```bash theme={null}
   helm upgrade --install function-mesh-operator function-mesh/function-mesh-operator -n <k8s_namespace>
   ```

### Install StreamNative Platform using customized images

This section describes how to install StreamNative Platform using customized images.

1. Install the StreamNative repositories.

   ```bash theme={null}
   helm repo add streamnative https://charts.streamnative.io
   helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com
   helm repo add jetstack https://charts.jetstack.io
   helm repo add function-mesh http://charts.functionmesh.io/
   helm repo update
   ```

2. Create a Kubernetes namespace.

   ```bash theme={null}
   kubectl create namespace <k8s_namespace>
   ```

3. Install the Vault operator.

   The Vault operator creates and maintains highly-available Vault clusters on Kubernetes, allowing you to easily deploy and manage Vault clusters for your applications.

   a. Inspect the chart used for installing the Vault operator and save the contents of `values.yaml` file as a local YAML file.

   This example saves the `values.yaml` file as `value_vault-operator.yaml` file.

   ```bash theme={null}
   helm inspect values banzaicloud-stable/vault-operator  > value_vault-operator.yaml
   ```

   b. Update the image setting in the `value_vault-operator.yaml` file.

   You can specify the location and version of the image using the `image.bankVaultsRepository` and `image.tag` parameters. This example specifies the Vault image published to the [Docker Hub](https://hub.docker.com/) by Banzai Cloud.

   ```yaml theme={null}
   image:
     bankVaultsRepository: banzaicloud/bank-vaults
     repository: banzaicloud/vault-operator
     # tag: ""
     pullPolicy: IfNotPresent
     imagePullSecrets: [] # global.imagePullSecrets is also supported
   ```

   c. Install the Vault operator with the customized image.

   ```bash theme={null}
   helm upgrade --install -f value_vault-operator.yaml vault-operator banzaicloud-stable/vault-operator -n <k8s_namespace>
   ```

4. Install the cert-manager.

   The cert-manager is a native [Kubernetes](https://kubernetes.io/) certificate management controller. It helps issue certificates from [HashiCorp Vault](https://www.vaultproject.io/). The cert-manager ensures that certificates are valid and up-to-date, and attempts to renew certificates at a configured time before expiry.

   The cert-manager requires a number of CRD resources to be installed into your cluster as part of installation. To automatically install and manage the CRDs as part of your Helm release, you must add the `--set installCRDs=true` flag to your Helm installation command.

   a. Inspect the chart used for installing the cert-manager and save the contents of `values.yaml` file as a local YAML file.

   This example saves the `values.yaml` file as `value_cert-manager.yaml` file.

   ```bash theme={null}
   helm inspect values jetstack/cert-manager  > value_cert-manager.yaml
   ```

   b. Update the image settings in the `value_cert-manager.yaml` file.

   You can specify the location and version of images using the `image.repository` and `image.tag` parameters. StreamNative mirrors the cert-manager images to the [Docker Hub](https://hub.docker.com/). This example specifies the cert-manager images published to the [Docker Hub](https://hub.docker.com/) by StreamNative.

   ```yaml theme={null}
   image:
     repository: quay.io/jetstack/cert-manager-controller
     tag: v1.4.0
     pullPolicy: IfNotPresent
     image:
       repository: quay.io/jetstack/cert-manager-webhook
       tag: v1.4.0
       pullPolicy: IfNotPresent
     image:
       repository: quay.io/jetstack/cert-manager-cainjector
       tag: v1.4.0
       pullPolicy: IfNotPresent
   ```

   c. Install the cert-manager with the customized images.

   ```bash theme={null}
   helm upgrade --install -f value_cert-manager.yaml  cert-manager jetstack/cert-manager -n <k8s_namespace> --set installCRDs=true
   ```

5. Install the Pulsar operator.

   a. Inspect the chart used for installing the Pulsar operator and save the contents of `values.yaml` file as a local YAML file.

   This example saves the `values.yaml` file as `value_pulsar-operator.yaml` file.

   ```bash theme={null}
   helm inspect values streamnative/pulsar-operator  > value_pulsar-operator.yaml
   ```

   b. Update the image setting in the `value_pulsar-operator.yaml` file.

   You can specify the location and version of images using the `images.repository` and `images.tag` parameters. This example specifies the images for ZooKeeper, BookKeeper, and Pulsar published to the [Docker Hub](https://hub.docker.com/) by StreamNative.

   ```yaml theme={null}
   images:
     zookeeper:
       repository: docker.cloudsmith.io/streamnative/operators/zookeeper-operator
       tag: v0.9.0
       pullPolicy: IfNotPresent
     bookkeeper:
       repository: docker.cloudsmith.io/streamnative/operators/bookkeeper-operator
       tag: v0.9.0
       pullPolicy: IfNotPresent
     pulsar:
       repository: docker.cloudsmith.io/streamnative/operators/pulsar-operator
       tag: v0.9.0
       pullPolicy: IfNotPresent
   ```

   c. Install the Pulsar operator with the customized YAML file.

   ```bash theme={null}
   helm upgrade --install pulsar-operator -f value_pulsar-operator.yaml streamnative/pulsar-operator -n <k8s_namespace>
   ```

6. Install the Function Mesh operator.

   [Function Mesh](https://functionmesh.io/docs/) is a serverless and purpose-built framework for orchestrating multiple [Pulsar Functions](https://pulsar.apache.org/docs/functions-overview/) and [Pulsar IO connectors](https://pulsar.apache.org/docs/io-overview/) for stream processing applications.

   a. Inspect the chart used for installing the Function Mesh operator and save the contents of `values.yaml` file as a local YAML file.

   This example saves the `values.yaml` file as `value_function-mesh-operator.yaml` file.

   ```bash theme={null}
   helm inspect values function-mesh/function-mesh-operator  > value_function-mesh-operator.yaml
   ```

   b. Update the image setting in the `value_function-mesh-operator.yaml` file.

   You can specify the location and version of the image using the `operatorImage` parameter. This example specifies the FunctionMesh image published to the [Docker Hub](https://hub.docker.com/) by StreamNative.

   ```yaml theme={null}
   # operatorImage is Function Mesh Operator image
   operatorImage: streamnative/function-mesh:v0.1.6-rc1
   imagePullPolicy: IfNotPresent
   imagePullSecrets: []
   ```

   c. Install the Function Mesh operator with the customized YAML file.

   ```bash theme={null}
   helm upgrade --install function-mesh -f value_function-mesh-operator.yaml function-mesh/function-mesh-operator -n <k8s_namespace>
   ```

## Deploy Pulsar clusters

To deploy a Pulsar cluster, follow these steps.

1. Create a Kubernetes namespace for your Pulsar cluster.

   ```bash theme={null}
   kubectl create namespace <k8s_namespace>
   ```

2. Define a Pulsar cluster configuration file.

3. Apply the YAML file to create a Pulsar cluster.

   ```bash theme={null}
   helm install -f /path/to/pulsar/file.yaml <release_name> streamnative/sn-platform --set initialize=true -n <k8s_namespace>
   ```

4. (Optional) Update your Pulsar cluster.

   You can update your Pulsar cluster by updating the YAML file and then execute the `helm upgrade` command.

   ```bash theme={null}
   helm upgrade -f /path/to/pulsar/file.yaml <release_name> streamnative/sn-platform -n <k8s_namespace>
   ```

## Uninstallation

This section describes how to uninstall Pulsar cluster and StreamNative Platform.

* Execute the following command to uninstall the Pulsar cluster.

  ```bash theme={null}
  helm uninstall <release_name> -n <k8s_namespace>
  ```

* Execute the following commands to uninstall StreamNative Platform.

  ```bash theme={null}
  helm uninstall vault-operator -n <k8s_namespace>
  helm uninstall cert-manager -n <k8s_namespace>
  helm uninstall pulsar-operator -n <k8s_namespace>
  helm uninstall function-mesh-operator -n <k8s_namespace>
  ```

<Note title="Note">
  If you want to delete the PVCs or the Secret, you need to delete them together. Otherwise, you will fail to reinstall the StreamNative Platform. It is recommended that you exercise caution when deleting the PVCs or the Secret because some of your significant information cannot be restored once you have deleted them.
</Note>
