No description
| LICENSE | ||
| README.md | ||
Project: inftools-cn
Purpose: This repository contains a small helper container image and scripts to build and run a debugging/admin container for working with Docker and lightweight Kubernetes (k3d). The image includes kubectl, the Docker CLI, and k3d so you can create and administer a local k3d cluster from inside the container.
Key Files:
Dockerfile: Builds the helper image (Debian Bookworm) withkubectl,k3d, and the Docker CLI.build.sh: Ensures theinftools-cn:latestimage exists, creates a user Docker network (student-net) if missing, and (when needed) runsk3d cluster create myclusterinside the helper container. It also edits the kubeconfig stored in themykubeDocker volume so the cluster API uses the load-balancer node.run.sh: Launches an interactive shell in the helper container, mounting the Docker socket and themykubevolume.
Image / Resources:
- Image name:
inftools-cn:latest - Docker network used:
student-net - Docker volume used for kubeconfig:
mykube
Requirements:
- Docker must be installed and the user must be able to access the Docker daemon (the scripts bind-mount
/var/run/docker.sock). - Host can run containers and create networks/volumes.
Quick Usage:
-
Build and create the k3d cluster (recommended):
./build.sh -
Start an interactive shell inside the helper container (uses the pre-built
inftools-cn:latestimage):./run.sh
see this demo of build.sh and run.sh on a debian bookworm OS
-
Manual docker build/run (if you prefer):
docker build -t inftools-cn:latest . docker network create student-net # if not present docker run --rm -it --network student-net -v /var/run/docker.sock:/var/run/docker.sock -v mykube:/root/.kube inftools-cn:latest bash
What build.sh does (summary):
- Ensures the
inftools-cn:latestimage exists (builds it fromDockerfileif missing). - Creates
student-netDocker network if it doesn't exist. - Runs the
k3d cluster create myclustercommand inside the helper container, captures the output to find the load-balancer node, and updates the kubeconfig in themykubevolume so the cluster API endpoint points to the LB node on port6443.
Security notes:
- The container mounts the host Docker socket (
/var/run/docker.sock) into the container which grants the container broad control over the host Docker daemon. Only run this in trusted environments.
License:
- This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
- See the
LICENSEfile in this repository for the full license text.