Skip to content

Conversation

@tangming1996
Copy link
Contributor

  • Please check if the PR fulfills these requirements
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Which issue(s) this PR fixes:

Fixes #
add example for keadm bacth process node

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • What is the current behavior? (You can also link to an open issue here)

  • What is the new behavior (if this is a feature change)?

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

  • Other information:

@kubeedge-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign dingyin after the PR has been reviewed.
You can assign the PR to them by writing /assign @dingyin in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot kubeedge-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 24, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @tangming1996, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces new documentation that outlines the process of managing and maintaining large-scale edge nodes using keadm's batch processing capabilities. It provides practical guidance and configuration examples for automating node join and reset operations, including the integration of custom pre- and post-execution scripts.

Highlights

  • New Documentation: A new documentation page, docs/advanced/batch-node.md, has been added to guide users on managing large-scale edge nodes using keadm.
  • Batch Node Operations: The document details how to perform batch join and batch reset operations for edge nodes using keadm.
  • Custom Script Execution: It introduces and explains the pre-run and post-run parameters, allowing users to execute custom scripts before or after keadm commands during batch operations.
  • Configuration Examples: Comprehensive YAML configuration examples are provided for both batch node join and reset, illustrating various parameters including keadm versioning, architecture groups, offline package directories, command templates, and SSH authentication methods (private key and password).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds new documentation for the batch node processing feature in keadm. The documentation provides a good overview and examples for joining and resetting nodes in batch. My review includes several suggestions to improve the clarity, consistency, and correctness of the documentation. Key points include: correcting an inconsistency in the "Batch Node Reset" example where a configuration field appears to be missing from the YAML but is referenced in the description, improving phrasing and tone for better readability and a more professional feel, fixing minor formatting and style issues, such as inconsistent casing and trailing whitespace, and replacing an insecure example password with a placeholder to promote better security practices. Overall, this is a valuable addition, and with these changes, it will be even more helpful for users.

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`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This paragraph states that the uninstall-containerd.sh script is located in the directory specified by nodes[x].copyFrom. However, the YAML configuration example for "Batch Node Reset" above does not include the copyFrom field. This is a significant inconsistency that will confuse users.

Please either:

  1. Add the copyFrom field to the reset configuration example (if it's required for the script to be available).
  2. Correct this descriptive text to explain how the script is made available on the remote node if copyFrom is not used in the reset scenario.

- 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment "The file directory that needs to be remotely accessed to the joining node" is phrased awkwardly. It could be made clearer.

Suggested change
  copyFrom: /root/test-keadm-batchjoin  # The file directory that needs to be remotely accessed to the joining node
  copyFrom: /root/test-keadm-batchjoin  # The directory on the control node containing files to be copied to the joining node


## Getting Started

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrasing here could be more direct and professional. "This case will guide you" is a bit informal.

Suggested change
This case will guide you how to use the batch node join and reset capabilities, and introduce custom scripts using the `pre-run` and `post-run` parameters.
This guide demonstrates how to use the batch node join and reset capabilities, and introduces custom scripts using the `pre-run` and `post-run` parameters.


**Pre-run and Post-run Parameter Description**

To support custom scripts, we have introduced the optional parameters `pre-run` and `post-run` in various commands of keadm. These parameters allow users to pass in custom script files to perform some pre or post script tasks. For specific usage, refer to the subsequent use cases.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrase "perform some pre or post script tasks" is a bit redundant. Consider rephrasing for better clarity.

Suggested change
To support custom scripts, we have introduced the optional parameters `pre-run` and `post-run` in various commands of keadm. These parameters allow users to pass in custom script files to perform some pre or post script tasks. For specific usage, refer to the subsequent use cases.
To support custom scripts, we have introduced the optional parameters `pre-run` and `post-run` in various commands of keadm. These parameters allow users to execute custom scripts before or after the main command. For specific usage, refer to the subsequent use cases.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For correctness and consistency, please capitalize "GitHub".

Suggested change
  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
  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

    auth:
      type: password  # Log in to the node using a password
      passwordAuth:
        password: dangerous

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a weak password like "dangerous" as an example, even in documentation, can encourage poor security practices. It's better to use a placeholder to indicate that a user should provide their own secure password.

Suggested change
        password: dangerous
        password: <your-password>

    auth:
      type: password
      passwordAuth:
        password: dangerous

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a weak password like "dangerous" as an example, even in documentation, can encourage poor security practices. It's better to use a placeholder to indicate that a user should provide their own secure password.

Suggested change
        password: dangerous
        password: <your-password>

---

## 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrasing in the abstract could be improved for clarity and conciseness. The current wording is a bit verbose, and using "teach you" is informal for technical documentation.

Suggested change
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.
In edge scenarios, the node scale is often very large. Managing individual nodes is inefficient in such large-scale scenarios, making bulk node management crucial. This document explains how to use keadm to manage and maintain edge nodes on a large scale.


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`.

**Usage:**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a trailing space in this heading. Please remove it for clean formatting.

Suggested change
**Usage:**
**Usage:**

Save the above file on a `control node` that can access all edge nodes. For example, the file name is `batch-reset-node.yaml`, and then execute `keadm batch -c ./batch-reset-node.yaml` in the directory where the file is located.

#### Video Demo
![demo](..%2F..%2Fstatic%2Fimg%2Fkeadm%2Fbatch-node-demo.gif) No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The image path uses URL-encoded forward slashes (%2F). While this may render correctly, it's not standard Markdown syntax and is harder to read and maintain. Please use normal forward slashes for clarity.

Suggested change
![demo](..%2F..%2Fstatic%2Fimg%2Fkeadm%2Fbatch-node-demo.gif)
![demo](../../static/img/keadm/batch-node-demo.gif)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants