mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
34 lines
955 B
Plaintext
34 lines
955 B
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * serverless/getting-started-knative-services.adoc
|
|
|
|
[id="creating-knative-services_{context}"]
|
|
= Creating a Knative service
|
|
|
|
To create a service, you must create the `service.yaml` file.
|
|
|
|
You can copy the sample below. This sample will create a sample golang application called `helloworld-go` and allows you to specify the image for that application.
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: serving.knative.dev/v1alpha1 <1>
|
|
kind: Service
|
|
metadata:
|
|
name: helloworld-go <2>
|
|
namespace: default <3>
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- image: gcr.io/knative-samples/helloworld-go <4>
|
|
env:
|
|
- name: TARGET <5>
|
|
value: "Go Sample v1"
|
|
----
|
|
|
|
<1> Current version of Knative
|
|
<2> The name of the application
|
|
<3> The namespace the application will use
|
|
<4> The URL to the image of the application
|
|
<5> The environment variable printed out by the sample application
|