Skip to content

Create pre-configured kind cluster images with hook scripts

License

Notifications You must be signed in to change notification settings

snowbldr/kind-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kind-hooks

This image provides hooks into the kind node startup process allowing scripts to be run at various stages

How to use this image

To run a script at a certain stage overwrite the associated /hooks/*.sh file.

helm is installed and ready to be used for installing resources in the after_ready.sh script.

The following hooks are supported:

  • before_start.sh: Runs before anything else when the container starts up
  • after_ready.sh: Runs after the kubernetes cluster is ready for installing resources

Postgres example

In this example, we'll create a new docker image with our setup script pre-loaded.

First, in the root directory, build the kind-hooks image

docker build . -t kind-hooks 

We'll create the following directory structure

- kind-postgres
    - Dockerfile
    - setup_postgres.sh

These files are available in the example directory of this repo.

setup_postgres.sh

helm repo add bitnami https://charts.bitnami.com/bitnami
helm template --set postgresqlPassword=password,postgresqlDatabase=kuberneats,image.tag=13-debian-10 bitnami/postgresql | kubectl apply -f -

Dockerfile

FROM kind-hooks
COPY setup_postgres.sh /hooks/after_ready.sh

Build the docker image

docker build -t kind-postgres:latest .

Create the cluster

kind create cluster --image kind-postgres:latest --name kind-postgres

After the kube-system pods are ready, postgres will be installed.

About

Create pre-configured kind cluster images with hook scripts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published