Hello World Helidon
This example is a Helidon-based service that returns a “Hello World” response when invoked. The application configuration uses the default, microprofile properties file.
Before you begin
Install Verrazzano by following the installation instructions.
NOTE: The Hello World Helidon example application deployment files are contained in the Verrazzano project located at <VERRAZZANO_HOME>/examples/hello-helidon
, where <VERRAZZANO_HOME>
is the root of the Verrazzano project.
Deploy the Hello World Helidon application
NOTE
To run this application in the default namespace:
$ kubectl label namespace default verrazzano-managed=true istio-injection=enabled
If you chose the default namespace, you can skip Step 1 and ignore the -n
option in the rest of the commands.
-
To run the application in a namespace other than default namespace, create a namespace for the application and add a label identifying the namespace as managed by Verrazzano.
$ kubectl create namespace hello-helidon $ kubectl label namespace hello-helidon verrazzano-managed=true istio-injection=enabled
-
To deploy the application, apply the
hello-helidon
OAM resources.$ kubectl apply -f https://raw.githubusercontent.com/verrazzano/verrazzano/v1.7.2/examples/hello-helidon/hello-helidon-comp.yaml -n hello-helidon $ kubectl apply -f https://raw.githubusercontent.com/verrazzano/verrazzano/v1.7.2/examples/hello-helidon/hello-helidon-app.yaml -n hello-helidon
-
Wait for the application to be ready.
$ kubectl wait \ --for=condition=Ready pods \ --all \ -n hello-helidon \ --timeout=300s
Explore the application
The Hello World Helidon microservices application implements a REST API endpoint, /greet
, which returns a message {"message":"Hello World!"}
when invoked.
NOTE: The following instructions assume that you are using a Kubernetes environment such as OKE. Other environments or deployments may require alternative mechanisms for retrieving addresses, ports, and such.
Follow these steps to test the endpoints.
-
Get the generated host name for the application.
$ HOST=$(kubectl get gateways.networking.istio.io hello-helidon-hello-helidon-gw \ -n hello-helidon \ -o jsonpath='{.spec.servers[0].hosts[0]}') $ echo $HOST # Sample output hello-helidon-appconf.hello-helidon.11.22.33.44.nip.io
-
Get the
EXTERNAL_IP
address of theistio-ingressgateway
service.$ ADDRESS=$(kubectl get service \ -n istio-system istio-ingressgateway \ -o jsonpath='{.status.loadBalancer.ingress[0].ip}') $ echo $ADDRESS # Sample output 11.22.33.44
-
Access the application.
-
Using the command line
$ curl -sk \ -X GET \ https://${HOST}/greet \ --resolve ${HOST}:443:${ADDRESS} # Expected response output {"message":"Hello World!"}
If you are using
nip.io
, then you do not need to include--resolve
. -
Local testing with a browser
Temporarily, modify the
/etc/hosts
file (on Mac or Linux) orc:\Windows\System32\Drivers\etc\hosts
file (on Windows 10), to add an entry mapping the host name to the ingress gateway’sEXTERNAL-IP
address. For example:11.22.33.44 hello-helidon.example.com
Then you can access the application in a browser at
https://<host>/greet
.- If you are using
nip.io
, then you can access the application in a browser using theHOST
variable (for example,https://${HOST}/greet
). - If you are going through a proxy, then you may need to add
*.nip.io
to theNO_PROXY
list.
- If you are using
-
Using your own DNS name
Point your own DNS name to the ingress gateway’s
EXTERNAL-IP
address.- In this case, you would need to edit the
hello-helidon-app.yaml
file to use the appropriate value under thehosts
section (such asyourhost.your.domain
), before deploying thehello-helidon
application. - Then, you can use a browser to access the application at
https://<yourhost.your.domain>/greet
.
- In this case, you would need to edit the
-
-
A variety of endpoints associated with the deployed application are available to further explore the logs, metrics, and such. You can access them according to the directions here.
Troubleshooting
-
Verify that the application configuration, domain, and ingress trait all exist.
$ kubectl get ApplicationConfiguration -n hello-helidon $ kubectl get IngressTrait -n hello-helidon
-
Verify that the
hello-helidon
service pods are successfully created and transition to theREADY
state. Note that this may take a few minutes and that you may see some of the services terminate and restart.$ kubectl get pods -n hello-helidon # Sample output NAME READY STATUS RESTARTS AGE hello-helidon-workload-676d97c7d4-wkrj2 2/2 Running 0 5m39s
Undeploy the application
-
To undeploy the application, delete the Hello World Helidon OAM resources.
$ kubectl delete -f https://raw.githubusercontent.com/verrazzano/verrazzano/v1.7.2/examples/hello-helidon/hello-helidon-app.yaml -n hello-helidon $ kubectl delete -f https://raw.githubusercontent.com/verrazzano/verrazzano/v1.7.2/examples/hello-helidon/hello-helidon-comp.yaml -n hello-helidon
-
Delete the namespace
hello-helidon
after the application pod is terminated.$ kubectl delete namespace hello-helidon
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.