53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
# K3s inside Docker-in-Docker
|
|
# A lightweight Kubernetes cluster running inside a Docker container
|
|
# See README.md for usage instructions
|
|
|
|
x-defaults: &defaults
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 100m
|
|
max-file: "3"
|
|
|
|
services:
|
|
k3s:
|
|
<<: *defaults
|
|
image: ${GLOBAL_REGISTRY:-}alexsuntop/k3s-inside-dind:${K3S_DIND_VERSION:-0.2.1}
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
args:
|
|
K3S_VERSION: ${K3S_VERSION:-v1.28.2+k3s1}
|
|
PRELOAD_IMAGES: ${PRELOAD_IMAGES:-true}
|
|
privileged: true
|
|
volumes:
|
|
- k3s_data:/var/lib/rancher/k3s
|
|
- docker_data:/var/lib/docker
|
|
ports:
|
|
- "${K3S_API_PORT_OVERRIDE:-6443}:6443" # Kubernetes API server
|
|
- "${DOCKER_TLS_PORT_OVERRIDE:-2376}:2376" # Docker daemon TLS port
|
|
environment:
|
|
- 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
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 60s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: ${K3S_DIND_CPU_LIMIT:-2.00}
|
|
memory: ${K3S_DIND_MEMORY_LIMIT:-4G}
|
|
reservations:
|
|
cpus: ${K3S_DIND_CPU_RESERVATION:-0.50}
|
|
memory: ${K3S_DIND_MEMORY_RESERVATION:-1G}
|
|
|
|
volumes:
|
|
k3s_data:
|
|
docker_data:
|