For deploying development builds to kubernetes, you need to do four different actions:
- Build a docker image which contains the new ozone build
- Publish the docker image to a docker registry
- Replace the image reference to your newly built image in the kubernetes resource files (eg. use youruser/ozone:0.5.0-SNAPSHOT image instead of apache/ozone/0.5 in the k8s files)
- (Deploy the kubernetes resources files.)
All the 1-3 steps are handled by the maven build!
Step (1) can be done by the maven build, if docker-build profile is activated.
Step (2) can be done by the maven build, if docker-push profile is activated.
Step (3) is also handled by maven build, but you can customize the image name with -Ddocker.image=yourname/ozone:tag maven property
The kubernetes/examples folder contains different set of cluster deployments (minimal, performance test centric, full, etc.) All the configurations are generated based on the files in kubernetes/definitions. You can adjust any of the examples with using the flekszible tool. (eg. use specific data directories, deploy to different namespace, etc.)
Build ozone, build and publish docker image
The docker image creation and push is managed by maven profile:
mvn clean install -DskipTests=true -f pom.ozone.xml -P docker-build,docker-push
Where
- docker-build profile activate the docker image creation
- docker-push profile activates a docker push
Deploy to kubernetes
Now you can deploy any of the example cluster to kubernetes:
cd hadoop-ozone/dist/target/ozone-*/kubernetes/examples/ozone kubectl apply -f .
And you can check the results with
kubectl get pod
Using own registry/custom docker image name
By default the docker image (which is created by docker-build) is prefixed by the current user. The final docker image name will be $USER/ozone:$VERSION (for example knuth/ozone:0.5.0-SNAPSHOT). But you can use the -Ddocker.image maven variable to define your own image name (which may include your repository url).
For example