diff --git a/step0.md b/step0.md index ff1c242..671ec6f 100644 --- a/step0.md +++ b/step0.md @@ -132,13 +132,13 @@ $ kubectl get nodes ```shell $ kubectl apply --selector knative.dev/crd-install=true \ - --filename https://github.com/knative/serving/releases/download/v0.9.0/serving.yaml \ - --filename https://github.com/knative/eventing/releases/download/v0.9.0/release.yaml \ - --filename https://github.com/knative/serving/releases/download/v0.9.0/monitoring.yaml + --filename https://github.com/knative/serving/releases/download/v0.10.0/serving.yaml \ + --filename https://github.com/knative/eventing/releases/download/v0.10.0/release.yaml \ + --filename https://github.com/knative/serving/releases/download/v0.10.0/monitoring.yaml -$ kubectl apply --filename https://github.com/knative/serving/releases/download/v0.9.0/serving.yaml \ - --filename https://github.com/knative/eventing/releases/download/v0.9.0/release.yaml \ - --filename https://github.com/knative/serving/releases/download/v0.9.0/monitoring.yaml +$ kubectl apply --filename https://github.com/knative/serving/releases/download/v0.10.0/serving.yaml \ + --filename https://github.com/knative/eventing/releases/download/v0.10.0/release.yaml \ + --filename https://github.com/knative/serving/releases/download/v0.10.0/monitoring.yaml ``` つぎのコマンドを実行して確認ステータスを確認してください。すべてのPodのStatusが*Running*になれば設定完了です。 @@ -152,13 +152,13 @@ $ kubectl get pods --namespace knative-monitoring EventingでKnativeのServiceをsinkに指定する場合は現状追加でセットアップが必要です。本ワークショップをEventing含めて実施する場合はつぎのコマンドを実行してください。 ``` -$ kubectl apply -f https://raw.githubusercontent.com/knative/serving/master/third_party/istio-1.2.7/istio-knative-extras.yaml +$ kubectl apply -f https://raw.githubusercontent.com/knative/serving/release-0.10/third_party/istio-1.2.7/istio-knative-extras.yaml # Istioのバージョン確認 # $ kubectl get pod -n istio-system # istio-ingressgateway-f659695c4-sssrs # $ kubectl get pod istio-ingressgateway-f659695c4-sssrs -n istio-system -oyaml | grep image -# image: gke.gcr.io/istio/proxyv2:1.1.13-gke.0 +# image: gke.gcr.io/istio/proxyv2:1.1.16-gke.0 # => OK: 1.2.7, NG: 1.3.3 ``` diff --git a/step1.md b/step1.md index 8cf402e..d1a5330 100644 --- a/step1.md +++ b/step1.md @@ -259,7 +259,7 @@ spec: $ kubectl apply --filename blue-green-route.yaml ``` -図のようにRouteが -> Revisonの状態になります。 +図のようにRoute -> Revisonの状態になります。 ![](./images/revision_blue_100.png) @@ -445,7 +445,7 @@ kind: CronJobSource metadata: name: cronjob-source spec: - schedule: "*/1 * * * *" + schedule: "*/2 * * * *" data: '{"message": "Hello Eventing!"}' sink: apiVersion: serving.knative.dev/v1alpha1 @@ -459,7 +459,7 @@ spec: $ kubectl apply --filename cronjob-source.yaml ``` -`CronJobSource`はspec.scheduleに記述したクロン式に従ってイベントを発行します。この例では1分毎にHello Eventing!というメッセージを発行します。 +`CronJobSource`はspec.scheduleに記述したクロン式に従ってイベントを発行します。この例では30秒毎にHello Eventing!というメッセージを発行します。 KnativeのServiceで受信したメッセージはコンテナのログで確認できます。つぎのコマンドを実行してメッセージを確認してください。 @@ -478,7 +478,7 @@ $ kubectl delete --filename cronjob-source.yaml * 実行したアプリケーションのソースコード * [event_display](https://github.com/knative/eventing-contrib/blob/master/cmd/event_display/main.go) -* Eventing v0.9でKnative Servingを利用するにあたりcluster local gatewayを別途セットアップしなければならない件 +* Eventing v0.9、0.10でKnative Servingを利用するにあたりcluster local gatewayを別途セットアップしなければならない件 * [Cluster local issue with Knative Eventing v0.9.0](https://medium.com/google-cloud/cluster-local-issue-with-knative-eventing-v0-9-0-a1fee2215cfe) * https://github.com/knative/eventing/issues/1973 @@ -494,7 +494,7 @@ https://cloud.google.com/pubsub/docs/overview まずGCP Cloud Pub/Subをイベントソースとするためにつぎのコマンドを実行してください。 ```shell -$ kubectl apply -f https://github.com/google/knative-gcp/releases/download/v0.9.0/cloud-run-events.yaml +$ kubectl apply -f https://github.com/google/knative-gcp/releases/download/v0.10.1/cloud-run-events.yaml ``` 利用しているGCPプロジェクトでCloud Pub/Sub APIを有効化してください。 @@ -552,7 +552,7 @@ $ kubectl apply --filename event-display-service.yaml つぎのマニフェストを`pullsubscription.yaml`という名前で保存し、適用してください。specにはPubSubのtopic名とイベントの送信先を記述しています。 ```yaml -apiVersion: pubsub.cloud.run/v1alpha1 +apiVersion: pubsub.cloud.google.com/v1alpha1 kind: PullSubscription metadata: name: testing-source-event-display @@ -566,8 +566,8 @@ spec: ```shell $ kubectl apply -f pullsubscription.yaml -# 少し時間がかかるので注意 -$ kubectl get pullsubscription -w +# READYがTRUEになるまで少し時間がかかるので注意 +$ kubectl get pullsubscription ``` PubSubのトピックにイベントを発行してください。メッセージはなんでも大丈夫です。 diff --git a/step4.md b/step4.md index 9ba4680..f88d218 100644 --- a/step4.md +++ b/step4.md @@ -15,7 +15,7 @@ $ gcloud config set run/platform managed $ gcloud config set run/region asia-northeast1 # コンテナイメージをCloud Runにデプロイ -$ gcloud beta run deploy --image gcr.io/knative-samples/helloworld-go +$ gcloud run deploy --image gcr.io/knative-samples/helloworld-go # プロンプト ## Service Name (helloworld-go): 何も入力せずEnter ## Allow unauthenticated invocations to [helloworld-go]: y @@ -41,7 +41,7 @@ Hello World! 環境変数をセットしてリクエストし直してみましょう。 ```shell -$ gcloud beta run services update helloworld-go --update-env-vars TARGET="Cloud Run!" +$ gcloud run services update helloworld-go --update-env-vars TARGET="Cloud Run!" $ curl $HELLO_WORLD_GO_URL Hello Cloud Run! ``` @@ -57,7 +57,19 @@ $ hey -z 10s -c 5 $HELLO_WORLD_GO_URL https://console.cloud.google.com/run/detail/asia-northeast1/helloworld-go/metrics -現状ServingのAPIのすべての機能もサポートしていないベータ段階のサービスですが、順次機能追加されています。コンテナベースのアプリケーションをメインで扱っていなくても、既存のコンテナをサーバーレスなAPIにするなど触れ合う機会は増えていくかもしれません。 +step1と同様にトラフィック分割を試してみましょう。 + +トラフィックを流すRevision名はコンソールから確認してください。 + +https://console.cloud.google.com/run/detail/asia-northeast1/helloworld-go/revisions + +```shell +# Revision名はご自身のものに置き換えてください +$ gcloud alpha run services update-traffic --region=asia-northeast1 --platform=managed --to-revisions=helloworld-go-00002-xob=50,helloworld-go-00001-yul=50 +$ curl $HELLO_WORLD_GO_URL +``` + +Cloud Runは2019年11月にGAされたリリースですが、現状Knative ServingのAPIすべてに互換性があるわけではなく、順次機能追加されています。コンテナベースのアプリケーションをメインで扱っていなくても、既存のコンテナをサーバーレスなAPIにするなど触れ合う機会は増えていくかもしれません。 また、GKEやオンプレミス、マルチクラウド環境などでCloud Runを構築・実行する[Cloud Run for Anthos](https://cloud.google.com/run/docs/gke/setup)もあります。 @@ -71,5 +83,7 @@ https://cloud.google.com/serverless-options/ * [Cloud Run、Cloud Run for Anthosの機能比較](https://cloud.google.com/run#choose-the-platform-that-fits-you) * [Cloud Run on GKEに覗くKnative](https://qiita.com/toshi0607/items/eeeabe81b1beac343b6b) * [Anthos](https://cloud.google.com/anthos/) +* [Mastering Serverless Applications with Google Cloud Run](https://learning.oreilly.com/library/view/mastering-serverless-applications/9781492057086/) + * Early Release段階ですが、Cloud FunctionsやApp Engineとの使い分けや、ServerlessなコンピューティングソリューションをFunctionとServiceに分類するなど視点が面白く感性が期待されます。 [戻る](step3.md) | [次へ](step5.md)