Give me step by step tutor that try to implmene a simple rest api leveraging this…
- User
Give me step by step tutor that try to implmene a simple rest api leveraging this “Kubernetes-native microservices What does it mean to develop Kubernetes-native microservices? It’s developing a microservice with the understanding that Kubernetes is the underlying deployment platform and is facilitated by having a Kubernetes runtime like Quarkus. How is this different from any other microservice, or the frequently mentioned “cloud-native Java”? Some differentiating characteristics follow: Low memory consumption—A Kubernetes cluster is a shared infrastructure, and organizations want to extract as much value out of their Kubernetes investment by consolidating as many services across as many departments on a Kubernetes cluster as possible. Reduced memory consumption is a gating factor. Until runtimes like Quarkus, organizations were considering leaving Java runtimes for Node.js or Golang to better utilize their Kubernetes clusters. Fast startup—Kubernetes can automatically create new microservice instances to meet demand. Without fast startup, existing instances can become overloaded and fail before new instances come online, impacting overall application stability. This potential complication can also impact rolling upgrades when a new version of a service is incrementally deployed to replace an existing one. Minimize operating system threads—A Kubernetes node may be running hundreds of microservice instances, each of which may have up to hundreds of threads. It is not uncommon for a thread to consume a megabyte of memory. In addition, the operating system scheduler works increasingly harder as the number of threads increases. Quarkus runs its asynchronous, reactive, and (by default) traditional thread-blocking imperative APIs on an event loop, which significantly reduces the number of threads. Consume Kubernetes ConfigMaps—Services deployed to Kubernetes can be configured using a Kubernetes ConfigMap. A ConfigMap is a file that is typically mounted to a pod filesystem. However, Quarkus can seamlessly use the Kubernetes client API to access a ConfigMap without mounting the filesystem in the pod, simplifying configuration. Expose health endpoints—A service should always expose its health so Kubernetes can restart an unhealthy service or redirect traffic away from a pod that Summary 19 is temporarily unavailable. In addition to supporting custom health checks, Quarkus has built-in data source and messaging client (ActiveMQ and Kafka) readiness health checks to automatically pause traffic when those backend services are unavailable. Support CNCF projects—CNCF is the Cloud-Native Computing Foundation, which is responsible for the evolution of Kubernetes and related projects like Prometheus monitoring (using the OpenMetrics format) and Jaeger (using OpenTracing/OpenTelemetry). Inherent Kubernetes deployment support—Quarkus has built-in support for deploying to Kubernetes. It enables a developer to compile, package, and deploy a microservice to Kubernetes using a one-line Maven (or Gradle) command. In addition, Quarkus requires no Kubernetes YAML expertise. Kubernetes YAML is generated automatically and can be customized using Java properties. Kubernetes client API—Quarkus includes a Java-friendly API for interacting with a Kubernetes cluster, enabling programmatic access to any Kubernetes capability to extend or tailor it for enterprises needs. Summary A microservice models and implements a subset of business functionality called a bounded context. A microservices architecture is a collection of evolving, collaborating microservices. MicroProfile is a collection of microservice specifications that facilitate the creation of portable microservices across multiple implementations. Microservices have evolved from running in a shared environment, like an application server, to running on a single-application stack. Kubernetes has replaced the application server as the shared application environment. Quarkus is a Java single-application stack that can efficiently run MicroProfile applications on Kubernetes.”
- Assistant