feat: add sim & pingap

This commit is contained in:
Sun-ZhenXing
2025-12-27 11:24:44 +08:00
parent 72b36f2748
commit d536fbc995
25 changed files with 1727 additions and 483 deletions

View File

@@ -7,7 +7,7 @@ K3S_VERSION=v1.28.2+k3s1
# K3s DinD Image Version
# Built image version tag
K3S_DIND_VERSION=0.2.0
K3S_DIND_VERSION=0.2.1
# Preload Images
# Whether to pre-download common images during build (true/false)
# Set to false to speed up build time if you have good internet connectivity

View File

@@ -62,13 +62,14 @@ A lightweight Kubernetes distribution (K3s) running inside a Docker-in-Docker (D
| Variable | Default | Description |
| ----------------------------- | -------------- | ------------------------------------- |
| `K3S_VERSION` | `v1.28.2+k3s1` | K3s version to install |
| `K3S_DIND_VERSION` | `0.2.0` | Built image version tag |
| `K3S_DIND_VERSION` | `0.2.1` | Built image version tag |
| `PRELOAD_IMAGES` | `true` | Pre-download images during build |
| `TZ` | `UTC` | Container timezone |
| `K3S_API_PORT_OVERRIDE` | `6443` | Kubernetes API server port |
| `DOCKER_TLS_PORT_OVERRIDE` | `2376` | Docker daemon TLS port |
| `K3S_TOKEN` | (empty) | Shared secret for cluster join |
| `K3S_DISABLE_SERVICES` | `traefik` | Services to disable (comma-separated) |
| `K3S_NODE_NAME` | `k3s-server` | Node name for the K3s server |
| `K3S_DIND_CPU_LIMIT` | `2.00` | CPU limit (cores) |
| `K3S_DIND_MEMORY_LIMIT` | `4G` | Memory limit |
| `K3S_DIND_CPU_RESERVATION` | `0.50` | CPU reservation (cores) |

View File

@@ -62,13 +62,14 @@
| 变量 | 默认值 | 说明 |
| ----------------------------- | -------------- | ------------------------- |
| `K3S_VERSION` | `v1.28.2+k3s1` | 要安装的 K3s 版本 |
| `K3S_DIND_VERSION` | `0.2.0` | 构建的镜像版本标签 |
| `K3S_DIND_VERSION` | `0.2.1` | 构建的镜像版本标签 |
| `PRELOAD_IMAGES` | `true` | 构建时预下载镜像 |
| `TZ` | `UTC` | 容器时区 |
| `K3S_API_PORT_OVERRIDE` | `6443` | Kubernetes API 服务器端口 |
| `DOCKER_TLS_PORT_OVERRIDE` | `2376` | Docker 守护进程 TLS 端口 |
| `K3S_TOKEN` | (空) | 集群加入的共享密钥 |
| `K3S_DISABLE_SERVICES` | `traefik` | 要禁用的服务(逗号分隔) |
| `K3S_NODE_NAME` | `k3s-server` | K3s 服务器的节点名称 |
| `K3S_DIND_CPU_LIMIT` | `2.00` | CPU 限制(核心数) |
| `K3S_DIND_MEMORY_LIMIT` | `4G` | 内存限制 |
| `K3S_DIND_CPU_RESERVATION` | `0.50` | CPU 预留(核心数) |

View File

@@ -13,7 +13,7 @@ x-defaults: &defaults
services:
k3s:
<<: *defaults
image: ${GLOBAL_REGISTRY:-}alexsuntop/k3s-inside-dind:${K3S_DIND_VERSION:-0.2.0}
image: ${GLOBAL_REGISTRY:-}alexsuntop/k3s-inside-dind:${K3S_DIND_VERSION:-0.2.1}
build:
context: .
dockerfile: Dockerfile
@@ -31,6 +31,7 @@ services:
- TZ=${TZ:-UTC}
- K3S_TOKEN=${K3S_TOKEN:-}
- K3S_DISABLE_SERVICES=${K3S_DISABLE_SERVICES:-traefik}
- K3S_NODE_NAME=${K3S_NODE_NAME:-k3s-server}
healthcheck:
test: ["CMD", "k3s", "kubectl", "get", "--raw", "/healthz"]
interval: 30s

View File

@@ -19,7 +19,12 @@ echo "Docker is ready."
echo "Starting K3s..."
# Build K3s server arguments
K3S_ARGS="--snapshotter=native --write-kubeconfig-mode=644 --https-listen-port=6443"
if [ -n "$K3S_ARGS" ]; then
echo "Using custom K3S_ARGS: $K3S_ARGS"
else
echo "No custom K3S_ARGS provided, using defaults."
K3S_ARGS="--snapshotter=native --write-kubeconfig-mode=644 --https-listen-port=6443"
fi
# Add disable services if specified
if [ -n "$K3S_DISABLE_SERVICES" ]; then