Running an Application Using the app push Command ​
This tutorial shows how you can deploy your application using Kyma CLI.
Deploy Your Application From the Source Code ​
To use kyma app push, you must also provide either a Dockerfile, Docker image, or the application's source code. The command offers more functionality, such as mounting ConfigMap or Secret, and adding system environments - inline or from a source (ConfigMap, Secret, or a file). More detailed descriptions and examples can be found while executing the kyma app push --help command. This tutorial uses the application source code with no additional system environments or mounts. For example, you can use one of the code samples from the Paketo Buildpacks code examples, but in this tutorial, we work on the Paketo Buildpacks Java Maven app.
Add the Istio, Docker Registry, and API Gateway modules:
bashkyma module add istio --default-cr kyma module add docker-registry -c experimental --default-cr kyma module add api-gateway --default-crClone the Paketo code examples repository into the desired folder:
urlgit clone https://github.com/paketo-buildpacks/samples.gitNavigate to the
java/mavendirectory:bashcd java/mavenDeploy your application.
NOTE
Besides the required
--nameflag, you must also use the--code-pathflag to run the application from the source code.To deploy your application on a cluster with its own APIRule allowing outside access, run the following command in the current directory:
bashkyma app push --name=Test-App --code-path=. --container-port=8888 --exposeNOTE
Depending on your needs, you can also create deployments of your applications without
--exposeor--container-portflags. This changes the way you communicate with your application.Copy the URL address you should get after deploying your application. You will use it in the next step.
Check the deployed application connection
To check if the deployed application connection is working properly, run the following curl request:
bashcurl {ADDRESS-RETURNED-FROM-THE-APP-PUSH}:8080/actuator/healthYou should get the following response:
json{"status":"UP","groups":["liveness","readiness"]}NOTE
Depending on how you deploy your application, the way you communicate with it differs.
Without
--container-port, theapp pushcommand doesn't create a Service resource, and you must port-forward the deployment in one terminal and then check the health of an application in another:kubectl port-forward deployment/Test-App 8080:8080
curl localhost:8080/actuator/health
Without
--expose, theapp pushcommand doesn't create an APIRule resource, and you must port-forward the service in one terminal window and then check the health of an application in another because your application is not be exposed to the outside of the cluster:kubectl port-forward svc/Test-App 8080:8080
curl localhost:8080/actuator/health