This project provides a streamlined way to deploy a Kubernetes cluster using Kubespray. It uses Docker (or Podman) to create a consistent environment for running Kubespray, making it easier to manage dependencies and ensure reproducibility.
- Docker or Podman
- Task (optional, for running predefined tasks)
-
Clone this repository:
git clone git@github.com:Searge/KubeSprayDocker.git cd KubeSprayDocker
-
Modify values inside
.env
and.env.local
according your needs. -
Generate or copy your SSH keys into the
ssh
directory:cp ~/.ssh/id_ed25519 ssh/ cp ~/.ssh/config ssh/
-
Build the Docker image and enter the shell:
task up && task shell
This project uses Task for running common operations. Here are some available commands:
task start
: Start the containertask up
: Build and start the containertask down
: Stop and remove the containertask stop
: Stop the containertask ps
: Show container statustask shell
: Open a shell in the containertask cleanup
: Remove the container and associated volumes
To deploy a Kubernetes cluster:
-
Generate the inventory:
task shell ./scripts/generate-inventory.sh .env.local exit
-
Deploy the cluster:
task shell ./scripts/run.sh cluster
-
To reset the cluster:
task shell ./scripts/run.sh reset
- Modify
inventory/${CLUSTER_NAME}/group_vars
to customize your cluster configuration. - Update
hosts.yaml
to specify your cluster nodes.
inventory/
: Contains cluster-specific configurations and variables.scripts/
: Helper scripts for managing the deployment process.ssh/
: SSH keys and configuration for connecting to cluster nodes.
If you encounter issues:
- Check the logs:
docker logs kubespray_local
- Ensure your SSH keys are correctly set up in the
ssh/
directory. - Verify that the IP addresses in
hosts.yaml
are correct and accessible.
Contributions are welcome! Please feel free to submit a Pull Request.