# Learning Environment

You can install Seldon Enterprise Platform on your local computer that is running a Kubernetes cluster using [kind](https://kubernetes.io/docs/tasks/tools/#kind).

{% hint style="info" %}
**Note**: These instructions guide you through installing the Seldon Enterprise Platform on a local Kubernetes cluster, focusing on ease of learning. Ensure your [kind](https://kubernetes.io/docs/tasks/tools/#kind) cluster is running on hardware with at least 32GB of RAM. For installing Seldon Enterprise Platform in a production environment, see[ cluster requirements](/seldon-enterprise-platform/production-environment.md#cluster-requirements).
{% endhint %}

To install Seldon Enterprise Platform and Seldon Core 2 ecosystem components:

1. [Create namespaces](#creating-namespaces)
2. [Install Seldon Core 2](#installing-seldon-core-2)
3. [Install Seldon Enterprise Platform](#installing-seldon-enterprise-platform-on-a-kubernetes-cluster)

## Prerequisites

* Install a Kubernetes cluster that is running version 1.23 or later.
* Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), the Kubernetes command-line tool.
* Install [Helm](https://helm.sh/docs/intro/install/), the package manager for Kubernetes.
* Seldon Enterprise Platform license key. You can reach out to Seldon [support team](https://www.seldon.io/contact) to get a trial license key.

## Creating Namespaces

* Create a namespace to contain the main components of Seldon. For example, create the namespace `seldon-system`:

  ```bash
  kubectl create ns seldon-system || echo "Namespace seldon-system already exists"
  ```
* Create a namespace to contain Kafka. For example, create the namespace `kafka`:

  ```bash
  kubectl create ns kafka || echo "Namespace kafka already exists"
  ```
* Create a namespace to contain the components related to request logging. For example, create the namespace `seldon-logs`:

  ```bash
  kubectl create ns seldon-logs || echo "Namespace seldon-logs already exists"
  ```
* Create a namespace that is accessible by Seldon Enterprise Platform, Seldon Core 2 runtime that defines core components required in each model, and Seldon Core 2 pre-configured servers to host the models. For example, create the namespace `seldon`:

  ```bash
  kubectl create ns seldon || echo "Namespace seldon already exists"
  ```
* Annotate the namespace `seldon` so that it is accessible in the Seldon Enterprise Platform UI:

  ```bash
  kubectl label ns seldon seldon.restricted=false --overwrite=true
  ```

## Installing Seldon Core 2

1. Add and update the Helm charts `seldon-charts` to the repository.

   ```bash
   helm repo add seldon-charts https://seldonio.github.io/helm-charts/
   helm repo update seldon-charts
   ```
2. Install Custom resource definitions for Seldon Core 2.

   ```bash
   helm upgrade seldon-core-v2-crds seldon-charts/seldon-core-v2-crds \
   --version 2.8.5 \
   --namespace default \
   --install 
   ```
3. Create a YAML file to specify the initial configuration for Seldon Core 2 Operator. For example, create the `components-values.yaml` file. Use your preferred text editor to create and save the file with the following content:

   ```yaml
   controller:
     clusterwide: true

   dataflow:
     resources:
       cpu: 500m

   envoy:
     service:
       type: ClusterIP

   kafka:
     bootstrap: seldon-kafka-bootstrap.seldon-mesh:9092
     topics:
       numPartitions: 4

   opentelemetry:
     enable: false

   scheduler:
     service:
       type: ClusterIP

   serverConfig:
     mlserver:
       resources:
         cpu: 1
         memory: 2Gi

     triton:
       resources:
         cpu: 1
         memory: 2Gi

   serviceGRPCPrefix: "http2-"
   ```
4. Change to the directory that contains the `components-values.yaml` file and then install Seldon Core 2 operator in the namespace `seldon-system`.

   ```bash
    helm upgrade seldon-core-v2-components seldon-charts/seldon-core-v2-setup \
    --version 2.8.5 \
    -f components-values.yaml \
    --namespace seldon-system \
    --install
   ```
5. Install Seldon Core 2 runtimes in the namespace `seldon`.

   ```bash
   helm upgrade seldon-core-v2-runtime seldon-charts/seldon-core-v2-runtime \
   --version 2.8.5 \
   --namespace seldon \
   --install
   ```
6. Create a YAML file to specify the initial configuration for Seldon Core 2 servers. For example, create the `servers-values.yaml` file. Use your preferred text editor to create and save the file with the following content:

   ```yaml
   mlserver:
    replicas: 1

   triton:
     replicas: 1
   ```
7. Change to the directory that contains the `servers-values.yaml` file and then install Seldon Core 2 servers in the namespace `seldon`.

   ```bash
    helm upgrade seldon-core-v2-servers seldon-charts/seldon-core-v2-servers \
    --version 2.8.5 \
    -f servers-values.yaml \
    --namespace seldon \
    --install
   ```

## Installating Seldon Enterprise Platform on a Kubernetes cluster

{% hint style="info" %}
**Note**: These configurations do not enable features such as Model Catalog, Monitoring and Alerting, Request logging, GitOps and others.
{% endhint %}

1. Install Knative Eventing core components in the Kubernetes cluster.

   ```
   kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.12.2/eventing-crds.yaml
   kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.12.2/eventing-core.yaml
   kubectl get crds | grep eventing.knative.dev
   ```
2. Create a YAML file to specify the initial configuration. For example, create the `install-values.yaml` file. Use your preferred text editor to create and save the file with the following content:

   ```yaml
   image:
     image: seldonio/seldon-deploy-server:2.4.0

   rbac:
    opa:
      enabled:  false
    nsLabelsAuth:
      enabled:  true

   virtualService:
     create: false

   requestLogger:
     kafka_consumer:
       enabled: true
       bootstrap_servers: seldon-kafka-bootstrap.kafka.svc.cluster.local:9092
       group_id: metronome
       auto_offset_reset: earliest

   gitops:
     argocd:
       enabled: false

   enableAppAuth: false

   elasticsearch:
     basicAuth: false

   seldon:
     enabled: false
     knativeEnabled: false

   seldonCoreV2:
     enabled: true
   ```
3. Change to the directory that contains the `install-values.yaml` file and then install Seldon Enterprise Platform in the namespace `seldon-system`.

   ```bash
   helm install seldon-enterprise seldon-charts/seldon-deploy --namespace seldon-system  -f install-values.yaml --version 2.4.0
   ```

   When the installation is successful, you should see this:

   ```bash
   NAME: seldon-enterprise
   LAST DEPLOYED: Fri Jul 26 16:43:44 2024
   NAMESPACE: seldon-system
   STATUS: deployed
   REVISION: 1
   NOTES:
   1. Get the application URL by running these commands:
     export POD_NAME=$(kubectl get pods --namespace seldon-system -l "app.kubernetes.io/name=seldon-deploy,app.kubernetes.io/instance=seldon-enterprise" -o jsonpath="{.items[0].metadata.name}")
     echo "Visit http://127.0.0.1:8000/seldon-deploy/ to use your application"
     kubectl port-forward $POD_NAME 8000:8000 --namespace seldon-system
   ```
4. Check the status of the installation `seldon-enterprise-seldon-deploy`.

   ```bash
   kubectl rollout status deployment/seldon-enterprise-seldon-deploy -n seldon-system
   ```

   When the installation is complete you should see this:

   ```bash
   deployment "seldon-enterprise-seldon-deploy" successfully rolled out
   ```
5. Get the Pod that is running Seldon Enterprise Platform in the cluster and save it as `$POD_NAME`.

   ```bash
   export POD_NAME=$(kubectl get pods --namespace seldon-system -l "app.kubernetes.io/name=seldon-deploy,app.kubernetes.io/instance=seldon-enterprise" -o jsonpath="{.items[0].metadata.name}")
   ```
6. You can use port-forwarding to access your application.

   ```bash
   kubectl port-forward $POD_NAME 8000:8000 --namespace seldon-system
   ```
7. Open your browser and navigate to `http://127.0.0.1:8000/seldon-deploy/` to access Seldon Enterprise Platform with Seldon Core 2 resources, operator, runtimes and servers.

   ![Seldon Enterprise Platform](/files/5pfUSGLF2U0rouV8HSOa)
8. Apply the trial license and click **Activate**.

{% hint style="info" %}
**Note**: After confirming that port-forwarding to the application is configured, you can open your browser and navigate to `http://127.0.0.1:8000/seldon-deploy/` to access the Seldon Enterprise Platform deployed in the Kubernetes cluster at any time.
{% endhint %}

## Next

To explore the features of Seldon Enterprise Platform, you need to complete the installation of other components in the following order:

1. [Integrating with Kafka](/seldon-enterprise-platform/learning-environment/self-hosted-kafka.md)
2. [Installing Istio](/seldon-enterprise-platform/production-environment/ingress-controller/istio.md)
3. [Installing PostgreSQL](/seldon-enterprise-platform/learning-environment/self-hosted-postgresql.md)
4. [Installing Prometheus](/seldon-enterprise-platform/production-environment/observability-alerting/observability.md)

## Additional Resources

* [Seldon Core Documentation](https://docs.seldon.ai/seldon-core-2)
* [Seldon Enterprise Documentation](https://docs.seldon.ai/seldon-enterprise-platform)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.seldon.ai/seldon-enterprise-platform/learning-environment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
