Skip to content

Commit 0f68b81

Browse files
committed
doc: update README & manifests
1 parent 0482c12 commit 0f68b81

File tree

3 files changed

+60
-30
lines changed

3 files changed

+60
-30
lines changed

README.md

+13-7
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ NOTE: The forwarding session is not affected after rolling update.
4747
| [Krew](https://krew.sigs.k8s.io/) | `kubectl krew install relay` |
4848
| Pre-built binaries for macOS, Linux | [GitHub releases](https://github.com/knight42/krelay/releases) |
4949

50+
NOTE: If you only have limited access to the cluster, please make sure the permissions specified in [rbac.yaml](./manifests/rbac.yaml)
51+
is granted:
52+
```bash
53+
kubectl create -f https://raw.githubusercontent.com/knight42/krelay/main/manifests/rbac.yaml
54+
```
55+
5056
### Build from source
5157

5258
```
@@ -75,17 +81,17 @@ kubectl relay host/redis.cn-north-1.cache.amazonaws.com 6379
7581
# Listen on port 5000 and 6000 locally, forwarding data to "1.2.3.4:5000" and "1.2.3.4:6000" from the cluster
7682
kubectl relay ip/1.2.3.4 5000@tcp 6000@udp
7783

78-
# Forwarding local port 8080 to 8080 in the service, and delete the krelay-server pod after the command has finished.
79-
kubectl relay --rm svc/my-service 8080
84+
# Create the agent in the kube-public namespace, and forward local port 5000 to "1.2.3.4:5000"
85+
kubectl relay --server.namespace kube-public ip/1.2.3.4 5000
8086
```
8187

8288
## Flags
8389

84-
| flag | default | description |
85-
|------------------|-----------------------------------------|----------------------------------------------------------------------------|
86-
| `--address` | `127.0.0.1` | Address to listen on. Only accepts IP addresses as a value. |
87-
| `--rm` | `false` | Automatically remove the krelay-server pod after the command has finished. |
88-
| `--server-image` | `ghcr.io/knight42/krelay-server:v0.0.1` | The krelay-server image to use. |
90+
| flag | default | description |
91+
|----------------------|-----------------------------------------|-------------------------------------------------------------|
92+
| `--address` | `127.0.0.1` | Address to listen on. Only accepts IP addresses as a value. |
93+
| `--server.image` | `ghcr.io/knight42/krelay-server:v0.0.1` | The krelay-server image to use. |
94+
| `--server.namespace` | `default` | The namespace in which krelay-server is located. |
8995

9096
## How It Works
9197

manifests/rbac.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: krelay
5+
rules:
6+
- apiGroups:
7+
- ""
8+
resources:
9+
- pods
10+
- pods/portforward
11+
verbs:
12+
# create the krelay-server pod and forward local port to it
13+
- create
14+
# watch the krelay-server pod
15+
- watch
16+
# clean the krelay-server pod
17+
- delete
18+
19+
# The following permissions is only requried if you want to forward the local port to the respective objects.
20+
- apiGroups:
21+
- ""
22+
resources:
23+
- services
24+
- pods
25+
verbs:
26+
- get
27+
- apiGroups:
28+
- apps
29+
resources:
30+
- replicasets
31+
- deployments
32+
- statefulsets
33+
- daemonsets
34+
verbs:
35+
- get
36+
---
37+
apiVersion: rbac.authorization.k8s.io/v1
38+
kind: ClusterRoleBinding
39+
metadata:
40+
name: krelay
41+
roleRef:
42+
apiGroup: rbac.authorization.k8s.io
43+
kind: ClusterRole
44+
name: krelay
45+
subjects:
46+
- kind: User
47+
name: bob

manifests/server.yaml

-23
This file was deleted.

0 commit comments

Comments
 (0)