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

Add Cluster Setup documentation #4973

Merged
merged 12 commits into from
Aug 23, 2021
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
### Documentation

- Documents steps for component creation ([#4982](https://github.com/openshift/odo/pull/4982))
- Add Cluster setup documentation ([#4973](https://github.com/openshift/odo/pull/4973))

## 2.2.4

### Feature/Enhancements
Expand Down
122 changes: 122 additions & 0 deletions website/docs/getting-started/cluster-setup/kubernetes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
title: Kubernetes
sidebar_position: 1
---

# Setting up a Kubernetes cluster
*Note that this guide is only helpful in setting up a development environment; this setup is not recommended for a production environment.*

## Prerequisites
* You have a Kubernetes cluster setup, this could for example be a [minikube](https://minikube.sigs.k8s.io/docs/start/) cluster.
* You have admin privileges to the cluster, since the Operator installation is only possible with an admin user.

## Enabling Ingress
To access an application externally, you will create _URLs_ using odo, which are implemented on a Kubernetes cluster by Ingress resources; installing an Ingress controller helps in using this feature on a Kubernetes cluster.

valaparthvi marked this conversation as resolved.
Show resolved Hide resolved
**Minikube:** To install an Ingress controller on a minikube cluster, enable the **ingress** addon with the following command:
```shell
minikube addons enable ingress
````
To learn more about ingress addon, see [the documentation on Kubernetes website](https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/).

**Other Kubernetes Cluster**: To enable the Ingress feature on a Kubernetes cluster _other than minikube_, using the NGINX Ingress controller see [the official NGINX Ingress controller installation documentation](https://kubernetes.github.io/ingress-nginx/deploy/).

To use a different controller, see [the Ingress controller documentation](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/).

To learn more about enabling this feature on your cluster, see the [Ingress prerequisites](https://kubernetes.io/docs/concepts/services-networking/ingress/#prerequisites) on the official kubernetes documentation.

## Installing the Operator Lifecycle Manager (OLM)
The Operator Lifecycle Manager(OLM) is a component of the Operator Framework, an open source toolkit to manage Kubernetes native applications, called Operators, in a streamlined and scalable way. [(Source)](https://olm.operatorframework.io/)

[//]: # (Move this section to Architecture > Service Binding or create a new Operators doc)
What are Operators?
>The Operator pattern aims to capture the key aim of a human operator who is managing a service or set of services. Human operators who look after specific applications and services have deep knowledge of how the system ought to behave, how to deploy it, and how to react if there are problems.
>
>People who run workloads on Kubernetes often like to use automation to take care of repeatable tasks. The Operator pattern captures how you can write code to automate a task beyond what Kubernetes itself provides.
> [(Source)](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/#motivation)

[//]: # (Move until here)

To install an Operator, we will first need to install OLM [(Operator Lifecycle Manager)](https://olm.operatorframework.io/) on the cluster.
```shell
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.18.3/install.sh | bash -s v0.18.3
```
Running the script will take some time to install all the necessary resources in the Kubernetes cluster including the `OperatorGroup` resource.

Note: Check the OLM [release page](https://github.com/operator-framework/operator-lifecycle-manager/releases/) to use the latest version.

## Installing the Service Binding Operator
odo uses [Service Binding Operator](https://operatorhub.io/operator/service-binding-operator) to provide the `odo link` feature which helps to connect an odo component to a service or another component.

Operators can be installed in a specific namespace or across the cluster(i.e. in all the namespaces).
```shell
kubectl create -f https://operatorhub.io/install/service-binding-operator.yaml
```
Running the command will create the necessary resource in the `operators` namespace.

If you want to access this resource from other namespaces as well, add your target namespace to `.spec.targetNamespaces` list in the `service-binding-operator.yaml` file before running `kubectl create`.

See [Verifying the Operator installation](#verifying-the-operator-installation) to ensure that the Operator was installed successfully.

## Installing an Operator
valaparthvi marked this conversation as resolved.
Show resolved Hide resolved
To install an operator from the OperatorHub website:
1. Visit the [OperatorHub](https://operatorhub.io) website.
2. Search for an Operator of your choice.
3. Navigate to its detail page.
4. Click on **Install**.
5. Follow the instruction in the installation popup. Please make sure to install the Operator in your desired namespace or cluster-wide, depending on your choice and the Operator capability.
6. [Verify the Operator installation](#verifying-the-operator-installation).

## Verifying the Operator installation
Wait for a few seconds for the Operator to install.

Once the Operator is successfully installed on the cluster, you can use `odo` to verify the Operator installation and see the CRDs associated with it; run the following command:
```shell
odo catalog list services
```
The output can look similar to:
```shell
$ odo catalog list services
Services available through Operators
NAME CRDs
datadog-operator.v0.6.0 DatadogAgent, DatadogMetric, DatadogMonitor
service-binding-operator.v0.9.1 ServiceBinding, ServiceBinding
```
If you do not see your installed Operator in the list, follow the [troubleshooting guide](#troubleshoot-the-operator-installation) to find the issue and debug it.

## Troubleshooting the Operator installation
There are two ways to confirm that the Operator has been installed properly.
The examples you may see in this guide use [Datadog Operator](https://operatorhub.io/operator/datadog-operator) and [Service Binding Operator](https://operatorhub.io/operator/service-binding-operator).
1. Verify that its pod started and is in “Running” state.
```shell
kubectl get pods -n operators
```
The output can look similar to:
```shell
$ kubectl get pods -n operators
NAME READY STATUS RESTARTS AGE
datadog-operator-manager-5db67c7f4-hgb59 1/1 Running 0 2m13s
service-binding-operator-c8d7587b8-lxztx 1/1 Running 5 6d23h
```
2. Verify that the ClusterServiceVersion (csv) resource is in Succeeded or Installing phase.
```shell
kubectl get csv -n operators
```
The output can look similar to the following:
```shell
$ kubectl get csv -n operators
NAME DISPLAY VERSION REPLACES PHASE
datadog-operator.v0.6.0 Datadog Operator 0.6.0 datadog-operator.v0.5.0 Succeeded
service-binding-operator.v0.9.1 Service Binding Operator 0.9.1 service-binding-operator.v0.9.0 Succeeded
```

If you see the value under PHASE column to be anything other than _Installing_ or _Succeeded_, please take a look at the pods in `olm` namespace and ensure that the pod starting with name `operatorhubio-catalog` is in Running state:
```shell
$ kubectl get pods -n olm
NAME READY STATUS RESTARTS AGE
operatorhubio-catalog-x24dq 0/1 CrashLoopBackOff 6 9m40s
```
If you see output like above where the pod is in CrashLoopBackOff state or any other state other than Running, delete the pod:
```shell
kubectl delete pods/<operatorhubio-catalog-name> -n olm
```
61 changes: 61 additions & 0 deletions website/docs/getting-started/cluster-setup/openshift.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: OpenShift
sidebar_position: 2
---

# Setup an OpenShift cluster
*Note that this guide is only helpful in setting up a development environment; this setup is not recommended for a production environment.*

## Prerequisites
* You have an OpenShift cluster setup, this could for example be a [crc](https://crc.dev/crc/#installing-codeready-containers_gsg) cluster.
* You have admin privileges to the cluster, since Operator installation is only possible with an admin user.

[//]: # (Move this section to Architecture > Service Binding or create a new Operators doc)
**What are Operators?**
>The Operator pattern aims to capture the key aim of a human operator who is managing a service or set of services. Human operators who look after specific applications and services have deep knowledge of how the system ought to behave, how to deploy it, and how to react if there are problems.
>
>People who run workloads on Kubernetes often like to use automation to take care of repeatable tasks. The Operator pattern captures how you can write code to automate a task beyond what Kubernetes itself provides.
> [(Source)](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/#motivation)
[//]: # (Move until here)

## Installing the Service Binding Operator
odo uses [Service Binding Operator](https://operatorhub.io/operator/service-binding-operator) to provide the `odo link` feature which helps connect an odo component to a service or another component.

valaparthvi marked this conversation as resolved.
Show resolved Hide resolved
To install the Service Binding Operator from the OpenShift web console:
1. Login to the OpenShift web console with admin, and navigate to Operators > OperatorHub.
2. Make sure that the Project is set to All Projects.
3. Search for _**Service Binding Operator**_ in the search box under **All Items**.
4. Click on the **Service Binding Operator**; this should open a side pane.
5. Click on the **Install** button on the side pane; this should open an **Install Operator** page.
6. Make sure the **Installation mode** is set to "_All namespaces on the cluster(default)_"; **Installed Namespace** is set to "_openshift-operators_"; and **Approval Strategy** is "_Automatic_".
7. Click on the **Install** button.
8. Wait until the Operator is installed.
9. Once the Operator is installed, you should see **_Installed operator - ready for use_**, and a **View Operator** button appears on the page.
10. Click on the **View Operator** button; this should take you to Operators > Installed Operators > Operator details page, and you should be able to see details of your Operator.

## Installing an Operator
To install an Operator from the OpenShift web console:
1. Login to the OpenShift web console with admin, and navigate to Operators > OperatorHub.
2. Make sure that the Project is set to All Projects.
3. Search for an Operator of your choice in the search box under **All Items**.
4. Click on the Operator; this should open a side pane.
5. Click on the **Install** button on the side pane; this should open an **Install Operator** page.
6. Set the **Installation mode**, **Installed Namespace** and **Approval Strategy** as per your requirement.
7. Click on the **Install** button.
8. Wait until the Operator is installed.
9. Once the Operator is installed, you should see _**Installed operator - ready for use**_, and a **View Operator** button appears on the page.
10. Click on the **View Operator** button; this should take you to Operators > Installed Operators > Operator details page, and you should be able to see details of your Operator.

## Verifying the Operator installation
Once the Operator is successfully installed on the cluster, you can also use `odo` to verify the Operator installation and see the CRDs associated with it; run the following command:
```shell
odo catalog list services
```
The output can look similar to:
```shell
$ odo catalog list services
Services available through Operators
NAME CRDs
datadog-operator.v0.6.0 DatadogAgent, DatadogMetric, DatadogMonitor
service-binding-operator.v0.9.1 ServiceBinding, ServiceBinding
```
2 changes: 1 addition & 1 deletion website/docs/getting-started/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ By using odo, application developers can develop, test, debug, and deploy micros

odo follows "create and push" workflow for almost everything. It means, as a user, when you "create", something the information (or manifest) is stored in a configuration file, and then upon doing a "push" it gets created on the Kubernetes cluster. You can take an existing git repository and create an odo component from it, which can be pushed to a Kubernetes cluster.

odo helps "deploy and link" multiple components and services with each other. Using odo, developers can create and deploy services based on [Kubernetes Operators](https://github.com/operator-framework/) in their development cluster<!--TODO: add link to development cluster when ready-->. These services can be created using any of the Operators available on [OperatorHub.io](https://operatorhub.io). Next, upon linking this service, odo injects the service configuration into the microservice created using odo. Your application can use this configuration to communicate with the Operator backed service.
odo helps "deploy and link" multiple components and services with each other. Using odo, developers can create and deploy services based on [Kubernetes Operators](https://github.com/operator-framework/) in their development cluster. These services can be created using any of the Operators available on [OperatorHub.io](https://operatorhub.io). Next, upon linking this service, odo injects the service configuration into the microservice created using odo. Your application can use this configuration to communicate with the Operator backed service.


### What can odo do?
Expand Down