Skip to content

Commit cab7f9a

Browse files
Merge branch 'main' into fix/redesign-quescard-prev-next-card/3657
2 parents c170c13 + e565c9e commit cab7f9a

File tree

3 files changed

+239
-0
lines changed

3 files changed

+239
-0
lines changed
337 KB
Loading
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
---
2+
id: kubernetes-local-setup
3+
title: Kubernetes Local Setup (Kind)
4+
sidebar_label: Kubernetes Local Setup
5+
tags:
6+
- explanation
7+
- feature guide
8+
- keploy enterprise
9+
- kubernetes
10+
- kind
11+
keywords:
12+
- keploy enterprise
13+
- kubernetes
14+
- kind
15+
- local cluster
16+
- live recording
17+
- replay
18+
---
19+
20+
import ProductTier from '@site/src/components/ProductTier';
21+
22+
<ProductTier tiers="Enterprise" offerings="Self-Hosted, Dedicated" />
23+
24+
This guide walks you through creating a local **Kind** Kubernetes cluster and connecting it to **Keploy** using a **NodePort** (example: `30080`) so you can **live record and replay traffic** for Pods.
25+
26+
> [!NOTE]
27+
> This documentation covers **local Kind cluster** setup. Documentation for **hosted cluster** setup is coming soon.
28+
29+
---
30+
31+
## Prerequisites
32+
33+
Ensure you have the following before you begin:
34+
35+
1. **Keploy Enterprise account** (with an access key)
36+
2. **kubectl** configured to access your Kubernetes cluster
37+
3. **Helm** installed
38+
4. **Kind** installed
39+
40+
---
41+
42+
## 1) Create a Local Kind Cluster (with NodePort Mapping)
43+
44+
### 1.1 Install Kind
45+
46+
Install Kind using the official instructions:
47+
https://kind.sigs.k8s.io/docs/user/quick-start/#installing-from-release-binaries
48+
49+
### 1.2 Create Kind Cluster Config (NodePort: `30080`)
50+
51+
Create a file named `kind-cluster.yaml` with the following contents:
52+
53+
```yaml
54+
kind: Cluster
55+
apiVersion: kind.x-k8s.io/v1alpha4
56+
nodes:
57+
- role: control-plane
58+
extraPortMappings:
59+
- containerPort: 30080
60+
hostPort: 30080
61+
protocol: TCP
62+
```
63+
64+
### 1.3 Create the Cluster
65+
66+
Run:
67+
68+
```bash
69+
kind create cluster --config kind-cluster.yaml
70+
```
71+
72+
### 1.4 Verify the Cluster is Ready
73+
74+
Confirm the cluster components are running:
75+
76+
```bash
77+
kubectl get pods --all-namespaces
78+
```
79+
80+
Expected output should look similar to:
81+
82+
```text
83+
NAMESPACE NAME READY STATUS RESTARTS AGE
84+
kube-system coredns-7d764666f9-r82lr 1/1 Running 0 42s
85+
kube-system coredns-7d764666f9-rsjsv 1/1 Running 0 42s
86+
kube-system etcd-local-k8s-control-plane 1/1 Running 0 49s
87+
kube-system kindnet-c59v6 1/1 Running 0 42s
88+
kube-system kube-apiserver-local-k8s-control-plane 1/1 Running 0 49s
89+
kube-system kube-controller-manager-local-k8s-control-plane 1/1 Running 0 48s
90+
kube-system kube-proxy-xkch5 1/1 Running 0 42s
91+
kube-system kube-scheduler-local-k8s-control-plane 1/1 Running 0 49s
92+
local-path-storage local-path-provisioner-67b8995b4b-csn49 1/1 Running 0 42s
93+
```
94+
95+
✅ Your local Kind cluster is ready.
96+
97+
---
98+
99+
## 2) Connect the Cluster to Keploy (NodePort Setup)
100+
101+
### 2.1 Create Cluster Entry in Keploy
102+
103+
1. Go to: https://app.keploy.io/clusters
104+
2. Click **Connect New Cluster**
105+
3. Enter:
106+
- **Cluster Name**
107+
- **Ingress URL**: Use `http://localhost:30080`
108+
109+
> [!NOTE]
110+
> This setup has been tested with **Google Chrome**. Browsers treat `localhost` as a secure context, which allows features that would otherwise require HTTPS. If you use an IP address instead, HTTPS would be required with a properly signed TLS certificate.
111+
>
112+
> If your cluster is running on a VM, see [SSH Port Forwarding](#23-optional-ssh-port-forwarding-access-keploy-nodeport-from-your-laptop) to access it via `localhost` from your laptop.
113+
114+
4. Click **Connect**
115+
116+
### 2.2 Install Keploy via Helm
117+
118+
Keploy UI will provide a Helm command. Ensure you **set**:
119+
120+
- `proxy.insecure.enabled=true` (**important for local NodePort**)
121+
- `service.type=NodePort`
122+
- `service.nodePort=30080`
123+
- `ingressUrl` matches what you entered in the UI (e.g., `http://localhost:30080`)
124+
125+
Example command:
126+
127+
```bash
128+
helm upgrade --install k8s-proxy oci://docker.io/keploy/k8s-proxy-chart --version <LATEST_VERSION> \
129+
--namespace keploy \
130+
--create-namespace \
131+
--set accessKey="<YOUR_KEY>" \
132+
--set clusterName="doc-test-2" \
133+
--set apiServerUrl="https://api.keploy.io" \
134+
--set service.type=NodePort \
135+
--set ingressUrl="http://localhost:30080" \
136+
--set service.nodePort=30080 \
137+
--set environment="prod" \
138+
--set proxy.insecure.enabled=true
139+
```
140+
141+
---
142+
143+
### 2.3 Optional: SSH Port Forwarding (Access Keploy NodePort from Your Laptop)
144+
145+
If your Kubernetes cluster is running **inside a VM** and you want to use **Chrome on your local machine** to reach the Keploy NodePort (e.g., `30080`), you can tunnel the port over SSH.
146+
147+
This is useful when:
148+
149+
- The NodePort is reachable **from the VM**, but not directly from your laptop due to NAT / firewall rules, or
150+
- You want to avoid exposing the NodePort to your LAN.
151+
152+
#### Example: Forward Local `30080` → VM `30080`
153+
154+
Run this on your **local machine**:
155+
156+
```bash
157+
ssh -N \
158+
-L 30080:<VM_IP>:30080 \
159+
<username>@<VM_IP> -i /path/to/your/ssh/key
160+
```
161+
162+
After this is running, you should be able to open the NodePort via:
163+
164+
- `http://localhost:30080`
165+
166+
…and use that value for `ingressUrl` in the Keploy UI / Helm values.
167+
168+
#### Troubleshooting: `channel ... open failed: connect failed: Connection refused`
169+
170+
If you see something like:
171+
172+
```text
173+
channel 2: open failed: connect failed: Connection refused
174+
```
175+
176+
It typically means **the VM could not connect to the target IP:port** from _its own network namespace_.
177+
178+
Common fixes:
179+
180+
- **Verify the NodePort is actually listening** on the VM:
181+
182+
```bash
183+
sudo ss -lntp | grep 30080 || true
184+
sudo netstat -lntp | grep 30080 || true
185+
```
186+
187+
- **Confirm the Keploy NodePort service is created and uses the expected port**:
188+
189+
```bash
190+
kubectl -n keploy get svc
191+
kubectl -n keploy get svc k8s-proxy -o yaml | sed -n '1,160p'
192+
```
193+
194+
- **If the NodePort is only bound on localhost inside the VM**, forward to `127.0.0.1` instead:
195+
196+
```bash
197+
ssh -N \
198+
-L 30080:127.0.0.1:30080 \
199+
<username>@<VM_IP> -i /path/to/your/ssh/key
200+
```
201+
202+
- **If you're running Kind inside Docker on the VM**, ensure your Kind config includes the `extraPortMappings` and that `hostPort: 30080` is mapped correctly (as shown in this document).
203+
204+
> [!TIP]
205+
> If the VM's IP changes or you want the command to fail fast, add `-o ExitOnForwardFailure=yes`.
206+
207+
---
208+
209+
## 3) Verify Keploy Pods Are Running
210+
211+
Check all namespaces:
212+
213+
```bash
214+
kubectl get pods --all-namespaces
215+
```
216+
217+
You should see Keploy components in the `keploy` namespace, similar to:
218+
219+
```text
220+
NAMESPACE NAME READY STATUS RESTARTS AGE
221+
keploy k8s-proxy-65f4d8fd9-cmbmn 1/1 Running 0 72s
222+
keploy k8s-proxy-minio-74849875b7-4w76s 1/1 Running 0 72s
223+
keploy k8s-proxy-mongodb-6548798d96-2llzt 1/1 Running 0 72s
224+
kube-system coredns-7d764666f9-r82lr 1/1 Running 0 8m7s
225+
...
226+
```
227+
228+
---
229+
230+
## 4) Confirm Cluster Visibility in Keploy UI
231+
232+
1. Go back to: https://app.keploy.io/clusters
233+
2. Open your connected cluster
234+
3. Verify your **deployments** are visible
235+
236+
✅ Once deployments are visible, you can start **recording on any Pod** and later **replay**.
237+
238+
![Keploy Kubernetes Interface](/img/k8s-local-cluster-ui.png)

versioned_sidebars/version-4.0.0-sidebars.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"id": "server/installation"
2121
},
2222
"keploy-cloud/cloud-installation",
23+
"keploy-cloud/kubernetes-local-setup",
2324
"running-keploy/cli-commands",
2425
"running-keploy/rename-testcases",
2526
"running-keploy/docker-tls",

0 commit comments

Comments
 (0)