6.3. kn CLI を使用したサーバーレスアプリケーションの作成
以下の手順では、kn
CLI を使用して基本的なサーバーレスアプリケーションを作成する方法を説明します。
前提条件
- OpenShift Serverless Operator および Knative Serving がクラスターにインストールされていること。
-
kn
CLI がインストールされていること。
手順
Knative サービスを作成します。
$ kn service create <service_name> --image <image> --env <key=value>
コマンドの例
$ kn service create hello --image docker.io/openshift/hello-openshift --env RESPONSE="Hello Serverless!"
出力例
Creating service 'hello' in namespace 'default': 0.271s The Route is still working to reflect the latest desired specification. 0.580s Configuration "hello" is waiting for a Revision to become ready. 3.857s ... 3.861s Ingress has not yet been reconciled. 4.270s Ready to serve. Service 'hello' created with latest revision 'hello-bxshg-1' and URL: http://hello-default.apps-crc.testing