diff --git a/quickstarts/whereami/README.md b/quickstarts/whereami/README.md index 10525ff8f9..d90a172cd9 100644 --- a/quickstarts/whereami/README.md +++ b/quickstarts/whereami/README.md @@ -420,10 +420,10 @@ If gRPC is enabled for a given pod, that `whereami` pod will not respond to HTTP #### Step 1 - Deploy the whereami-grpc backend -Deploy the `whereami-grpc` backend using the manifests from [k8s-grpc-backend-overlay-example](k8s-grpc-backend-overlay-example): +Deploy the `whereami-grpc` backend using the manifests from [k8s-grpc-clusterip-backend-overlay-example](k8s-grpc-clusterip-backend-overlay-example): ```bash -$ kubectl apply -k k8s-grpc-backend-overlay-example +$ kubectl apply -k k8s-grpc-clusterip-backend-overlay-example serviceaccount/whereami-grpc-backend created configmap/whereami-grpc-backend created service/whereami-grpc-backend created @@ -432,6 +432,8 @@ deployment.apps/whereami-grpc-backend created This backend will listen for gRPC requests from the frontend service deployed in the following step. +> Note: use the [headless service example](k8s-grpc-headless-backend-overlay-example) for more efficient gRPC load balancing if you're not using something like a service mesh + #### Step 2 - Deploy the whereami-grpc frontend Now we're going to deploy the `whereami-grpc` frontend from the [k8s-grpc-frontend-overlay-example](k8s-grpc-frontend-overlay-example): diff --git a/quickstarts/whereami/k8s-grpc-backend-overlay-example/kustomization.yaml b/quickstarts/whereami/k8s-grpc-backend-overlay-example/kustomization.yaml deleted file mode 100644 index 86ab44d3a3..0000000000 --- a/quickstarts/whereami/k8s-grpc-backend-overlay-example/kustomization.yaml +++ /dev/null @@ -1,15 +0,0 @@ -nameSuffix: "-backend" -labels: -- includeSelectors: true - includeTemplates: true - pairs: - app: whereami-grpc-backend -resources: -- ../k8s-grpc -patches: -- path: cm-flag.yaml - target: - kind: ConfigMap -- path: service-type.yaml - target: - kind: Service diff --git a/quickstarts/whereami/k8s-grpc-clusterip-backend-overlay-example/cm-flag.yaml b/quickstarts/whereami/k8s-grpc-clusterip-backend-overlay-example/cm-flag.yaml new file mode 100644 index 0000000000..07004a9cb1 --- /dev/null +++ b/quickstarts/whereami/k8s-grpc-clusterip-backend-overlay-example/cm-flag.yaml @@ -0,0 +1,27 @@ +# Copyright 2025 Google LLC +# +# 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. + +# [START gke_k8s_grpc_clusterip_backend_overlay_example_cm_flag_configmap_whereami_grpc_configmap] +apiVersion: v1 +kind: ConfigMap +metadata: + name: whereami-grpc +data: + BACKEND_ENABLED: "False" + # when defining the BACKEND_SERVICE using an HTTP protocol, indicate HTTP or HTTPS; if using gRPC, use the host name only + BACKEND_SERVICE: "whereami-grpc-backend:9090" # substitute with corresponding service name - this example assumes both services are in the same namespace; make sure to include the port + METADATA: "grpc-backend" + GRPC_ENABLED: "True" +# [END gke_k8s_grpc_clusterip_backend_overlay_example_cm_flag_configmap_whereami_grpc_configmap] +--- diff --git a/quickstarts/whereami/k8s-grpc-clusterip-backend-overlay-example/kustomization.yaml b/quickstarts/whereami/k8s-grpc-clusterip-backend-overlay-example/kustomization.yaml new file mode 100644 index 0000000000..83e6f07fab --- /dev/null +++ b/quickstarts/whereami/k8s-grpc-clusterip-backend-overlay-example/kustomization.yaml @@ -0,0 +1,31 @@ +# Copyright 2025 Google LLC +# +# 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. + +# [START gke_k8s_grpc_clusterip_backend_overlay_example_kustomization] +nameSuffix: "-backend" +labels: +- includeSelectors: true + includeTemplates: true + pairs: + app: whereami-grpc-backend +resources: +- ../k8s-grpc +patches: +- path: cm-flag.yaml + target: + kind: ConfigMap +- path: service-type.yaml + target: + kind: Service +# [END gke_k8s_grpc_clusterip_backend_overlay_example_kustomization] diff --git a/quickstarts/whereami/k8s-grpc-backend-overlay-example/service-type.yaml b/quickstarts/whereami/k8s-grpc-clusterip-backend-overlay-example/service-type.yaml similarity index 78% rename from quickstarts/whereami/k8s-grpc-backend-overlay-example/service-type.yaml rename to quickstarts/whereami/k8s-grpc-clusterip-backend-overlay-example/service-type.yaml index 52fb68033d..aeb3b5910e 100644 --- a/quickstarts/whereami/k8s-grpc-backend-overlay-example/service-type.yaml +++ b/quickstarts/whereami/k8s-grpc-clusterip-backend-overlay-example/service-type.yaml @@ -13,12 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START gke_k8s_grpc_backend_overlay_example_service_type_service_whereami_grpc] +# [START gke_k8s_grpc_clusterip_backend_overlay_example_service_type_service_whereami_grpc] apiVersion: v1 kind: Service metadata: name: whereami-grpc spec: type: ClusterIP -# [END gke_k8s_grpc_backend_overlay_example_service_type_service_whereami_grpc] +# [END gke_k8s_grpc_clusterip_backend_overlay_example_service_type_service_whereami_grpc] --- diff --git a/quickstarts/whereami/k8s-grpc-backend-overlay-example/cm-flag.yaml b/quickstarts/whereami/k8s-grpc-headless-backend-overlay-example/cm-flag.yaml similarity index 84% rename from quickstarts/whereami/k8s-grpc-backend-overlay-example/cm-flag.yaml rename to quickstarts/whereami/k8s-grpc-headless-backend-overlay-example/cm-flag.yaml index 421d472183..a2d08a5c62 100644 --- a/quickstarts/whereami/k8s-grpc-backend-overlay-example/cm-flag.yaml +++ b/quickstarts/whereami/k8s-grpc-headless-backend-overlay-example/cm-flag.yaml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START gke_k8s_grpc_backend_overlay_example_cm_flag_configmap_whereami_grpc_configmap] +# [START gke_k8s_grpc_headless_backend_overlay_example_cm_flag_configmap_whereami_grpc_configmap] apiVersion: v1 kind: ConfigMap metadata: @@ -24,5 +24,5 @@ data: BACKEND_SERVICE: "whereami-grpc-backend:9090" # substitute with corresponding service name - this example assumes both services are in the same namespace; make sure to include the port METADATA: "grpc-backend" GRPC_ENABLED: "True" -# [END gke_k8s_grpc_backend_overlay_example_cm_flag_configmap_whereami_grpc_configmap] +# [END gke_k8s_grpc_headless_backend_overlay_example_cm_flag_configmap_whereami_grpc_configmap] --- diff --git a/quickstarts/whereami/k8s-grpc-headless-backend-overlay-example/kustomization.yaml b/quickstarts/whereami/k8s-grpc-headless-backend-overlay-example/kustomization.yaml new file mode 100644 index 0000000000..8bb1dab07f --- /dev/null +++ b/quickstarts/whereami/k8s-grpc-headless-backend-overlay-example/kustomization.yaml @@ -0,0 +1,31 @@ +# Copyright 2025 Google LLC +# +# 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. + +# [START gke_k8s_grpc_headless_backend_overlay_example_kustomization] +nameSuffix: "-backend" +labels: +- includeSelectors: true + includeTemplates: true + pairs: + app: whereami-grpc-backend +resources: +- ../k8s-grpc +patches: +- path: cm-flag.yaml + target: + kind: ConfigMap +- path: service-type.yaml + target: + kind: Service +# [END gke_k8s_grpc_headless_backend_overlay_example_kustomization] diff --git a/quickstarts/whereami/k8s-grpc-headless-backend-overlay-example/service-type.yaml b/quickstarts/whereami/k8s-grpc-headless-backend-overlay-example/service-type.yaml new file mode 100644 index 0000000000..997ee407c6 --- /dev/null +++ b/quickstarts/whereami/k8s-grpc-headless-backend-overlay-example/service-type.yaml @@ -0,0 +1,25 @@ + +# Copyright 2025 Google LLC +# +# 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. + +# [START gke_k8s_grpc_headless_backend_overlay_example_service_type_service_whereami_grpc] +apiVersion: v1 +kind: Service +metadata: + name: whereami-grpc +spec: + type: ClusterIP + clusterIP: None +# [END gke_k8s_grpc_headless_backend_overlay_example_service_type_service_whereami_grpc] +---