Skip to content

Commit 50f2db9

Browse files
docs: add bypass feature user guide
- Add detailed documentation for bypass feature - Include configuration examples - Add troubleshooting steps - Document limitations and considerations
1 parent 81e68c8 commit 50f2db9

File tree

1 file changed

+158
-0
lines changed

1 file changed

+158
-0
lines changed

content/en/docs/userguide/bypass.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
draft: false
3+
linktitle: Use Bypass Feature in Kmesh
4+
menu:
5+
docs:
6+
parent: user guide
7+
weight: 19
8+
title: Use Bypass Feature in Kmesh
9+
toc: true
10+
type: docs
11+
---
12+
13+
## **Overview**
14+
15+
The bypass feature in Kmesh allows you to temporarily remove mesh service from the traffic path for troubleshooting purposes. This is particularly useful when you need to determine whether communication issues are caused by the mesh service or the application itself.
16+
17+
## **Use Cases**
18+
19+
###### 1. Troubleshooting Service Communication
20+
- Identify whether issues are caused by mesh service or application logic
21+
- Test direct communication between services without mesh interference
22+
- Debug network connectivity issues
23+
24+
##### 2. Traffic Path Verification
25+
- Verify service behavior with and without mesh involvement
26+
- Validate application communication patterns
27+
- Test service-to-service direct connectivity
28+
29+
## **Prerequisites**
30+
31+
Before using the bypass feature, ensure you have:
32+
33+
- A running Kubernetes cluster
34+
- Kmesh installed and configured
35+
- Pods with sidecar injection enabled
36+
- Administrative access to the cluster
37+
38+
## **Enabling Bypass**
39+
40+
##### 1. Enable Bypass Controller
41+
42+
The bypass controller must be enabled in your Kmesh configuration:
43+
44+
```yaml
45+
--enable-bypass=true
46+
```
47+
48+
##### 2. Label Pods for Bypass
49+
50+
To enable bypass for specific pods:
51+
52+
```bash
53+
kubectl label pod <pod_name> kmesh.net/bypass=enabled
54+
```
55+
56+
## **How It Works**
57+
58+
##### Traffic Flow Changes
59+
60+
##### 1. Normal Flow (Without Bypass)
61+
```
62+
Service A → Sidecar → Sidecar → Service B
63+
```
64+
65+
##### 2. Bypass Enabled Flow
66+
```
67+
Service A → Service B (Direct communication)
68+
```
69+
70+
##### Implementation Details
71+
72+
The bypass feature implements traffic control through:
73+
74+
1. **Label Monitoring**:
75+
```go
76+
const (
77+
ByPassLabel = "kmesh.net/bypass"
78+
ByPassValue = "enabled"
79+
)
80+
```
81+
82+
2. **IPTables Rules**:
83+
```bash
84+
iptables -t nat -I OUTPUT -m bpf --object-pinned /sys/fs/bpf/bypass -j RETURN
85+
iptables -t nat -I PREROUTING -m bpf --object-pinned /sys/fs/bpf/bypass -j RETURN
86+
```
87+
88+
## **Verification**
89+
90+
##### 1. Check Bypass Status
91+
92+
```bash
93+
# Check if pod has bypass label
94+
kubectl get pod <pod_name> --show-labels
95+
```
96+
97+
##### 2. Verify Traffic Flow
98+
99+
```bash
100+
# Check iptables rules in pod
101+
kubectl exec <pod_name> -- iptables -t nat -L
102+
```
103+
104+
##### 3. Verify Bypass Configuration
105+
106+
```bash
107+
# Check bypass controller status
108+
kubectl get pods -n kmesh-system | grep bypass-controller
109+
```
110+
111+
## **Limitations and Considerations**
112+
113+
##### 1. Single Pod Scope
114+
- Bypass affects only the labeled pod
115+
- Does not affect the entire traffic path
116+
117+
##### 2. Message Format
118+
- Before enabling bypass:
119+
- Configure mesh service for plaintext messages
120+
- Prevent encryption/decryption issues
121+
122+
##### 3. Traffic Direction
123+
- Current: Affects both inbound and outbound traffic
124+
- Future: Will support directional bypass
125+
126+
## **Troubleshooting**
127+
128+
##### Common Issues and Solutions
129+
130+
1. **Bypass Not Working**
131+
```bash
132+
# Verify label
133+
kubectl get pod <pod_name> --show-labels | grep kmesh.net/bypass
134+
135+
# Check sidecar
136+
kubectl describe pod <pod_name> | grep sidecar
137+
```
138+
139+
2. **Communication Issues**
140+
```bash
141+
# Check iptables
142+
kubectl exec <pod_name> -- iptables -t nat -L
143+
144+
# Verify network namespace
145+
kubectl exec <pod_name> -- ip netns list
146+
```
147+
148+
## **Cleanup**
149+
150+
##### Remove Bypass Configuration
151+
152+
```bash
153+
# Remove bypass label
154+
kubectl label pod <pod_name> kmesh.net/bypass-
155+
156+
# Verify removal
157+
kubectl get pod <pod_name> --show-labels
158+
```

0 commit comments

Comments
 (0)