Skip to content

Commit

Permalink
Update docs according to review comment
Browse files Browse the repository at this point in the history
Signed-off-by: llhuii <[email protected]>
  • Loading branch information
llhuii committed Sep 18, 2021
1 parent 479d407 commit e887b38
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 30 deletions.
17 changes: 9 additions & 8 deletions docs/setup/all-in-one.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Deploy All In One Sedna
The [all-in-one script](/scripts/installation/all-in-one.sh) is used to install Sedna along with a mini Kubernetes environment locally, including:
- A Kubernetes v1.21 cluster with multi worker nodes, default zero worker node.
- KubeEdge with multi nodes, default is latest KubeEdge and one edge node.
- KubeEdge with multi edge nodes, default is latest KubeEdge and one edge node.
- Sedna, latest release version.

It requires you:
Expand All @@ -15,22 +15,23 @@ It requires you:
For example:

```bash
curl https://raw.githubusercontent.com/kubeedge/sedna/master/scripts/installation/all-in-one.sh | NUM_EDGE_WORKERS=2 bash -
curl https://raw.githubusercontent.com/kubeedge/sedna/master/scripts/installation/all-in-one.sh | NUM_EDGE_NODES=2 bash -
```

Above command installs a mini Sedna environment, including:
- A Kubernetes v1.21 cluster with multi worker nodes, default none worker node.
- KubeEdge with multi nodes, default is latest KubeEdge and one edge node.
- Sedna, latest release version.
- A Kubernetes v1.21 cluster with only one master node.
- KubeEdge with two edge nodes.
- The latest Sedna.

