setup k8 added
This commit is contained in:
@ -16,4 +16,92 @@ In particular, this project aims to provide the following benefits to Open edX o
|
||||
* Scalable hosting for instances of any size. This means for example that the default configuration includes autoscaling of LMS pods to handle increased traffic.
|
||||
* Flexibility: this project aims to be "batteries included" and to support setting up all the resources that you need, with useful default configurations, but it is carefully designed so that operators can configure, replace, or disable any components as needed.
|
||||
|
||||
image:edX-k8s.drawio.svg[edX-K8s Deployment,align=center]
|
||||
image:edX-k8s.drawio.svg[edX-K8s Deployment,align=center]
|
||||
|
||||
|
||||
==== Setup Kubernetes Cluster ====
|
||||
|
||||
For setting up a Kubernetes cluster, you can use any cloud provider like AWS, GCP, Azure, or a self-hosted solution like Ubuntu with MicroK8s. The following steps are for setting up a Kubernetes cluster on Ubuntu with MicroK8s.
|
||||
|
||||
include::setup-k8s.asciidoc[]
|
||||
|
||||
==== Deploy Open edX on Kubernetes ====
|
||||
|
||||
*Caution:* This project is still in development and documentation is being updated. Please refer to the repository for the latest information. link:https://raw.githubusercontent.com/openedx/openedx-k8s-harmony/main/README.md[openedx/openedx-k8s-harmony/README.md]
|
||||
|
||||
### Step 1: Use Helm to provision a kubernetes cluster using this chart
|
||||
|
||||
#### Option 1a: Setting up Harmony Chart on a cloud-hosted Kubernetes Cluster (recommended)
|
||||
|
||||
For this recommended approach, you need to have a Kubernetes cluster in the cloud **with at least 12GB of usable
|
||||
memory** (that's enough to test 2 Open edX instances).
|
||||
|
||||
1. Make sure you can access the cluster from your machine: run `kubectl cluster-info` and make sure it displays some
|
||||
information about the cluster (e.g. two URLs).
|
||||
2. Copy `values-example.yaml` to a new `values.yaml` file and edit it to put in your email address and customize
|
||||
other settings. The email address is required for Lets Encrypt to issue HTTPS certificates. It is not shared
|
||||
with anyone else. For a full configuration reference, see the `charts/harmony-chart/values.yaml` file.
|
||||
3. Install [Helm](https://helm.sh/) if you don't have it already.
|
||||
4. Add the Harmony Helm repository:
|
||||
|
||||
```shell
|
||||
helm repo add openedx-harmony https://openedx.github.io/openedx-k8s-harmony
|
||||
helm repo update
|
||||
```
|
||||
|
||||
5. Install the cert-manager CRDs if using cert-manager:
|
||||
|
||||
```shell
|
||||
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.1/cert-manager.crds.yaml --namespace=harmony
|
||||
```
|
||||
|
||||
You can check the version of cert-manager that is going to be installed by the chart by checking the corresponding
|
||||
line in the `charts/harmony-chart/Chart.yaml` file.
|
||||
6. Install the Harmony chart by running:
|
||||
|
||||
```shell
|
||||
helm install harmony --namespace harmony --create-namespace -f values.yaml openedx-harmony/harmony-chart
|
||||
```
|
||||
|
||||
Note: in the future, if you apply changes to `values.yaml`, please run this command to update the deployment of the chart:
|
||||
|
||||
```shell
|
||||
helm upgrade harmony --namespace harmony -f values.yaml openedx-harmony/harmony-chart
|
||||
```
|
||||
|
||||
#### Option 1b: Setting up Harmony Chart locally on Minikube
|
||||
|
||||
*Note: if possible, it's preferred to use a cloud-hosted cluster instead (see previous section). But if you don't have a
|
||||
cluster available in the cloud, you can use minikube to try this out locally. The minikube version does not support
|
||||
HTTPS and is more complicated due to the need to use tunnelling.*
|
||||
|
||||
1. First, [install `minikube`](https://minikube.sigs.k8s.io/docs/start/) if you don't have it already.
|
||||
2. Run `minikube start` (you can also use `minikube dashboard` to access the Kubernetes dashboard).
|
||||
3. Add the Helm repository and install the Harmony chart using the `values-minikube.yaml` file as configuration:
|
||||
|
||||
```shell
|
||||
helm repo add openedx-harmony https://openedx.github.io/openedx-k8s-harmony
|
||||
helm repo update
|
||||
helm install harmony --namespace harmony --create-namespace -f values-minikube.yaml openedx-harmony/harmony-chart
|
||||
```
|
||||
|
||||
4. Run `minikube tunnel` (you may need to enter a password), and then you should be able to access the cluster (see
|
||||
"External IP" below). If this approach is not working, an alternative is to run\
|
||||
`minikube service harmony-ingress-nginx-controller -n harmony`\
|
||||
and then go to the URL it says, e.g. `http://127.0.0.1:52806` plus `/cluster-echo-test`
|
||||
(e.g. `http://127.0.0.1:52806/cluster-echo-test`)
|
||||
5. In this case, skip step 2 ("Get the external IP") and use `127.0.0.1` as the external IP. You will need to remember
|
||||
to include the port numbers shown above when accessing the instances.
|
||||
|
||||
### Step 2: Get the external IP
|
||||
|
||||
The [ingress NGINX Controller](https://kubernetes.github.io/ingress-nginx/) is used to automatically set up an HTTPS
|
||||
reverse proxy for each Open edX instance as it gets deployed onto the cluster. There is just one load balancer with a
|
||||
single external IP for all the instances on the cluster. To get its IP, use:
|
||||
|
||||
```shell
|
||||
kubectl get svc -n harmony harmony-ingress-nginx-controller
|
||||
```
|
||||
|
||||
To test that your load balancer is working, go to `http://<the external ip>/cluster-echo-test` .
|
||||
You may need to ignore the HTTPS warnings, but then you should see a response with some basic JSON output.
|
135
content/setup-k8s.asciidoc
Normal file
135
content/setup-k8s.asciidoc
Normal file
@ -0,0 +1,135 @@
|
||||
=== Setup Kubernetes
|
||||
|
||||
In this guide we are using microk8s to setup a Kubernetes cluster.
|
||||
To setup a Micro K8S Cluster on you need ubuntu maschines with static IP addresses, a working internet connection and optional for metallb "loadbalancer" an extra IP range for the services.
|
||||
|
||||
The network configuration for ubuntu 20.04+ is done with netplan.
|
||||
Config in /etc/netplan/00-installer-config.yaml and apply with sudo netplan apply
|
||||
|
||||
Example Configuration:
|
||||
```
|
||||
# This is the network config written by 'subiquity'
|
||||
network:
|
||||
ethernets:
|
||||
ens18:
|
||||
addresses:
|
||||
- 141.57.9.180/22
|
||||
nameservers:
|
||||
addresses:
|
||||
- 141.57.1.94
|
||||
search:
|
||||
- imn.htwk-leipzig.de
|
||||
routes:
|
||||
- to: default
|
||||
via: 141.57.11.253
|
||||
version: 2
|
||||
```
|
||||
|
||||
[cols="1,1,1,1,1", options="header"]
|
||||
|===
|
||||
| Name | IP | SSH Port | Proxmox Node | Config
|
||||
|
||||
| k8s-nfs | 141.57.9.171 | 23505 | yprox | 4 Core + 4 GB RAM
|
||||
| rancher | 141.57.9.170 | 23505 | xprox | 4 Core + 4 GB RAM
|
||||
| k8s-node1 | 141.57.9.180 | 23505 | yprox | 4 Core + 8 GB RAM
|
||||
| k8s-node2 | 141.57.9.181 | 23505 | zprox | 4 Core + 8 GB RAM
|
||||
| k8s-node3 | 141.57.9.182 | 23505 | yprox | 8 Core + 32 GB RAM
|
||||
|===
|
||||
|
||||
|
||||
We installed Ubuntu 22.04 on the nodes and configured the network with netplan.
|
||||
The current snap version for microk8s is 1.28.0 wich is supported by the current rancher release.
|
||||
|
||||
```
|
||||
snap install microk8s --classic --channel=1.28/stable
|
||||
```
|
||||
|
||||
Join the groups and rights so without root
|
||||
|
||||
```
|
||||
sudo usermod -a -G microk8s $USER
|
||||
|
||||
sudo mkdir -p ~/.kube
|
||||
|
||||
sudo chown -f -R $USER ~/.kube
|
||||
|
||||
newgrp microk8s # to reload shell groups without close and open
|
||||
```
|
||||
|
||||
Check the status while Kubernetes starts
|
||||
|
||||
```
|
||||
microk8s status --wait-ready
|
||||
```
|
||||
|
||||
Turn on the services you want
|
||||
```
|
||||
microk8s enable dns
|
||||
```
|
||||
|
||||
```
|
||||
microk8s enable registry
|
||||
```
|
||||
|
||||
```
|
||||
microk8s enable rbac
|
||||
```
|
||||
|
||||
```
|
||||
microk8s enable ingress
|
||||
```
|
||||
|
||||
Start using Kubernetes
|
||||
|
||||
```
|
||||
microk8s kubectl get all --all-namespaces
|
||||
```
|
||||
|
||||
Um weitere Nodes mit microk8s zu verbinden auf dem main node:
|
||||
|
||||
```bash
|
||||
microk8s add-node
|
||||
```
|
||||
|
||||
Example output:
|
||||
|
||||
```bash
|
||||
From the node you wish to join to this cluster, run the following:
|
||||
|
||||
microk8s join 192.168.122.210:25000/b346782cc8956830924c04f2cf1b1745/dadf654db615
|
||||
|
||||
|
||||
|
||||
Use the '--worker' flag to join a node as a worker not running the control plane, eg:
|
||||
|
||||
microk8s join 192.168.122.210:25000/b346782cc8956830924c04f2cf1b1745/dadf654db615 --worker
|
||||
|
||||
|
||||
|
||||
If the node you are adding is not reachable through the default interface you can use one of the following:
|
||||
|
||||
microk8s join 192.168.122.210:25000/b346782cc8956830924c04f2cf1b1745/dadf654db615
|
||||
|
||||
microk8s join 192.168.123.1:25000/b346782cc8956830924c04f2cf1b1745/dadf654db615
|
||||
|
||||
microk8s join 172.17.0.1:25000/b346782cc8956830924c04f2cf1b1745/dadf654db615
|
||||
```
|
||||
|
||||
Alias for easy setup copy paste commands:
|
||||
|
||||
```
|
||||
alias helm="microk8s helm"
|
||||
```
|
||||
|
||||
```
|
||||
alias kubectl="microk8s kubectl"
|
||||
```
|
||||
|
||||
|
||||
If cattle-cluster-agent in cattle-system reboots multiple times and has dns resolving problems change the config.
|
||||
|
||||
```
|
||||
kubectl edit deployment cattle-cluster-agent -n cattle-system
|
||||
...
|
||||
dnsPolicy: Default
|
||||
```
|
@ -8,12 +8,16 @@ ifndef::imagesdir[:imagesdir: media]
|
||||
ifndef::includedir[:includedir: content]
|
||||
= CodeContender =
|
||||
|
||||
|
||||
== Introduction ==
|
||||
|
||||
CodeContender is a platform for learning and practicing coding. It is a web application that provides a set of coding courses with diffrend tasks and questions. Content is divided into different categories and levels. Users get information in form of text, images, and videos. They can also practice coding in an online code editor. The platform is designed to be user-friendly and easy to use. It is suitable for beginners as well as advanced users.
|
||||
Goal after finishing a course is to pass a final test and get a certificate.
|
||||
|
||||
== Problem Analysis ==
|
||||
|
||||
Software Setup:
|
||||
|
||||
* is a cluster already running wtih the required software? (e.g. docker, kubernetes, etc.)
|
||||
* Installation scripts like ansible, puppet, etc. to install the required software
|
||||
* Installation scripts for the application
|
||||
|
Reference in New Issue
Block a user