- 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/[email protected]
- Create cluster
kind create cluster
- Check current context
kubectl config current-context
Install 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.yaml
file based on the2-cluster-builder.yaml
file 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.yaml
file with your push credentials for the docker registry based on the3-secret.yaml
file below and apply
kubectl apply -f secret.yaml
- Create a
service-account.yaml
file that references the created registry secret based on the4-service-account.yaml
file 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.yaml
file 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