From cdca042c1df97448676feafbfafc6a76ea09c307 Mon Sep 17 00:00:00 2001 From: navinger Date: Wed, 16 May 2018 17:20:17 -0700 Subject: [PATCH 1/2] Create k8s-grpc-bookstore.yaml I'm in the process of adding a tutorial to the Endpoints gRPC docs for running the bookstore sample on Kubernetes (K8s). I need this file for the tutorial so that the only thing people have to configure is the SERVICE_NAME. --- endpoints/kubernetes/k8s-grpc-bookstore.yaml | 70 ++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 endpoints/kubernetes/k8s-grpc-bookstore.yaml diff --git a/endpoints/kubernetes/k8s-grpc-bookstore.yaml b/endpoints/kubernetes/k8s-grpc-bookstore.yaml new file mode 100644 index 00000000000..aa7dee740f8 --- /dev/null +++ b/endpoints/kubernetes/k8s-grpc-bookstore.yaml @@ -0,0 +1,70 @@ +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License + +apiVersion: v1 +kind: Service +metadata: + name: esp-grpc-bookstore +spec: + ports: + # Port that accepts gRPC and JSON/HTTP2 requests over HTTP. + - port: 80 + targetPort: 9000 + protocol: TCP + name: http2 + selector: + app: esp-grpc-bookstore + type: LoadBalancer +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: esp-grpc-bookstore +spec: + replicas: 1 + template: + metadata: + labels: + app: esp-grpc-bookstore + spec: + # [START secret-1] + volumes: + - name: service-account-creds + secret: + secretName: service-account-creds + # [END secret-1] + # [START service] + containers: + - name: esp + image: gcr.io/endpoints-release/endpoints-runtime:1 + args: [ + "--http2_port=9000", + "--service=SERVICE_NAME", + "--rollout_strategy=managed", + "--backend=grpc://127.0.0.1:8000", + "--service_account_key=/etc/nginx/creds/service-account-creds.json" + ] + # [END service] + ports: + - containerPort: 9000 + # [START secret-2] + volumeMounts: + - mountPath: /etc/nginx/creds + name: service-account-creds + readOnly: true + # [END secret-2] + - name: bookstore + image: gcr.io/endpointsv2/python-grpc-bookstore-server:1 + ports: + - containerPort: 8000 From ab72187f8878fd2973feaa76c44175f852ee7aaf Mon Sep 17 00:00:00 2001 From: Nancy Avinger Date: Thu, 17 May 2018 15:26:18 -0700 Subject: [PATCH 2/2] Added comments to explain the purpose of the files. --- endpoints/kubernetes/grpc-bookstore.yaml | 4 ++++ endpoints/kubernetes/k8s-grpc-bookstore.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/endpoints/kubernetes/grpc-bookstore.yaml b/endpoints/kubernetes/grpc-bookstore.yaml index 5072063aca8..8a890b6b3c7 100644 --- a/endpoints/kubernetes/grpc-bookstore.yaml +++ b/endpoints/kubernetes/grpc-bookstore.yaml @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License +# Use this file to deploy the container for the grpc-bookstore sample +# and the container for the Extensible Service Proxy (ESP) to +# Google Kubernetes Engine (GKE). + apiVersion: v1 kind: Service metadata: diff --git a/endpoints/kubernetes/k8s-grpc-bookstore.yaml b/endpoints/kubernetes/k8s-grpc-bookstore.yaml index aa7dee740f8..54f2b4be619 100644 --- a/endpoints/kubernetes/k8s-grpc-bookstore.yaml +++ b/endpoints/kubernetes/k8s-grpc-bookstore.yaml @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License +# Use this file to deploy the container for the grpc-bookstore sample +# and the container for the Extensible Service Proxy (ESP) to a +# Kubernetes cluster that is not on GCP. + apiVersion: v1 kind: Service metadata: