Skip to content

Commit 438a3da

Browse files
committed
add release workflow
1 parent 2665a9f commit 438a3da

3 files changed

Lines changed: 97 additions & 11 deletions

File tree

.github/workflows/release.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release Build
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
name: Build Binaries
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
strategy:
15+
matrix:
16+
goos: [linux, darwin, windows]
17+
goarch: ["amd64", "arm64"]
18+
fail-fast: false
19+
20+
steps:
21+
- name: Checkout Code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: "1.21"
28+
29+
- name: Build Binary
30+
env:
31+
GOOS: ${{ matrix.goos }}
32+
GOARCH: ${{ matrix.goarch }}
33+
run: |
34+
OUTPUT_NAME="k8sdebug-${{ matrix.goos }}-${{ matrix.goarch }}"
35+
if [ "${{ matrix.goos }}" = "windows" ]; then
36+
OUTPUT_NAME="$OUTPUT_NAME.exe"
37+
fi
38+
go build -trimpath -ldflags="-s -w" -o $OUTPUT_NAME main.go
39+
mkdir dist
40+
mv $OUTPUT_NAME dist/
41+
42+
- name: Upload Release Asset
43+
uses: actions/upload-release-asset@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
upload_url: ${{ github.event.release.upload_url }}
48+
asset_path: ./dist/k8sdebug-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
49+
asset_name: k8sdebug-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
50+
asset_content_type: application/octet-stream

README.md

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
This tool is created to solve my personal pain points while debugging an application inside K8s environment. This tool is not written from the perspective of a devops engineer but rather from the perspective of a backend application engineer trying to debug issues with the application in k8s environment. This tool is not created to be used directly with production environments. It expects certain privileges that might not be available in production. The audience for this is specifically developers running dev clusters or local clusters while debugging an application related issue. Any future feature that may be added will respect the above fact and not go beyond that scope. There might be mature tools available already that might have some intersection with the features provided here but most of those tools are devops centric. This tool is primarily application centric.
66

7-
## Features
7+
**⚠️ Production Warning**
8+
This tool requires elevated privileges and is intended for development clusters only. Never use in production environments.
89

9-
#### 1. Persistent Log analysis
10+
## 🚀 Features
11+
12+
### 🔍 Persistent Log Analysis
1013

1114
**Problem Addressed:**
1215
Kubernetes does **not** store logs of deleted pods by default. Tools like `kubectl logs` only work for existing pods. Existing solutions (e.g., Loki, Elasticsearch) require complex log aggregation setups.
@@ -18,10 +21,16 @@ k8sdebug runs a daemon to persistently capture logs for all pods in a namespace
1821
**Usage**
1922

2023
```bash
21-
k8sdebug logs record start -n <namespace>
22-
```
24+
# Start recording logs in a namespace
25+
k8sdebug logs record start -n my-namespace
2326

24-
This will start a dameon process that will record logs from all pods in that namespace and persist it on filesystem (by default in /tmp). Later the logs can be analyzed with following command.
27+
# Compare logs across deployment pods
28+
k8sdebug logs diff -n my-ns --type deployment --tail 20 my-app
29+
30+
# Manage log storage
31+
k8sdebug logs setpath ~/debug-logs # Change storage location
32+
k8sdebug logs cleanup --hard # Remove all logs
33+
```
2534

2635
``` bash
2736
k8sdebug logs diff -n <namespace> --type deployment --tail 20(default) <name of deployment>
@@ -70,13 +79,39 @@ PATH=/home/ashish/k8sdebug.
7079

7180
First time the k8sdebug command is called this file will be created.
7281

73-
## Progress
7482

75-
- [x] Persistent Log analysis
76-
- [x] Smart port forwarding
77-
- [ ] In-cluster connectivity testing.
78-
- [ ] `kubebox`
79-
- [ ] Traffic recording and visualisation
83+
### 🔄 Smart Port Forwarding
84+
85+
```bash
86+
k8sdebug port-forward \
87+
-n my-namespace \
88+
--labels "app=backend" \
89+
--policy round-robin \
90+
--hostport 8080 \
91+
--containerport 80
92+
93+
# Supported policies:
94+
# - round-robin (default)
95+
96+
```
97+
🤝 Contributing
98+
I welcome contributions that align with our scope:
99+
100+
Open an issue to discuss proposed changes
101+
102+
Maintain comprehensive test coverage
103+
104+
Document new features clearly
105+
106+
## 📅 Development Roadmap
107+
108+
| Feature | Status | Version Target |
109+
|------------------------|------------|----------------|
110+
| Log Aggregation | ✅ Stable | v0.1.0 |
111+
| Port Forward Policies | ✅ Stable | v0.1.0 |
112+
| Local Dev Simulatio(Kubebox) | Planned | v0.3.0 |
113+
| Connectivity Testing | Planned | v0.4.0 |
114+
| Traffic Visualization | Planned | v0.5.0 |
80115

81116
## License
82117

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ toolchain go1.23.8
77
require (
88
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
99
github.com/spf13/cobra v1.9.1
10+
github.com/stretchr/testify v1.9.0
1011
k8s.io/api v0.32.3
1112
k8s.io/apimachinery v0.32.3
1213
k8s.io/client-go v0.32.3

0 commit comments

Comments
 (0)