This Infrastructure as Code (IaC) project leverages the power of Pulumi and KinD (Kubernetes in Docker) to provision a Zot service and accompanying resources for Zot development and testing.
- Rapid Prototyping: Ideal for developing Zot on Kubernetes.
- Local Development: Perfect for testing locally on Kind Kubernetes.
- Automation: Easily integrate into CI/CD pipelines.
These instructions will help you set up a Zot on KinD cluster.
```bash
usrbinkat@mordor:~/uor-zot/iac$ time pulumi up -y
Updating (dev)
Type Name Status Info
+ pulumi:pulumi:Stack zot-dev created (0.36s) 14 messages
+ ├─ my:kind:KindCluster default-cluster created (42s)
+ │ ├─ command:local:Command default-cluster-deleteCluster created (0.14s)
+ │ └─ command:local:Command default-cluster-createCluster created (42s)
+ ├─ command:local:Command default-cluster-volumeCheck created (0.36s)
+ ├─ kubernetes:apps/v1:Deployment zot-deployment created (27s)
+ └─ kubernetes:core/v1:Service zot-service created (10s)
Resources:
+ 7 created
Duration: 1m29s
real 1m38.564s
user 0m1.734s
sys 0m1.302s
```
-
Clone the Repository
git clone https://github.com/usrbinkat/pulumi-kind-go.git cd uor-zot/iac
-
Download Go Deps
go get -u ./... go mod download go mod tidy
-
Initialize Pulumi
pulumi stack init dev
-
Run Pulumi
pulumi up
-
Check Your Cluster
kubectl get nodes
- Pulumi: Orchestrates the provisioning.
- KinD: Creates a local Kubernetes cluster using Docker containers.
- Go: The IaC logic is written in Go, leveraging Pulumi's Go SDK.
- Zot: The Zot service is deployed to the cluster.
kind/kind.go
: KinD cluster creation.kind/volumes.go
: Accelerate kind cluster builds with stateful containerd storage volume.helper/helper.go
: Utility functions.zot/zot.go
: Zot service deployment.
- Initialize Configuration: Sets up Pulumi context and configuration.
- Load Cluster Config: Reads the desired Kind cluster setup.
- Manage Docker Volumes: Checks, creates, or deletes Docker volumes as needed.
- Create/Delete KinD Cluster: Uses Pulumi's
local.Command
to run the KinD CLI commands. - Create/Delete Zot Service: Deploy Zot to k8s with Pulumi's
kubernetes.apps.v1.{Service,Deployment}
resources.
For now, the code is set up to deploy a basic zot configuration. Customizations will be added in future releases.
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.
- The Pulumi Team for their fantastic IaC tool.
- Kubernetes for revolutionizing the way we think about container orchestration.
- The ReadME Project for README best practices.
export GOFLAGS='-replace=github.com/usrbinkat/pulumi-kind-go=.'