- Docker (https://docs.docker.com/install/)
- kubectl (https://kubernetes.io/docs/tasks/tools/install-kubectl/)
- An image registry like Docker Hub (https://hub.docker.com/)
With kind tool (https://github.com/kubernetes-sigs/kind)
- Install kind with go 1.11+ or see https://github.com/kubernetes-sigs/kind for alternatives
GO111MODULE="on" go get sigs.k8s.io/kind@v0.7.0- Create cluster
kind create cluster- Check current context
kubectl config current-contextInstall kpack (https://github.com/pivotal/kpack)
- Download kpack release from Github, see https://github.com/pivotal/kpack/releases for the most recent release
kubectl apply -f https://github.com/pivotal/kpack/releases/download/v0.0.8/release-0.0.8.yaml- Ensure that the kpack controller has a status of "Running"
kubectl get pods --namespace kpack --watch- Check the logs to confirm the kpack controller started without error
kubectl -n kpack logs deployment/kpack-controller -f- Create a
cluster-builder.yamlfile based on the2-cluster-builder.yamlfile below for a ClusterBuilder resource and apply
kubectl apply -f cluster-builder.yaml- Ensure that kpack has processed the builder
kubectl get clusterbuilder default-builder -o yaml- Create a
secret.yamlfile with your push credentials for the docker registry based on the3-secret.yamlfile below and apply
kubectl apply -f secret.yaml- Create a
service-account.yamlfile that references the created registry secret based on the4-service-account.yamlfile below and apply
kubectl apply -f service-account.yaml-
Fork the sample repository https://github.com/buildpack/sample-java-app to test the automatic rebuild functionality
-
Create a kpack image configuration file (
image.yaml) with your forked repository based on the5-image.yamlfile below and apply
kubectl apply -f image.yaml- Download the kpack log untility (https://github.com/pivotal/kpack/blob/master/docs/logs.md) and tail logs from all builds for an image:
./logs -image java-sample-image- Push any update to the forked sample app repository. kpack should recognize the update and automatically rebuild your image.
You can see by viewing the logs(step #5) or by running
kubectl get builds- Run the latest image of the app locally with docker
docker run -p 8080:8080 index.docker.io/<docker-registry-username>/kpack-sample-java-app- Open localhost:8080 in your favorite browser
kind delete cluster