Skip to content
ZZzzz577Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KubeAgent

Kubernetes 集群管理 Dashboard,提供直观的 Web 界面管理 Kubernetes 核心资源。

项目结构

kubeagent/
├── backend/          # Go 后端服务
│   ├── cmd/          # 应用入口
│   ├── config/       # 配置文件
│   ├── internal/     # 内部代码
│   │   ├── config/       # 配置管理
│   │   ├── handler/      # HTTP 处理器
│   │   ├── kubernetes/   # K8s 客户端
│   │   ├── middleware/   # 中间件
│   │   ├── model/        # 数据模型
│   │   └── service/      # 业务逻辑
│   ├── pkg/          # 公共工具
│   └── router/       # 路由配置
├── frontend/         # React 前端应用
│   ├── src/          # 源代码
│   └── public/       # 静态资源
└── README.md

技术栈

后端

  • Go 1.21+ - 编程语言
  • Gin - Web 框架
  • client-go - Kubernetes 官方 Go 客户端
  • Viper - 配置管理

前端

  • React 19 - UI 框架
  • TypeScript - 类型安全
  • Vite - 构建工具
  • Tailwind CSS 4 - 样式框架
  • Radix UI - 无障碍组件原语
  • TanStack Query - 服务端状态管理
  • React Router - 路由管理
  • Axios - HTTP 客户端

功能特性

  • 集群信息查看(节点、版本等)
  • Namespace 管理
  • Pod 管理(查看、删除、日志)
  • Deployment 管理(CRUD、重启)
  • Service 管理
  • ConfigMap 管理
  • Secret 管理(敏感数据保护)

快速开始

前置条件

  • Go 1.21+
  • Node.js 18+
  • Kubernetes 集群访问权限(kubeconfig 或 in-cluster)

后端启动

cd backend

# 安装依赖
go mod tidy

# 启动服务
go run cmd/server/main.go

后端服务运行在 http://localhost:8080

前端启动

cd frontend

# 安装依赖
npm install

# 启动开发服务器
npm run dev

前端开发服务器运行在 http://localhost:5173

配置说明

后端配置 (backend/config/config.yaml)

server:
  port: 8080        # 服务端口
  mode: debug       # 运行模式: debug, release, test

kube:
  mode: auto        # 连接模式: in-cluster, kubeconfig, auto
  kubeconfigPath: "" # kubeconfig 路径,留空使用默认 ~/.kube/config

logLevel: info      # 日志级别

Kubernetes 连接模式

模式 说明 适用场景
in-cluster 使用 ServiceAccount 认证 服务部署在 K8s 集群内
kubeconfig 使用 kubeconfig 文件 本地开发、外部访问
auto 自动检测(默认) 优先 in-cluster,失败回退 kubeconfig

API 概览

详细 API 文档请参考 backend/README.md

核心接口

资源 接口前缀
集群信息 /api/v1/cluster
Namespace /api/v1/namespaces
Pod /api/v1/namespaces/:namespace/pods
Deployment /api/v1/namespaces/:namespace/deployments
Service /api/v1/namespaces/:namespace/services
ConfigMap /api/v1/namespaces/:namespace/configmaps
Secret /api/v1/namespaces/:namespace/secrets

开发指南

构建生产版本

# 后端
cd backend && go build -o bin/server ./cmd/server

# 前端
cd frontend && npm run build

代码检查

# 后端
cd backend && go vet ./...

# 前端
cd frontend && npm run lint

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages