This serves as an example of how to leverage Okteto to build a web-based service based in Kubernetes.
The endpoints defined under /api
is defined via OpenAPI spec, located in this project at <ROOT>/api/sample.openapi3.json
. This can be rendered using Swagger's editor.
The /ping
endpoint was added to test Prometheus integration, and to refactor the handlers to support the generated API and a new endpoint at the same level at /api
.
The /metrics
endpoint supports Prometheus.
The make
targets are patterned for common tasks for a Go project. Most are rather self-explanatory, and should work locally or on an Okteto development environment.
Any changes to the OpenAPI spec definition, requires that make gen
is run so the API interface is updated.
Once a change is made to the functionality in the server code, the Docker image needs to be updated and deployed. This can be done with make build-image
.
This example shows how to use Okteto to develop a Go Sample App directly in Kubernetes. The Go Sample App is deployed using Kubernetes manifests.
This is the application used for the How to Develop and Debug Go Applications in Kubernetes blog post.