Deploying and running a sample service on Knative
In this section, we will deploy the Hello world
sample service from the Knative samples repo. The sample service prints Hello
$TARGET!
after reading the TARGET
environment variable. If TARGET
is not given, the default value is “World
”.
Now in the following steps, we’ll deploy the service by specifying the image location and the TARGET
environment variable. We are going to create a Knative service (Serving component), which is a time-based representation of a single serverless container environment (such as a microservice). It includes both the network address for accessing the service and the application code and settings required to run the service.
A Knative service lifespan is controlled by the serving.knative.dev
CRD. To create the Knative service, we’ll use the kn
CLI as follows:
kn service create kn-serverless --image gcr.io/knative-samples/helloworld-go --env TARGET=upnxtblog.com
The following...