// Module is included in the following assemblies:
//
// serverless/knative-client.adoc

[id="basic-workflow_{context}"]
= Basic workflow using Knative Client

Use this basic workflow to create, read, update, delete (CRUD) operations on a service. The following example deploys a link:https://github.com/knative/docs/tree/master/docs/serving/samples/hello-world/helloworld-go[simple Hello World service] that reads the environment variable `TARGET` and prints its output.


.Procedure

. Create a service in the `default` namespace from an image.
+
----
$ kn service create hello --image gcr.io/knative-samples/helloworld-go --env TARGET=Knative

Service 'hello' successfully created in namespace 'default'.
Waiting for service 'hello' to become ready ... OK

Service URL:
http://hello.default.apps-crc.testing
----

. List the service.
+
----
$ kn service list

NAME    URL                                     GENERATION   AGE   CONDITIONS   READY   REASON
hello   http://hello.default.apps-crc.testing   1            85s   3 OK / 3     True    
----

. Check if the service is working by using the `curl` service endpoint command:
+
----
$ curl http://hello.default.apps-crc.testing

Hello Knative!
----

. Update the service.
+
----
$ kn service update hello --env TARGET=Kn

Waiting for service 'hello' to become ready ... OK
Service 'hello' updated in namespace 'default'.
----
+
The service's environment variable `TARGET` is now set to `Kn`.


. Describe the service.
+
----
$ kn service describe hello

Name:         hello
Namespace:    default
URL:          http://hello.default.apps-crc.testing
Address:      http://hello.default.svc.cluster.local
Annotations:  serving.knative.dev/creator=kube:admin, serving.knative.dev/lastModifier=kube:admin
Age:          34m

Revisions:
  100%  Name:    hello-fszsh-2 [2] (35s)
        Image:   gcr.io/knative-samples/helloworld-go (pinned to 5ea96ba4b872)
        Env:     TARGET=Kn
        Memory:  100M ... 200M
        CPU:     400m ... 1

Conditions:
  OK TYPE                   AGE REASON
  ++ ConfigurationsReady    22s 
  ++ Ready                  22s 
  ++ RoutesReady            22s ribe hello
----

. Delete the service.
+
----
$ kn service delete hello

Service 'hello' successfully deleted in namespace 'default'.
----
+
You can then verify that the 'hello' service is deleted by attempting to `list` it.
+
----
$ kn service list hello

No services found.
----
