Deploying Your First Service
Let’s deploy a simple Hello World service to verify that Knative is working correctly.
Creating a Simple Service
Create a file named service.yaml:
apiVersion: serving.knative.dev/v1kind: Servicemetadata: name: hellospec: template: spec: containers: - image: gcr.io/knative-samples/helloworld-go env: - name: TARGET value: "Knative"Deploy the service:
kubectl apply -f service.yamlVerifying the Deployment
Check the service status:
kubectl get ksvc helloYou should see output similar to:
NAME URL READY REASONhello http://hello.default.example.com TrueTesting the Service
Get the service URL and test it:
export SERVICE_URL=$(kubectl get ksvc hello -o jsonpath='{.status.url}')curl $SERVICE_URLYou should see: Hello Knative!
Congratulations! You’ve deployed your first Knative service.