This workshop gives you a brief introduction of how to deploy a Java application step by step to openshift.
- install Docker (if you run on Windows be aware if you are using docker on Hyper-v or with docker-machine/Virtualbox. Will weii provide some hints for docker-machine useres in the readmes)
- powershell if you are running on windows
- install openshift client tools: https://developers.openshift.com/managing-your-applications/client-tools.html
- install minishift: https://docs.openshift.org/latest/minishift/getting-started/installing.html
- check versions:
- minishift version == v1.4.1
- minishift openshift version
- openshift v3.6.0+
- kubernetes v1.6.1
- etcd 3.2.1
-
Step 1, is a simple Spring-boot CRUD application running locally, using a local mongodb instance
-
In Step 2, we start the application as a Docker container, together with a mongodb container, locally
-
In Step 3, we push the created Docker image to the openshift repository and deploy the mongodb and the application itself in openshift
-
In Step 4, we automate the deployment to openshift by using the fabric8 maven plugin. Additionally we customize the service & deployment descriptors
-
Step 5, demonstrates the usage of a custom Dockerfile together with the Fabric8 plugin
-
In Step 6 we split the application into a frontend a write and a read service
-
In Step 7 we add a second frontend and use a different approach for service discovery
-
In Step 8 and Step 9 we will look at config maps as a mechanism to externalize configuration.
-
In Step 10 we will use secrets to store sensitive data.
-
In Step 11 we will creat and use a template.
-
In Step 12 we will buildour own S2I builder image.
-
demo contains a simple overall demo presenting the most important aspects such as pods, replicasets, deployments, services and routes. spring-boot-demo contains a possible Spring application, which contains additional instable health access points to demonstrate monitoring and restarting facilities.
-
s2i contains a small example for building a custom s2i builder image. . templates contains a s,aöö example for creating a kubnernetes template.
-
config,aüs-1/2 contains example for creating configmaps including propagation of an image through stages qith different configs.
-
secrets contains an exercise for creating a secret and printing it's content in a container.
Resetting your Openshift is easy. In most cases it is sufficient to run the following commands (ensure you are logged in as developer user, not as admin ;-) ):
- oc delete route --all
- oc delete service --all
- oc delete deployment --all
- oc delete pods --all
- oc delete templates --all
- oc delete cm --all
Dont use oc delete secrets --all since you might also delete secrets used by some system components in your project.
Given Openshift a few seconds to perform all changes (the CLI will immedeately return, but the deletion process might still be ongoing).
If nevertheless things still fail (rarely happening) you can recreate the Openshift VM completely:
- minishift delete
- minishift start --memory 4096 --cpus 2