No description
Find a file
2025-11-28 18:30:35 +00:00
.gitignore initial commit 2025-11-28 18:30:35 +00:00
build.sh initial commit 2025-11-28 18:30:35 +00:00
Dockerfile initial commit 2025-11-28 18:30:35 +00:00
LICENSE first commit 2025-11-28 18:26:42 +00:00
README.md update readme 2025-11-28 18:28:48 +00:00
run.sh initial commit 2025-11-28 18:30:35 +00:00
Vagrantfile initial commit 2025-11-28 18:30:35 +00:00

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) with kubectl, k3d, and the Docker CLI.
  • build.sh: Ensures the inftools-cn:latest image exists, creates a user Docker network (student-net) if missing, and (when needed) runs k3d cluster create mycluster inside the helper container. It also edits the kubeconfig stored in the mykube Docker 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 the mykube volume.

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:latest image):

    ./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:latest image exists (builds it from Dockerfile if missing).
  • Creates student-net Docker network if it doesn't exist.
  • Runs the k3d cluster create mycluster command inside the helper container, captures the output to find the load-balancer node, and updates the kubeconfig in the mykube volume so the cluster API endpoint points to the LB node on port 6443.

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 LICENSE file in this repository for the full license text.