You can play it online on [katacoda](https://www.katacoda.com/kubeedge-sedna/scenarios/all-in-one).

Advanced options:
| Env Variable | Description| Default Value|
| --- | --- | --- |
|NUM_CLOUD_WORKERS | The cloud workers| 0|
|NUM_EDGE_WORKERS | The KubeEdge workers| 1|
|KUBEEDGE_VERSION | The KubeEdge version to be installed. |The latest KubeEdge release version|
|NUM_EDGE_NODES | Number of KubeEdge nodes| 1 |
|NUM_CLOUD_WORKER_NODES | Number of cloud **worker** nodes, not master node| 0|
|SEDNA_VERSION | The Sedna version to be installed. |The latest version|
|KUBEEDGE_VERSION | The KubeEdge version to be installed. |The latest version|
|CLUSTER_NAME | The all-in-one cluster name| sedna-mini|
|FORCE_INSTALL_SEDNA | If 'true', force to reinstall Sedna|false|
|NODE_IMAGE | Custom node image| kubeedge/sedna-allinone-node:v1.21.1|
Expand Down
38 changes: 30 additions & 8 deletions docs/setup/local-up.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
### Deploy local Sedna clusters
### Deploy Local Sedna Cluster

Once you have docker running, you can create a local Sedna cluster with:
The [local-up script](/hack/local-up.sh) boots a local Kubernetes cluster, installs latest KubeEdge, and deploys Sedna based on the Sedna local repository.

#### Use Case
When one is contributing new features for Sedna, codes like AI algorithms under testing can be frequently changed before final deployment.
When coding in that case, s/he would suffer from tortured re-installations and frequent failures of the whole complicated system.
To get rid of the torments, one can use the local-up installation, embraced the single-machine simulation for agiler development and testing.

#### Setup

It requires:
- 2 CPUs or more
- 1GB+ free memory
- 5GB+ free disk space
- Internet connection(docker hub, github etc.)
- Linux platform, such as ubuntu/centos
- Docker 17.06+
- A local Sedna code repository


Then you can enter Sedna local code repository, and create a local Sedna cluster with:
```
bash hack/local-up.sh
```
This script uses [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) to create a
local k8s cluster with one master node, and boots one edge node by running KubeEdge.
You can see them by using `kubectl get nodes -o wide`:

In more details, this local-up script uses [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) to create a
local K8S cluster with one master node, and joins the K8S cluster by running KubeEdge.

In another terminal, you can see them by using `kubectl get nodes -o wide`:
```shell
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
edge-node Ready agent,edge 3d21h v1.19.3-kubeedge-v1.6.1 192.168.0.233 <none> Ubuntu 18.04.5 LTS 4.15.0-128-generic docker://20.10.2
sedna-control-plane Ready control-plane,master 3d21h v1.20.2 172.18.0.2 <none> Ubuntu 20.10 4.15.0-128-generic containerd://1.5.0-beta.3-24-g95513021e
```

You can access master node with:
You can login the master node with:
```
docker exec -it --detach-keys=ctrl-@ sedna-control-plane bash
# since the master node just uses containerd CRI runtime, you can alias the CRI cli 'crictl' as 'docker'
alias docker=crictl
```

Docker images can be loaded into the cluster nodes with:
After you have done developing, built worker image and want to run your worker into master node, your worker image should be loaded into the cluster nodes with:
```
kind load docker-image my-custom-image --name sedna
kind load docker-image --name sedna <your-custom-worker-image>
```

8 changes: 6 additions & 2 deletions docs/setup/quick-start.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
There are some ways to set up Sedna, depends on your use case:
- If you have none Kubernetes environment and don't want to install Kubernetes manually, you can follow [the instruction](./all-in-one.md) to install all-in-one Sedna environment.
- Else you can follow [this instruction](./install.md) to install Sedna on existing Kubernetes cluster.
- Also [there is a local up script](./local-up.md) which is mainly used for developing Sedna, it boots a local Kubernetes cluster and installs Sedna based on local Sedna repository.

- Otherwise, when Kubernetes is ready, you can follow [this instruction](./install.md) to install Sedna on the existing Kubernetes cluster.

- One more thing: we also have a local-up install script available for easier Sedna development. The local-up version boots a local Kubernetes cluster and installs Sedna based on a local repository. The use case and setup procedures are available [here](./local-up.md).


After set up Sedna, you can try out [examples](/examples).

24 changes: 12 additions & 12 deletions scripts/installation/all-in-one.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#
# Advanced options, influential env vars:
#
# NUM_CLOUD_WORKERS | optional | The cloud workers, default 0
# NUM_EDGE_WORKERS | optional | The KubeEdge workers, default 1
# NUM_CLOUD_WORKER_NODES| optional | The number of cloud worker nodes, default 0
# NUM_EDGE_NODES | optional | The number of KubeEdge nodes, default 1
# KUBEEDGE_VERSION | optional | The KubeEdge version to be installed.
# if not specified, it try to get latest version or v1.8.0
# SEDNA_VERSION | optional | The Sedna version to be installed.
Expand Down Expand Up @@ -62,13 +62,13 @@ function prepare_env() {
SEDNA_VERSION=$(get_latest_version kubeedge/sedna $DEFAULT_SEDNA_VERSION)
fi

: ${NUM_CLOUD_WORKERS:=0}
: ${NUM_EDGE_WORKERS:=1}
: ${NUM_CLOUD_WORKER_NODES:=0}
: ${NUM_EDGE_NODES:=1}

: ${ALLINONE_NODE_IMAGE:=kubeedge/sedna-allinone-node:$DEFAULT_NODE_IMAGE_VERSION}

readonly MAX_CLOUD_WORKERS=2
readonly MAX_EDGE_WORKERS=3
readonly MAX_CLOUD_WORKER_NODES=2
readonly MAX_EDGE_WORKER_NODES=3

# TODO: find a better way to figure this kind control plane
readonly CONTROL_PLANE_NAME=${CLUSTER_NAME}-control-plane
Expand Down Expand Up @@ -101,12 +101,12 @@ function prepare_env() {

function validate_env() {

((NUM_CLOUD_WORKERS<=MAX_CLOUD_WORKERS)) || {
log_fault "Only support NUM_CLOUD_WORKERS at most $MAX_CLOUD_WORKERS"
((NUM_CLOUD_WORKER_NODES<=MAX_CLOUD_WORKER_NODES)) || {
log_fault "Only support NUM_CLOUD_WORKER_NODES at most $MAX_CLOUD_WORKER_NODES"
}

((NUM_EDGE_WORKERS<=MAX_EDGE_WORKERS)) || {
log_fault "Only support NUM_EDGE_WORKERS at most $MAX_EDGE_WORKERS"
((NUM_EDGE_NODES<=MAX_EDGE_WORKER_NODES)) || {
log_fault "Only support NUM_EDGE_NODES at most $MAX_EDGE_WORKER_NODES"
}
}

Expand Down Expand Up @@ -145,7 +145,7 @@ nodes:
- containerPort: $CLOUDCORE_CERT_PORT
EOF

for((i=0;i<NUM_CLOUD_WORKERS;i++)); do
for((i=0;i<NUM_CLOUD_WORKER_NODES;i++)); do
cat <<EOF
- role: worker
image: $ALLINONE_NODE_IMAGE
Expand Down Expand Up @@ -280,7 +280,7 @@ EOF

function create_and_setup_edgenodes() {

for((i=0;i<NUM_EDGE_WORKERS;i++)); do
for((i=0;i<NUM_EDGE_NODES;i++)); do
log_info "Installing $i-th edge node..."
local containername=sedna-mini-edge$i
local hostname=edge$i
Expand Down

0 comments on commit e887b38

Please sign in to comment.