Add docs for kubectl-kruise and upgrade docusaurus version (#7)
Signed-off-by: FillZpp <FillZpp.pub@gmail.com>
This commit is contained in:
parent
0fd19f3ff3
commit
b610a12aa7
|
@ -2,4 +2,94 @@
|
|||
title: Kubectl Plugin
|
||||
---
|
||||
|
||||
[Kruise-tools](https://github.com/openkruise/kruise-tools) provides commandline tools for kruise features.
|
||||
[Kruise-tools](https://github.com/openkruise/kruise-tools) provides commandline tools for kruise features, such as `kubectl-kruise`, which is a standard plugin of `kubectl`.
|
||||
|
||||
## Install
|
||||
|
||||
1. You can simply download the binary from the [releases](https://github.com/openkruise/kruise-tools/releases) page. Currently `linux` and `darwin`(OS X) with `x86_64` and `arm64` are provided. If you are using some other systems or architectures, you have to download the source code and execute `make build` to build the binary.
|
||||
|
||||
2. Make it executable, rename and move it to system PATH.
|
||||
|
||||
```bash
|
||||
$ chmod +x kubectl-kruise_darwin_amd64
|
||||
$ mv kubectl-kruise_darwin_amd64 /usr/local/bin/kubectl-kruise
|
||||
```
|
||||
|
||||
3. Then you can use it with `kubectl-kruise` or `kubectl kruise`.
|
||||
|
||||
```bash
|
||||
$ kubectl-kruise --help
|
||||
|
||||
# or
|
||||
$ kubectl kruise --help
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### expose
|
||||
|
||||
Take a workload(e.g. deployment, cloneset), service or pod and expose it as a new Kubernetes Service.
|
||||
|
||||
```bash
|
||||
$ kubectl kruise expose cloneset nginx --port=80 --target-port=8000
|
||||
```
|
||||
|
||||
### scale
|
||||
|
||||
Set a new size for a Deployment, ReplicaSet, CloneSet, or Advanced StatefulSet.
|
||||
|
||||
```bash
|
||||
$ kubectl kruise scale --replicas=3 cloneset nginx
|
||||
```
|
||||
|
||||
It equals to `kubectl scale --replicas=3 cloneset nginx`.
|
||||
|
||||
### rollout
|
||||
|
||||
Available commands: `history`, `pause`, `restart`, `resume`, `status`, `undo`.
|
||||
|
||||
```bash
|
||||
$ kubectl kruise rollout undo cloneset/nginx
|
||||
|
||||
# built-in statefulsets
|
||||
$ kubectl kruise rollout status statefulsets/sts1
|
||||
|
||||
# kruise statefulsets
|
||||
$ kubectl kruise rollout status statefulsets.apps.kruise.io/sts2
|
||||
```
|
||||
|
||||
### set
|
||||
|
||||
Available commands: `env`, `image`, `resources`, `selector`, `serviceaccount`, `subject`.
|
||||
|
||||
```bash
|
||||
$ kubectl kruise set env cloneset/nginx STORAGE_DIR=/local
|
||||
|
||||
$ kubectl kruise set image cloneset/nginx busybox=busybox nginx=nginx:1.9.1
|
||||
```
|
||||
|
||||
### migrate
|
||||
|
||||
Currently it supports migrate from Deployment to CloneSet.
|
||||
|
||||
```bash
|
||||
# Create an empty CloneSet from an existing Deployment.
|
||||
$ kubectl kruise migrate CloneSet --from Deployment -n default --dst-name deployment-name --create
|
||||
|
||||
# Create a same replicas CloneSet from an existing Deployment.
|
||||
$ kubectl kruise migrate CloneSet --from Deployment -n default --dst-name deployment-name --create --copy
|
||||
|
||||
# Migrate replicas from an existing Deployment to an existing CloneSet.
|
||||
$ kubectl-kruise migrate CloneSet --from Deployment -n default --src-name cloneset-name --dst-name deployment-name --replicas 10 --max-surge=2
|
||||
```
|
||||
|
||||
### scaledown
|
||||
|
||||
Scaledown a cloneset with selective Pods.
|
||||
|
||||
```bash
|
||||
# Scale down 2 with selective pods
|
||||
$ kubectl kruise scaledown cloneset/nginx --pods pod-a,pod-b
|
||||
```
|
||||
|
||||
It will decrease **replicas=replicas-2** of this cloneset and delete the specified pods.
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
---
|
||||
title: Kubectl Plugin
|
||||
---
|
||||
|
||||
[Kruise-tools](https://github.com/openkruise/kruise-tools) 为 Kruise 的功能提供了一系列命令行工具,包括 `kubectl-kruise`,它的是 `kubectl` 的标准插件。
|
||||
|
||||
## 安装
|
||||
|
||||
1. 你可以从 [releases](https://github.com/openkruise/kruise-tools/releases) 页面下载二进制文件,目前提供 `linux`、`darwin`(OS X)系统 `x86_64`、`arm64` 架构。如果你在使用其他的操作系统或架构,需要下载 [kruise-tools](https://github.com/openkruise/kruise-tools) 源码并通过 `make build` 打包。
|
||||
|
||||
2. 添加可执行权限,重命名并移动到系统 PATH 路径中。
|
||||
|
||||
```bash
|
||||
$ chmod +x kubectl-kruise_darwin_amd64
|
||||
$ mv kubectl-kruise_darwin_amd64 /usr/local/bin/kubectl-kruise
|
||||
```
|
||||
|
||||
3. 你可以通过 `kubectl-kruise` 或 `kubectl kruise` 命令来使用.
|
||||
|
||||
```bash
|
||||
$ kubectl-kruise --help
|
||||
|
||||
# or
|
||||
$ kubectl kruise --help
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### expose
|
||||
|
||||
根据一个 workload(如 Deployment、CloneSet)、Service 或 Pod 来生成一个新的 service 对象。
|
||||
|
||||
```bash
|
||||
$ kubectl kruise expose cloneset nginx --port=80 --target-port=8000
|
||||
```
|
||||
|
||||
### scale
|
||||
|
||||
为 workload(如 Deployment, ReplicaSet, CloneSet, or Advanced StatefulSet) 设置新的副本数。
|
||||
|
||||
```bash
|
||||
$ kubectl kruise scale --replicas=3 cloneset nginx
|
||||
```
|
||||
|
||||
它的效果与 `kubectl scale --replicas=3 cloneset nginx` 相同,即原生 `kubectl scale` 也适用。
|
||||
|
||||
### rollout
|
||||
|
||||
可用的子命令: `history`, `pause`, `restart`, `resume`, `status`, `undo`.
|
||||
|
||||
```bash
|
||||
$ kubectl kruise rollout undo cloneset/nginx
|
||||
|
||||
# built-in statefulsets
|
||||
$ kubectl kruise rollout status statefulsets/sts1
|
||||
|
||||
# kruise statefulsets
|
||||
$ kubectl kruise rollout status statefulsets.apps.kruise.io/sts2
|
||||
```
|
||||
|
||||
### set
|
||||
|
||||
可用的子命令: `env`, `image`, `resources`, `selector`, `serviceaccount`, `subject`.
|
||||
|
||||
```bash
|
||||
$ kubectl kruise set env cloneset/nginx STORAGE_DIR=/local
|
||||
|
||||
$ kubectl kruise set image cloneset/nginx busybox=busybox nginx=nginx:1.9.1
|
||||
```
|
||||
|
||||
### migrate
|
||||
|
||||
目前支持从 Deployment 迁移到 CloneSet。
|
||||
|
||||
```bash
|
||||
# Create an empty CloneSet from an existing Deployment.
|
||||
$ kubectl kruise migrate CloneSet --from Deployment -n default --dst-name deployment-name --create
|
||||
|
||||
# Create a same replicas CloneSet from an existing Deployment.
|
||||
$ kubectl kruise migrate CloneSet --from Deployment -n default --dst-name deployment-name --create --copy
|
||||
|
||||
# Migrate replicas from an existing Deployment to an existing CloneSet.
|
||||
$ kubectl-kruise migrate CloneSet --from Deployment -n default --src-name cloneset-name --dst-name deployment-name --replicas 10 --max-surge=2
|
||||
```
|
||||
|
||||
### scaledown
|
||||
|
||||
对 cloneset 指定 pod 缩容。
|
||||
|
||||
```bash
|
||||
# Scale down 2 with selective pods
|
||||
$ kubectl kruise scaledown cloneset/nginx --pods pod-a,pod-b
|
||||
```
|
||||
|
||||
它会将 cloneset 设置 **replicas=replicas-2**,并删除指定的两个 pod。
|
|
@ -14,9 +14,9 @@
|
|||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.6",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.6",
|
||||
"@docusaurus/theme-search-algolia": "^2.0.0-beta.6",
|
||||
"@docusaurus/core": "^2.0.0-beta.9",
|
||||
"@docusaurus/preset-classic": "^2.0.0-beta.9",
|
||||
"@docusaurus/theme-search-algolia": "^2.0.0-beta.9",
|
||||
"@mdx-js/react": "^1.6.21",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"clsx": "^1.1.1",
|
||||
|
|
12
sidebars.js
12
sidebars.js
|
@ -81,6 +81,18 @@ module.exports = {
|
|||
'developer-manuals/other-languages',
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Reference',
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
'CLI tools': [
|
||||
"cli-tool/kubectl-plugin",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
id: 'faq'
|
||||
|
|
Loading…
Reference in New Issue