Files
k3s-management/README.md

190 lines
4.0 KiB
Markdown
Raw Normal View History

2025-11-13 08:48:03 +07:00
# K3S Management
A modern web-based management interface for K3S Kubernetes clusters built with SvelteKit 5.
## Features
- 🔐 **Authentication** - Secure login system
- 🖥️ **Cluster Management** - Create and manage K3S clusters
- 📦 **Node Management** - Add and monitor cluster nodes
- 🔑 **SSH Configuration** - Manage SSH connections to nodes
- ⚙️ **Settings** - Configure system preferences
- 💾 **Data Export/Import** - Backup and restore configurations
## Tech Stack
- **SvelteKit 5** - Frontend framework with modern runes syntax
- **TailwindCSS 4** - Utility-first CSS framework
- **TypeScript** - Type-safe development
- **K3sup** - Backend tool for K3S cluster installation (planned)
## Getting Started
### Prerequisites
- Node.js 18+ or Bun
- A modern web browser
### Installation
1. Clone the repository
2. Install dependencies:
```bash
bun install
# or
npm install
```
3. Start the development server:
```bash
bun run dev
# or
npm run dev
```
4. Open your browser and navigate to `http://localhost:5173`
### Default Login Credentials
- **Username**: `admin`
- **Password**: `admin`
⚠️ **Security Note**: Change these credentials in production!
## Project Structure
```
k3s-management/
├── src/
│ ├── lib/
│ │ └── stores/ # Svelte stores for state management
│ │ ├── auth.svelte.ts
│ │ └── clusters.svelte.ts
│ ├── routes/
│ │ ├── +page.svelte # Login page
│ │ └── admin/ # Admin dashboard
│ │ ├── +layout.svelte
│ │ ├── +page.svelte
│ │ ├── clusters/
│ │ ├── nodes/
│ │ ├── ssh/
│ │ └── settings/
│ └── app.css # Global styles
└── package.json
```
## Usage
### Creating a Cluster
1. Navigate to the **Clusters** page
2. Click **Create Cluster**
3. Fill in cluster information:
- Cluster name and description
- K3S version
- Server node SSH details (host, port, username, password)
- Node IP address
4. Click **Create Cluster**
### Adding Nodes
1. Navigate to the **Nodes** page
2. Click **Add Node**
3. Select the target cluster
4. Configure node details:
- Node name and role (Server/Agent)
- SSH connection details
- Node IP address
5. Click **Add Node**
### Managing SSH Configurations
1. Navigate to **SSH Configurations**
2. View all SSH connections
3. Test connections to verify connectivity
4. Copy connection strings for manual SSH access
### Settings
- Configure K3sup version
- Enable/disable automatic backups
- Set up notifications
- Export/import data
- Clear all data
## Development
### Building for Production
```bash
bun run build
# or
npm run build
```
### Preview Production Build
```bash
bun run preview
# or
npm run preview
```
### Code Formatting
```bash
bun run format
# or
npm run format
```
### Linting
```bash
bun run lint
# or
npm run lint
```
## Roadmap
- [ ] Implement actual K3sup backend integration
- [ ] Add real SSH key-based authentication
- [ ] Real-time cluster status monitoring
- [ ] Cluster logs viewer
- [ ] Multi-user support with roles
- [ ] API endpoints for external integrations
- [ ] Kubernetes resources management
- [ ] Helm charts deployment
- [ ] Cluster backup and restore
- [ ] Monitoring and alerting
## Security Considerations
⚠️ **Important**: This is a development/demo version. For production use:
1. Implement proper authentication (JWT, OAuth, etc.)
2. Use SSH keys instead of passwords
3. Encrypt sensitive data
4. Use HTTPS
5. Implement rate limiting
6. Add CSRF protection
7. Validate all inputs
8. Use environment variables for configuration
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
MIT
## Acknowledgments
- Built with [SvelteKit](https://kit.svelte.dev/)
- Styled with [TailwindCSS](https://tailwindcss.com/)
- Powered by [K3sup](https://github.com/alexellis/k3sup)
- Icons from [Heroicons](https://heroicons.com/)