Skip to content

Commit

Permalink
feat: add command usage
Browse files Browse the repository at this point in the history
  • Loading branch information
wencaiwulue committed Sep 6, 2024
1 parent 7d43225 commit 9bf8d51
Show file tree
Hide file tree
Showing 36 changed files with 2,124 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/functions/6_reverse_proxy_with_mesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 6

# Reverse proxy with mesh

Support HTTP, GRPC and WebSocket etc. with specific header `"a: 1"` will route to your local machine
Support HTTP, gRPC, Thrift and WebSocket etc. with specific header `"a: 1"` will route to your local machine

```shell
~ kubevpn proxy deployment/productpage --headers a=1
Expand Down
3 changes: 2 additions & 1 deletion docs/functions/9_multiple_protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ sidebar_position: 9
- TCP
- UDP
- ICMP
- GRPC
- gRPC
- Thrift
- WebSocket
- HTTP
- ...
58 changes: 58 additions & 0 deletions docs/quickstart/10_kubevpn_alias.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
sidebar_position: 10
---

# Kubevpn alias

Configure command aliases for easier execution, similar to SSH alias configuration.

This command reads the `~/.kubevpn/config.yaml` file as the configuration source. You can also specify a different file
path using the `-f` flag. The configuration supports dependencies; for example, if one cluster's API server needs to be
accessed through another cluster, you can use the `needs` syntax. This allows actions to be performed on the required
cluster first before targeting the destination cluster.

# Examples

If you have the following configuration in your `~/.kubevpn/config.yaml`:

```yaml
Name: dev
Needs: jumper
Flags:
- connect
- --kubeconfig=~/.kube/config
- --namespace=default
- --lite
---

