{"id":18429141,"url":"https://github.com/openliberty/guide-cloud-google","last_synced_at":"2025-04-07T17:32:46.968Z","repository":{"id":40379929,"uuid":"243283819","full_name":"OpenLiberty/guide-cloud-google","owner":"OpenLiberty","description":"A guide on how to deploy microservices to Google Kubernetes Engine (GKE) on Google Cloud Platform (GCP).","archived":false,"fork":false,"pushed_at":"2024-05-22T15:48:38.000Z","size":270,"stargazers_count":3,"open_issues_count":2,"forks_count":3,"subscribers_count":6,"default_branch":"prod","last_synced_at":"2024-05-22T16:56:36.381Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://openliberty.io/guides/cloud-google.html","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenLiberty.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-26T14:33:51.000Z","updated_at":"2024-06-05T21:26:46.920Z","dependencies_parsed_at":"2024-04-23T20:56:33.151Z","dependency_job_id":"5e199944-db8f-4b0b-9a71-6b251f7458b2","html_url":"https://github.com/OpenLiberty/guide-cloud-google","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fguide-cloud-google","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fguide-cloud-google/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fguide-cloud-google/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fguide-cloud-google/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenLiberty","download_url":"https://codeload.github.com/OpenLiberty/guide-cloud-google/tar.gz/refs/heads/prod","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247697945,"owners_count":20981277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T05:15:59.951Z","updated_at":"2025-04-07T17:32:46.631Z","avatar_url":"https://github.com/OpenLiberty.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"// Copyright (c) 2020, 2021 IBM Corporation and others.\n// Licensed under Creative Commons Attribution-NoDerivatives\n// 4.0 International (CC BY-ND 4.0)\n//   https://creativecommons.org/licenses/by-nd/4.0/\n//\n// Contributors:\n//     IBM Corporation\n//\n:projectid: cloud-google\n:page-layout: guide-multipane\n:page-duration: 1 hour\n:page-releasedate: 2020-03-27\n:page-description: Explore how to deploy microservices to Google Cloud Platform Kubernetes Engine (GKE).\n:page-tags: ['Kubernetes', 'Docker', 'Cloud']\n:page-permalink: /guides/{projectid}\n:page-related-guides: ['kubernetes-intro', 'kubernetes-microprofile-config', 'kubernetes-microprofile-health']\n:common-includes: https://raw.githubusercontent.com/OpenLiberty/guides-common/prod\n:source-highlighter: prettify\n:page-seo-title: Deploying Java microservices to Google Cloud Platform with Kubernetes\n:page-seo-description: A getting started tutorial with examples on how to deploy Java microservices to Google Cloud Platform (GCP) using Google Kubernetes Engine (GKE).\n:guide-author: Open Liberty\n:page-essential: false\n= Deploying microservices to Google Cloud Platform\n\n[.hidden]\nNOTE: This repository contains the guide documentation source. To view the guide in published form,\nview it on the https://openliberty.io/guides/{projectid}.html[Open Liberty website].\n\nExplore how to deploy microservices to Google Kubernetes Engine (GKE) on Google Cloud Platform (GCP).\n\n:kube: Kubernetes\n:hashtag: #\n:win: WINDOWS\n:mac: MAC\n:linux: LINUX\n:system-api: http://[hostname]:31000/system/properties\n:inventory-api: http://[hostname]:32000/inventory/systems\n\n\n// =================================================================================================\n// Introduction\n// =================================================================================================\n\n== What you'll learn\n\nYou will learn how to deploy two microservices in Open Liberty containers to a {kube} cluster on\nGoogle Kubernetes Engine (GKE).\n\nKubernetes is an open source container orchestrator that automates many tasks that are involved in \ndeploying, managing, and scaling containerized applications. If you would like to learn\nmore about Kubernetes, check out the https://openliberty.io/guides/kubernetes-intro.html[Deploying microservices to Kubernetes^]\nguide.\n\nThere are different cloud-based solutions for running your {kube} workloads. \nWith a cloud-based infrastructure, you can focus on developing your microservices \nwithout worrying about low-level infrastructure details for deployment. Using a cloud helps\nyou easily scale and manage your microservices in a high-availability setup.\n\nGoogle Cloud Platform offers a managed {kube} service called Google Kubernetes Engine (GKE). Using GKE simplifies the process of running Kubernetes on Google Cloud Platform without \nneeding to install or maintain your own Kubernetes control plane. It provides a hosted {kube} \ncluster that you can deploy your microservices to. In this guide, you will use GKE with a Google\nContainer Registry (GCR). GCR is a private registry that is used to store \nand distribute your container images. Because GKE is hosted on Google Cloud Platform, fees might be associated with running this guide. See the official\nhttps://cloud.google.com/kubernetes-engine/pricing[GKE pricing^] documentation for more details.\n\nThe two microservices you will deploy are called `system` and `inventory`. \nThe `system` microservice returns the JVM system properties of the running container. \nIt also returns the name of the pod in the HTTP header, which makes replicas easy to distinguish from each other. \nThe `inventory` microservice adds the properties from the `system` microservice to the inventory. \nThis demonstrates how communication can be established between pods inside a cluster.\n\n// =================================================================================================\n// Prerequisites\n// =================================================================================================\n\n== Additional prerequisites\n\nBefore you begin, the following tools need to be installed:\n\n* *Google account:* To run this guide and use Google Cloud Platform, you will need a Google account. If you do not\nhave an account already, navigate to the \nhttps://accounts.google.com/signup[Google account sign-up page^] \nto create a Google account.\n\n* *Google Cloud Platform account:* Visit the https://console.cloud.google.com/[Google Cloud Platform console^] to link your\nGoogle account to Google Cloud Platform.\n\n* *Google Cloud SDK - CLI:* You will need to use the `gcloud` command-line tool that is included in the https://cloud.google.com/sdk[Google Cloud SDK^]. \nSee the official\nhttps://cloud.google.com/sdk/docs/quickstarts[Cloud SDK: Command Line Interface - Quickstart^]\ndocumentation and complete the “Before you begin” section to set up the Google Cloud Platform CLI for your platform. \nTo verify that the `gcloud` tool is installed correctly, run the following command:\n\n+\n[role=command]\n```\ngcloud info\n```\n\n* *kubectl:* You need the Kubernetes `kubectl` command-line tool to interact with your Kubernetes cluster.\nIf `kubectl` is not already installed, use the Google Cloud Platform CLI to download and install `kubectl` with the following command:\n\n+\n[role=command]\n```\ngcloud components install kubectl\n```\n\n// =================================================================================================\n// Getting started\n// =================================================================================================\n\n[role=command]\ninclude::{common-includes}/gitclone.adoc[]\n\n// no \"try what you'll build\" section in this guide since it would be too long due to all the setup the user will have to do.\n\n// =================================================================================================\n// Setting up your Google Cloud project\n// =================================================================================================\n\n== Setting up your Google Cloud project\n\n=== Initializing the Google Cloud SDK\n\nTo create a Google Cloud Project, first initialize the Google Cloud SDK by performing the `gcloud` initial setup.\nThe `gcloud init` command starts an interactive setup that creates or modifies configuration for `gcloud`,\nsuch as setting the user account and specifying the project to use:\n\n[role=command]\n```\ngcloud init\n```\n\nFollow the prompt to log in with your Google Cloud Platform account.\nThis authorizes Google Cloud SDK to access Google Cloud Platform with your account credentials.\n\nIf you have existing projects, do not use them. Instead, create a new project for this guide. If you don't have existing projects, you will be automatically prompted to create a new one.\n\nYou will need to specify a Project ID for your project.\nEnter a Project ID that is unique within Google Cloud and matches the pattern that is described in the prompt.\n\n\nIf the Project ID is available to use, you will see the following output:\n\n[role=\"no_copy\"]\n----\nYour current project has been set to: [project-id].\n...\nYour Google Cloud SDK is configured and ready to use!\n----\n\nMake sure that billing is enabled for your project so that you can use its Google Cloud services.\nFollow the https://cloud.google.com/billing/docs/how-to/modify-project#confirm_billing_is_enabled_on_a_project[Modify a Project's Billing Settings^]\ndocumentation to enable billing for your Google Cloud project.\n\n=== Enabling Google Cloud APIs for your project\n\nTo run this guide, you need to use certain Google Cloud services, such as the\n`Compute Engine API`, `Cloud Build API`, and the `Kubernetes Engine API`.\n\nYou will use the `Compute Engine API` to set the default Compute Engine region and zone where the\nresources for your cloud deployments will be hosted.\n\nThe `Cloud Build API` allows you to build container images and push them to a Google Container Registry. \nYour private container registry manages and stores the container images that you build in later steps.\n\nTo deploy your application to Google Kubernetes Engine (GKE), you will need to enable the `Kubernetes Engine API`.\nThe container images that you build will run on a Google Kubernetes Engine cluster.\n\nEnable the necessary Google Cloud APIs for your project by using the `gcloud services enable` command.\nTo see a list of Google Cloud APIs and services that are available for your project, run the following command:\n\n[role=command]\n```\ngcloud services list --available\n```\n\nYou will see an output similar to the following example:\n\n[role=\"no_copy\"]\n----\nNAME                                                  TITLE\nabusiveexperiencereport.googleapis.com                Abusive Experience Report API\ncloudbuild.googleapis.com                             Cloud Build API\ncomposer.googleapis.com                               Cloud Composer API\ncompute.googleapis.com                                Compute Engine API\ncomputescanning.googleapis.com                        Compute Scanning API\ncontacts.googleapis.com                               Contacts API\ncontainer.googleapis.com                              Kubernetes Engine API\ncontaineranalysis.googleapis.com                      Container Analysis API\ncontainerregistry.googleapis.com                      Container Registry API\n----\n\nThe `NAME` field is the value that you need to pass into the `gcloud services enable` command to enable an API.\n\nRun the following command to enable the `Compute Engine API`, `Cloud Build API`, and `Kubernetes Engine API`:\n\n[role=command]\n```\ngcloud services enable compute.googleapis.com cloudbuild.googleapis.com container.googleapis.com\n```\n\n=== Setting the default region and zone\n\nA Compute Engine region is a geographical location that is used to host your Compute Engine resources. \nEach region is composed of multiple zones. For example, the `asia-east1` region is divided into\nmultiple zones: `asia-east1-a`, `asia-east1-b`, and `asia-east1-c`.\nSome resources are limited to specific regions or zones, and other resources are available across all regions.\nSee the\nhttps://cloud.google.com/compute/docs/regions-zones/global-regional-zonal-resources[Global, Regional, and Zonal Resources^]\ndocumentation for more details.\n\nIf resources are created without specifying a region or zone, \nthese new resources run in the default location for your project.\nThe metadata for your resources are stored at this specified Google Cloud location.\n\nRun the following command to see the list of available zones and its corresponding regions for your project:\n\n[role=command]\n```\ngcloud compute zones list\n```\n\nYou will see an output similar to the following example:\n\n[role=\"no_copy\"]\n----\nNAME                       REGION                   STATUS\nus-west1-b                 us-west1                 UP\nus-west1-c                 us-west1                 UP\nus-west1-a                 us-west1                 UP\neurope-west1-b             europe-west1             UP\neurope-west1-d             europe-west1             UP\neurope-west1-c             europe-west1             UP\nasia-east1-b               asia-east1               UP\nasia-east1-a               asia-east1               UP\nasia-east1-c               asia-east1               UP\nsouthamerica-east1-b       southamerica-east1       UP\nsouthamerica-east1-c       southamerica-east1       UP\nsouthamerica-east1-a       southamerica-east1       UP\nnorthamerica-northeast1-a  northamerica-northeast1  UP\nnorthamerica-northeast1-b  northamerica-northeast1  UP\nnorthamerica-northeast1-c  northamerica-northeast1  UP\n----\n\nThe `NAME` field and `REGION` field are the values that you will later substitute into `[zone]` and `[region]`.\n\nTo set the default Compute Engine region and zone, run the `gcloud config set compute` command.\nRemember to replace `[region]` and `[zone]` with a region and a zone that are available for your project.\nMake sure that your zone is within the region that you set.\n\n[role=command]\n```\ngcloud config set compute/region [region]\ngcloud config set compute/zone [zone]\n```\n\n// =================================================================================================\n// Uploading images to a container registry\n// =================================================================================================\n\n== Uploading images to a container registry\n\nThe starting Java project, which you can find in the `start` directory, is a multi-module Maven\nproject. It is made up of the `system` and `inventory` microservices. Each microservice exists in its own directory,\n`start/system` and `start/inventory`. Both of these directories contain a Dockerfile, which is necessary\nfor building the container images. If you're unfamiliar with Dockerfiles, check out the\nhttps://openliberty.io/guides/containerize.html[Containerizing microservices^] guide.\n\nNavigate to the `start` directory and run the following command:\n\n[role=command]\n```\ncd start\nmvn package\n```\n\nNow that your microservices are packaged, build your container images by using Google Cloud Build.\nInstead of installing Docker locally to containerize your application, you can use Cloud Build's\n`gcloud builds submit --tag` command to build a Docker image from a Dockerfile and push that image to a container registry. \nCloud Build is similar to running the `docker build` and `docker push` commands.\n\nRun the `gcloud builds submit --tag` command from the directories that contain the Dockerfiles.\nYou will build images for `system` and `inventory` by running the `gcloud builds submit --tag` command\nfrom both the `start/system` and `start/inventory` directories.\n\nNavigate to the `start/system` directory.\n\nBuild the `system` image and push it to your container registry by using Cloud Build.\nYour container registry is located at `gcr.io/[project-id]`.\nReplace `[project-id]` with the Project ID that you previously defined for your Google Cloud project.\nTo get the Project ID for your project, run the `gcloud config get-value project` command.\n\n[role=command]\n```\ngcloud builds submit --tag gcr.io/[project-id]/system:1.0-SNAPSHOT\n```\n\nIf the `system` image builds and pushes successfully, you will see the following output:\n\n[role=\"no_copy\"]\n----\nDONE\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nID                                    CREATE_TIME                DURATION  SOURCE                                                                                  IMAGES                                     STATUS\n30a71b4c-3481-48da-9faa-63f689316c3b  2020-02-12T16:22:33+00:00  1M37S     gs://[project-id]_cloudbuild/source/1581524552.36-65181b73aa63423998ae8ecdfbaeddff.tgz  gcr.io/[project-id]/system:1.0-SNAPSHOT    SUCCESS\n----\n\nNavigate to the `start/inventory` directory.\n\nBuild the `inventory` image and push it to your container registry by using Cloud Build:\n\n[role=command]\n```\ngcloud builds submit --tag gcr.io/[project-id]/inventory:1.0-SNAPSHOT\n```\n\nYou will see the following output:\n\n[role=\"no_copy\"]\n----\nDONE\n-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nID                                    CREATE_TIME                DURATION  SOURCE                                                                                  IMAGES                                       STATUS\nedbf9f6f-f01b-46cf-a998-594ad2df9bb3  2020-02-12T16:25:49+00:00  1M11S     gs://[project-id]_cloudbuild/source/1581524748.42-445ddab4cd3b4ba18e28a965e3942cea.tgz  gcr.io/[project-id]/inventory:1.0-SNAPSHOT   SUCCESS\n----\n\n\nTo verify that the images are built, run the following command to list all existing container images for your project:\n\n[role='command']\n```\ngcloud container images list\n```\n\nYour `system` and `inventory` images should appear in the list of all container images:\n\n[role=\"no_copy\"]\n----\nNAME\ngcr.io/[project-id]/inventory\ngcr.io/[project-id]/system\n----\n\n// =================================================================================================\n// Provisioning a Kubernetes cluster on GKE\n// =================================================================================================\n\n== Provisioning a Kubernetes cluster on GKE\n\nTo create your GKE cluster, use the `gcloud container clusters create` command. \nWhen the cluster is created, the command outputs information about the cluster.\nYou might need to wait while your cluster is being created.\n\nReplace `[cluster-name]` with a name that you want for your cluster.\nThe name for your cluster must contain only lowercase alphanumeric characters and `-`,\nand must start with a letter and end with an alphanumeric character.\n\n[role=command]\n```\ngcloud container clusters create [cluster-name] --num-nodes 1\n```\n\nWhen your cluster is successfully created, you will see the following output:\n\n[role=\"no_copy\"]\n----\nNAME            LOCATION   MASTER_VERSION  MASTER_IP     MACHINE_TYPE   NODE_VERSION    NUM_NODES  STATUS\n[cluster-name]  [zone]     1.13.11-gke.23  35.203.77.52  n1-standard-1  1.13.11-gke.23  1          RUNNING\n----\n\nSince a zone was not specified in the `gcloud container clusters create` command,\nyour cluster was created in the default zone that you previously set in the `gcloud config set compute/zone` command.\n\nThe `--num-nodes` option creates a cluster with a certain number of nodes in the Kubernetes node pool. \nBy default, if this option is excluded, three nodes are assigned to the node pool.\nYou created a single-node cluster since this application does not require a large amount of resources.\n\nRun the following command to check the status of the available node in your GKE cluster:\n\n[role=command]\n```\nkubectl get nodes\n```\n\nThe `kubectl get nodes` command outputs information about the node.\nThe `STATUS` of the node is in the `Ready` state:\n\n[role=\"no_copy\"]\n----\nNAME                                           STATUS   ROLES    AGE   VERSION\ngke-[cluster-name]-default-pool-be4471fe-qnl6  Ready    \u003cnone\u003e   46s   v1.14.10-gke.17\n----\n\n\n// =================================================================================================\n// Deploying microservices to GKE\n// =================================================================================================\n\n== Deploying microservices to GKE\n\nNow that your container images are built and you created a Kubernetes cluster, you can deploy the images using a Kubernetes resource definition.\n\nA Kubernetes resource definition is a `yaml` file that contains a description of all your \ndeployments, services, or any other resources that you want to deploy. All resources can \nalso be deleted from the cluster by using the same `yaml` file that you used to deploy them.\nThe [hotspot file=0]`kubernetes.yaml` resource definition file is provided for you in the `start` directory. If you are interested \nin learning more about the Kubernetes resource definition, check out the \nhttps://openliberty.io/guides/kubernetes-intro.html[Deploying microservices to Kubernetes^]\nguide.\n\nNavigate to the `start` directory.\n\n[role=\"code_command hotspot file=0\", subs=\"quotes\"]\n----\n#Update the `kubernetes.yaml` file in the `start` directory.#\n`kubernetes.yaml`\n----\n[role=\"edit_command_text\"]\nReplace [hotspot=sysImage hotspot=invImage file=0]`[project-id]` with your Project ID.\nYou can get the Project ID for your project by running the `gcloud config get-value project` command.\n\nkubernetes.yaml\n[source, Text, linenums, indent=0, role=\"code_column\"]\n----\ninclude::finish/kubernetes.yaml[]\n----\n\nThe [hotspot=sysImage hotspot=invImage file=0]`image` is the name and tag of the container image that you want \nto use for the container. The [hotspot]`kubernetes.yaml` file references the images that you pushed to your registry\nfor the [hotspot=sysImage file=0]`system` and [hotspot=invImage file=0]`inventory` repositories.\n\nThe service that is used to expose your deployments has a type of [hotspot=sysNodePort hotspot=invNodePort file=0]`NodePort`.\nThis type means you can access these services from outside of your cluster via a specific port.\nYou can expose your services in other ways, such as using a `LoadBalancer` service type or by using an `Ingress`.\nIn production, you would most likely use an `Ingress`.\n\n=== Deploying your application\n\nTo deploy your microservices to Google Kubernetes Engine, you need Kubernetes to create\nthe contents of the [hotspot]`kubernetes.yaml` file.\n\nNavigate to the `start` directory and run the following command to deploy the resources defined in the [hotspot file=0]`kubernetes.yaml` file:\n\n[role='command']\n```\nkubectl apply -f kubernetes.yaml\n```\n\nYou will see the following output:\n\n[role=\"no_copy\"]\n----\ndeployment.apps/system-deployment created\ndeployment.apps/inventory-deployment created\nservice/system-service created\nservice/inventory-service created\n----\n\nRun the following command to check the status of your pods:\n[role='command']\n```\nkubectl get pods\n```\n\nIf all the pods are healthy and running, you will see an output similar to the following example:\n[role=\"no_copy\"]\n----\nNAME                                    READY     STATUS    RESTARTS   AGE\nsystem-deployment-6bd97d9bf6-4ccds      1/1       Running   0          15s\ninventory-deployment-645767664f-nbtd9   1/1       Running   0          15s\n----\n\n=== Making requests to the microservices\n\nTo try out your microservices, you need to allow TCP traffic on your node ports, `31000` and `32000`,\nfor the `system` and `inventory` microservices.\n\nCreate a firewall rule to allow TCP traffic on your node ports:\n\n[role='command']\n```\ngcloud compute firewall-rules create sys-node-port --allow tcp:31000\ngcloud compute firewall-rules create inv-node-port --allow tcp:32000\n```\n\nTake note of the `EXTERNAL-IP` in the output of the following command. It is the hostname that you will later substitute into `[hostname]`:\n\n[role='command']\n```\nkubectl get nodes -o wide\n```\n\n[role=\"no_copy\"]\n----\nNAME                                  STATUS   ROLES    AGE   VERSION           INTERNAL-IP   EXTERNAL-IP\ngke-[cluster-name]-default-pool-be4   Ready    \u003cnone\u003e   14m   v1.13.11-gke.23   10.162.0.2    35.203.106.216\n----\n\nTo access your microservices, point your browser to the following URLs, substituting the appropriate `[hostname]` value:\n\n* `{system-api}`\n* `{inventory-api}`\n\nIn the first URL, you see a result in JSON format with the system properties of the container JVM.\nThe second URL returns an empty list, which is expected because no system properties are stored in the inventory yet. \n\nPoint your browser to the `{inventory-api}/system-service` URL. When you visit this URL, these system\nproperties are automatically stored in the inventory. Go back to `{inventory-api}` and\nyou see a new entry for `system-service`.\n\n// =================================================================================================\n// Testing the microservices\n// =================================================================================================\n\n== Testing the microservices\n\nA few tests are included for you to test the basic functionality of the microservices. \nIf a test failure occurs, then you might have introduced a bug into the code. \nTo run the tests, wait for all pods to be in the ready state before you proceed further.\n\npom.xml\n[source, xml, linenums, role='code_column']\n----\ninclude::finish/inventory/pom.xml[]\n----\n\nThe default properties that are defined in the [hotspot file=0]`pom.xml` file are:\n\n[cols=\"15, 100\", options=\"header\"]\n|===\n| *Property*                                | *Description*\n| [hotspot=cluster file=0]`cluster.ip`                         | The IP or hostname for your cluster.\n| [hotspot=system-service file=0]`system.kube.service`         | The name of the Kubernetes Service wrapping the `system` pods, `system-service` by default.\n| [hotspot=system-node-port file=0]`system.node.port`          | The NodePort of the `system-service` Kubernetes Service, 31000 by default.\n| [hotspot=inventory-node-port file=0]`inventory.node.port`    | The NodePort of the `inventory-service` Kubernetes Service, 32000 by default.\n|===\n\n\n=== Running the tests\n\nRun the Maven `failsafe:integration-test` goal to test your microservices by replacing the `[hostname]`\nwith the value determined in the previous section.\n\n[role='command']\n```\nmvn failsafe:integration-test -Dcluster.ip=[hostname]\n```\n\nIf the tests pass, you will see the following output for each service:\n\n[role=\"no_copy\"]\n----\n-------------------------------------------------------\n T E S T S\n-------------------------------------------------------\nRunning it.io.openliberty.guides.system.SystemEndpointIT\nTests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.673 sec - in it.io.openliberty.guides.system.SystemEndpointIT\n\nResults:\n\nTests run: 1, Failures: 0, Errors: 0, Skipped: 0\n----\n\n[role=\"no_copy\"]\n----\n-------------------------------------------------------\n T E S T S\n-------------------------------------------------------\nRunning it.io.openliberty.guides.inventory.InventoryEndpointIT\nTests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.222 sec - in it.io.openliberty.guides.inventory.InventoryEndpointIT\n\nResults:\n\nTests run: 4, Failures: 0, Errors: 0, Skipped: 0\n----\n\n// =================================================================================================\n// Tearing down the environment\n// =================================================================================================\n\n== Tearing down the environment\n\nIt is important to clean up your resources when you are finished with the guide so that you do not incur extra charges for ongoing usage.\n\nWhen you no longer need your deployed microservices, you can delete all {kube} resources \nby running the `kubectl delete` command:\n\n[role='command']\n```\nkubectl delete -f kubernetes.yaml\n```\n\nDelete the firewall rules for your node ports:\n\n[role='command']\n```\ngcloud compute firewall-rules delete sys-node-port inv-node-port\n```\n\nSince you are done testing your cluster, clean up all of its related sources by using the `gcloud container clusters delete` command:\n\n[role='command']\n```\ngcloud container clusters delete [cluster-name]\n```\n\nRemove the container images from the container registry:\n\n[role='command']\n```\ngcloud container images delete gcr.io/[project-id]/system:1.0-SNAPSHOT gcr.io/[project-id]/inventory:1.0-SNAPSHOT\n```\n\nDelete your Google Cloud project:\n\n[role='command']\n```\ngcloud projects delete [project-id]\n```\n\n// =================================================================================================\n// finish\n// =================================================================================================\n\n== Great work! You're done!\n\nYou have just deployed two microservices running in Open Liberty to Google Kubernetes Engine (GKE). You also \nlearned how to use `kubectl` to deploy your microservices on a {kube} cluster.\n\n// Multipane\ninclude::{common-includes}/attribution.adoc[subs=\"attributes\"]\n\n// DO NO CREATE ANYMORE SECTIONS AT THIS POINT\n// Related guides will be added in automatically here if you included them in \":page-related-guides\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenliberty%2Fguide-cloud-google","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenliberty%2Fguide-cloud-google","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenliberty%2Fguide-cloud-google/lists"}