Skip to content

Commit

Permalink
add doc: batch process node
Browse files Browse the repository at this point in the history
  • Loading branch information
tangming1996 committed Dec 23, 2024
1 parent d0b4b78 commit 8b01170
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions docs/advanced/batch-node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
title: batch process node
sidebar_position: 5
---

## Abstract
In edge scenarios, the node scale is often very large. The management process of a single node can no longer efficiently cope with such large-scale scenarios. How to manage large-scale nodes is becoming more and more important. This document will teach you how to use keadm to manage and maintain edge nodes on a large scale.

## Getting Started

This case will guide you on how to use the batch node access and reset capabilities, and introduce custom scripts using the `pre-run` and `post-run` parameters.

**Batch Node Join**

```yaml
keadm:
download:
  enable: true
  url: https://github.com/kubeedge/kubeedge/releases/download/v1.18.1 # If this parameter is not configured, the official github repository will be used by default
keadmVersion: v1.18.1
archGroup: # This parameter can configure one or more of amd64\arm64\arm
  - amd64
offlinePackageDir: /tmp/kubeedge/keadm/package/amd64  # When download.enable is true, this parameter can be left unconfigured
cmdTplArgs: # This parameter is the execution command template, which can be optionally configured and used in conjunction with nodes[x].keadmCmd
  cmd: join --pre-run=./install-containerd.sh --cgroupdriver=cgroupfs --cloudcore-ipport=192.168.1.102:10000 --hub-protocol=websocket --certport=10002 --image-repository=docker.m.daocloud.io/kubeedge --kubeedge-version=v1.18.1 --remote-runtime-endpoint=unix:///run/containerd/containerd.sock
  token: xxx
nodes:
- nodeName: ubuntu1   # Unique name
  arch: amd64
  keadmCmd: '{{.cmd}} --edgenode-name=containerd-node1 --token={{.token}}' # Used in conjunction with keadm.cmdTplArgs
  copyFrom: /root/test-keadm-batchjoin  # The file directory that needs to be remotely accessed to the joining node
  ssh:
    ip: 192.168.1.103
    username: root
    auth:
      type: privateKey   # Log in to the node using a private key
      privateKeyAuth:
        privateKeyPath: /root/ssh/id_rsa
- nodeName: ubuntu2
  arch: amd64
  keadmCmd: join --pre-run=./install-containerd.sh --edgenode-name=containerd-node2 --cgroupdriver=cgroupfs --cloudcore-ipport=192.168.1.102:10000 --hub-protocol=websocket --certport=10002 --image-repository=docker.m.daocloud.io/kubeedge --kubeedge-version=v1.17.0 --remote-runtime-endpoint=unix:///run/containerd/containerd.sock  # Used alone
  copyFrom: /root/test-keadm-batchjoin
  ssh:
    ip: 192.168.1.104
    username: root
    auth:
      type: privateKey
      privateKeyAuth:
        privateKeyPath: /root/ssh/id_rsa
maxRunNum: 5

```
In this configuration, `--pre-run=./install-containerd.sh` is introduced in the join command, which is used to install the containerd container runtime before the node accesses. The `install-containerd.sh` file is in the directory corresponding to `nodes[x].copyFrom` and is uploaded from the `control node` to the `remote node`.

**Batch Node Reset**

```yaml
keadm:
download:
  enable: true
  url: https://github.com/kubeedge/kubeedge/releases/download/v1.18.1
keadmVersion: v1.18.1
archGroup:
  - amd64
offlinePackageDir: /tmp/kubeedge/keadm/package/amd64
nodes:
- nodeName: ubuntu1
  keadmCmd: reset edge --post-run=./uninstall-containerd.sh
  ssh:
    ip: 192.168.1.103
    username: root
    auth:
      type: password  # Log in to the node using a password
      passwordAuth:
        password: dangerous
- nodeName: ubuntu2
  keadmCmd: reset edge --post-run=./uninstall-containerd.sh
  ssh:
    ip: 192.168.1.104
    username: root
    auth:
      type: password
      passwordAuth:
        password: dangerous
maxRunNum: 5
```

In this configuration, `--post-run=./uninstall-containerd.sh` is introduced in the reset command, which is used to uninstall the containerd container runtime after the node is reset. The `uninstall-containerd.sh` file is in the directory corresponding to `nodes[x].copyFrom` and is uploaded from the `control node` to the `remote node`.

#### Video Demo
![demo](..%2F..%2Fstatic%2Fimg%2Fkeadm%2Fbatch-node-demo.gif)
Binary file added static/img/keadm/batch-node-demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8b01170

Please sign in to comment.