Name: jumper
Flags:
- connect
- --kubeconfig=~/.kube/jumper_config
- --namespace=test
- --extra-hosts=xxx.com
```
Config file support three field: `Name`,`Needs`,`Flags`

## Use kubevpn alias config to simply execute command, connect to cluster network by order: jumper --> dev

```shell
kubevpn alias dev
```

## kubevpn alias jumper, just connect to cluster jumper

```shell
kubevpn alias jumper
```

# Options

```text
-f, --file='/Users/bytedance/.kubevpn/config.yaml':
Config file location
-r, --remote='':
Remote config file, eg: https://raw.githubusercontent.com/kubenetworks/kubevpn/master/pkg/config/config.yaml
```
86 changes: 86 additions & 0 deletions docs/quickstart/11_kubevpn_reset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
sidebar_position: 11
---

# Kubevpn reset

Reset all resources created by kubevpn in a Kubernetes cluster

The reset operation will delete all resources created by kubevpn in the Kubernetes cluster, such as deployments,
services, service accounts, etc. It will also delete local development Docker containers, Docker networks, host entries
added by kubevpn, and clean up DNS settings.

# Examples

## Reset the default namespace:

```bash
kubevpn reset
```

## Reset another namespace test

```shell
kubevpn reset -n test
```

## Reset cluster api-server behind of bastion host or ssh jump host

```shell
kubevpn reset --ssh-addr 192.168.1.100:22 --ssh-username root --ssh-keyfile ~/.ssh/ssh.pem
```

## It also support ProxyJump, like

```text
┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌────────────┐
│ pc ├────►│ ssh1 ├────►│ ssh2 ├────►│ ssh3 ├─────►... ─────► │ api-server │
└──────┘ └──────┘ └──────┘ └──────┘ └────────────┘
```

```shell
kubevpn reset --ssh-alias <alias>
```

## Support ssh auth GSSAPI

```shell
kubevpn reset --ssh-addr <HOST:PORT> --ssh-username <USERNAME> --gssapi-keytab /path/to/keytab
kubevpn reset --ssh-addr <HOST:PORT> --ssh-username <USERNAME> --gssapi-cache /path/to/cache
kubevpn reset --ssh-addr <HOST:PORT> --ssh-username <USERNAME> --gssapi-password <PASSWORD>
```

# Options

```text
--gssapi-cache='':
GSSAPI cache file path, use command `kinit -c /path/to/cache USERNAME@RELAM` to generate
--gssapi-keytab='':
GSSAPI keytab file path
--gssapi-password='':
GSSAPI password
--remote-kubeconfig='':
Remote kubeconfig abstract path of ssh server, default is /home/$USERNAME/.kube/config
--ssh-addr='':
Optional ssh jump server address to dial as <hostname>:<port>, eg: 127.0.0.1:22
--ssh-alias='':
Optional config alias with ~/.ssh/config for SSH authentication
--ssh-jump='':
Optional bastion jump config string, eg: '--ssh-addr jumpe.naison.org --ssh-username naison --gssapi-password
xxx'
--ssh-keyfile='':
Optional file with private key for SSH authentication
--ssh-password='':
Optional password for ssh jump server
--ssh-username='':
Optional username for ssh jump server
```
16 changes: 16 additions & 0 deletions docs/quickstart/12_kubevpn_quit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
sidebar_position: 12
---

# Kubevpn quit

Disconnect from the cluster, preserve proxy resources, quit the daemon gRPC server and clean up dns/host.

Before quitting kubevpn, it will return the proxy resources to their origin and disconnect from the cluster. It will
also clean up the dns/hosts settings.

# Examples

```bash
kubevpn quit
```
28 changes: 28 additions & 0 deletions docs/quickstart/13_kubevpn_logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
sidebar_position: 13
---

# Kubevpn logs

Print the logs for the kubevpn daemon gRPC server. It will show both the sudo daemon and daemon gRPC server logs.

## Examples

### Show logs for the kubevpn daemon server

```bash
kubevpn logs
```

### follow more log

```shell
kubevpn logs -f
```

# Options

```text
-f, --follow=false:
Specify if the logs should be streamed.
```
17 changes: 17 additions & 0 deletions docs/quickstart/14_kubevpn_upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
sidebar_position: 14
---

# Kubevpn upgrade

Upgrade kubevpn client to the latest version, automatically download and install the latest kubevpn from GitHub.
Disconnect from all k8s clusters, preserve resources, remove all cloned resources, and then upgrade the local daemon
gRPC server to the latest version.

## Examples

### Upgrade kubevpn to the latest version

```bash
kubevpn upgrade
```
27 changes: 27 additions & 0 deletions docs/quickstart/15_kubevpn_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
sidebar_position: 15
---

# Kubevpn version

Print the client version information.

## Example

```shell
kubevpn version
```

```text
KubeVPN: CLI
Version: v2.2.17
Daemon: v2.2.17
Image: docker.io/naison/kubevpn:v2.2.17
Branch: master
Git commit: ac918b5
Built time: 2024-09-03 20:31:08
Built OS/Arch: darwin/arm64
Built Go version: go1.22.6
```

**Options `--image` can overwrite `Image` value, use this image to start up `kubevpn-traffic-manager` pod**
31 changes: 31 additions & 0 deletions docs/quickstart/1_global_options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
sidebar_position: 1
---

# Global options

same as `kubectl options`

```text
--as='' Specifies the username to impersonate for the operation. This could be a regular user or a service account in a namespace.
--as-group=[] Indicates the group to impersonate for the operation. This flag can be repeated to specify multiple groups.
--as-uid='' Defines the UID to impersonate for the operation.
--cache-dir='/Users/xxx/.kube/cache' Set the default cache directory.
--certificate-authority='' Path to a certificate file for the certificate authority.
--client-certificate='' Path to a client certificate file for TLS.
--client-key='' Path to a client key file for TLS.
--cluster='' Determines the name of the kubeconfig cluster to use.
--context='' Specifies the name of the kubeconfig context to use.
--disable-compression=false If true, disables response compression for all requests to the server.
--insecure-skip-tls-verify=false If true, skips checking the server's certificate for validity, making HTTPS connections insecure.
--kubeconfig='' Path to the kubeconfig file to use for CLI requests.
--match-server-version=false Ensures the server version matches the client version.
-n, --namespace='' Defines the namespace scope for this CLI request.
--password='' Password for basic authentication to the API server.
--request-timeout='0' Sets the amount of time to wait before giving up on a server request, with non-zero values specifying a time unit.
-s, --server='' The address and port of the Kubernetes API server.
--tls-server-name='' Server name used for server certificate validation; if not provided, the hostname used to contact the server is used.
--token='' Bearer token for authentication to the API server.
--user='' Name of the kubeconfig user to use.
--username='' Username for basic authentication to the API server.
```
Loading

0 comments on commit 9bf8d51

Please sign in to comment.