{"id":18429049,"url":"https://github.com/openliberty/guide-cloud-ibm","last_synced_at":"2025-07-19T17:02:34.841Z","repository":{"id":39617409,"uuid":"165309329","full_name":"OpenLiberty/guide-cloud-ibm","owner":"OpenLiberty","description":"A guide on how to deploy microservices to IBM Cloud Kubernetes Service (IKS) and IBM Cloud Private (ICP): https://openliberty.io/guides/cloud-ibm.html","archived":false,"fork":false,"pushed_at":"2025-03-03T19:00:53.000Z","size":1565,"stargazers_count":3,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"prod","last_synced_at":"2025-03-22T21:51:11.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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":"2019-01-11T21:02:52.000Z","updated_at":"2025-03-03T19:00:57.000Z","dependencies_parsed_at":"2023-11-24T20:24:10.472Z","dependency_job_id":"9e00be6a-6cc4-44a9-b8ed-cc5772ad6aa3","html_url":"https://github.com/OpenLiberty/guide-cloud-ibm","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fguide-cloud-ibm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fguide-cloud-ibm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fguide-cloud-ibm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fguide-cloud-ibm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenLiberty","download_url":"https://codeload.github.com/OpenLiberty/guide-cloud-ibm/tar.gz/refs/heads/prod","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247697900,"owners_count":20981270,"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:37.051Z","updated_at":"2025-07-19T17:02:34.829Z","avatar_url":"https://github.com/OpenLiberty.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"// Copyright (c) 2018, 2025 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-ibm\n:page-layout: guide-multipane\n:page-duration: 1 hour\n:page-releasedate: 2019-05-29\n:page-majorupdateddate: 2024-06-06\n:page-description: Explore how to deploy microservices to IBM Cloud Kubernetes Service.\n:page-tags: ['kubernetes', 'docker', 'cloud']\n:page-permalink: /guides/{projectid}\n:page-related-guides: ['kubernetes-intro', 'kubernetes-microprofile-config', 'kubernetes-microprofile-health', 'istio-intro']\n:common-includes: https://raw.githubusercontent.com/OpenLiberty/guides-common/prod\n:source-highlighter: prettify\n:page-seo-title: Deploying Java microservices to IBM Cloud Kubernetes Service\n:page-seo-description: A getting started tutorial with examples on how to deploy Java microservices to IBM Cloud Kubernetes Service using IBM Cloud Container Registry.\n:guide-author: Open Liberty\n= Deploying microservices to IBM Cloud Kubernetes Service\n\n[.hidden]\nNOTE: This repository contains the guide documentation source. To view the guide in published form, view it on the https://openliberty.io/guides/{projectid}.html[Open Liberty website^].\n\nExplore how to deploy microservices to IBM Cloud Kubernetes Service.\n\n:minikube-ip: 192.168.99.100\n:kube: Kubernetes\n:hashtag: #\n:win: WINDOWS\n:mac: MAC\n:linux: LINUX\n:system-api: http://[hostname]:[system-node-port]/system/properties\n:inventory-api: http://[hostname]:[inventory-node-port]/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 IBM Cloud. \n\nKubernetes is an open source container orchestrator that automates many tasks involved in deploying, managing, and scaling containerized applications. If you would like to learn more about Kubernetes, check out the https://openliberty.io/guides/kubernetes-intro.html[Deploying microservices to Kubernetes^] guide.\n\nDifferent cloud-based solutions are available to run your Kubernetes workloads. A cloud-based infrastructure enables you to focus on developing your microservices without worrying about low-level infrastructure details for deployment. Using a cloud helps you to easily scale and manage your microservices in a high-availability setup.\n\nThe IBM Cloud Kubernetes Service is an IBM public cloud offering. It provides a hosted Kubernetes cluster where you can deploy your microservices. In this guide, you will use it with the IBM Cloud Container Registry, which is a private registry that is used to store and distribute your container images. \n\nNote: Because the IBM Cloud Container Registry is hosted on IBM Cloud Platform, fees might be associated with running this guide. For more information, see link:https://cloud.ibm.com/docs/account?topic=account-accounts[IBM Cloud account type]. \n\nThe two microservices you will deploy are called `system` and `inventory`. The `system` microservice returns the JVM system properties of the running container. It also returns the pod’s name in the HTTP header, making replicas easy to distinguish from each other. The `inventory` microservice adds the properties from the `system` microservice to the inventory. This configuration demonstrates how to establish communication between pods inside a cluster.\n\n\n// =================================================================================================\n// Prerequisites\n// =================================================================================================\n\n== Additional prerequisites\n\nBefore you begin, the following additional tools need to be installed:\n\n* *Docker:* You need a containerization software for building containers. {kube} supports various container types, but you will use Docker in this guide. For installation instructions, refer to the official https://docs.docker.com/install/[Docker^] documentation.\n\n* *kubectl:* You need the {kube} command-line tool `kubectl` to interact with your {kube} cluster. See the official https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl[Install and Set Up kubectl^] documentation for information about downloading and setting up `kubectl` on your platform.\n\n* *IBM Cloud CLI:* You will use the IBM Cloud CLI to interact with IBM Cloud. To install the IBM Cloud CLI for your platform, run one of the following commands:\n\ninclude::{common-includes}/os-tabs.adoc[]\n\n[.tab_content.windows_section]\n--\nOpen command prompt as an administrator and run the following command.\n\n[role=command]\n```\npowershell -command \"Set-ExecutionPolicy Unrestricted; iex(New-Object Net.WebClient).DownloadString('https://clis.cloud.ibm.com/install/powershell')\"\n```\n--\n\n[.tab_content.mac_section]\n--\n[role=command]\n```\ncurl -fsSL https://clis.cloud.ibm.com/install/osx | sh\n```\n--\n\n[.tab_content.linux_section]\n--\n[role=command]\n```\ncurl -fsSL https://clis.cloud.ibm.com/install/linux | sh\n```\n--\n\n* *IBM Cloud Container Registry plug-in:*\nTo install the container registry plug-in, run the following command:\n+\n[role=command]\n```\nibmcloud plugin install container-registry\n```\n\n\n* *IBM Cloud Kubernetes Service plug-in:* \nTo install the {kube} registry plug-in, run the following command:\n+\n[role=command]\n```\nibmcloud plugin install kubernetes-service\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 because it would be too long due to all setup the user will have to do.\n\n// =================================================================================================\n// Creating a Kubernetes cluster on IBM Cloud\n// =================================================================================================\n\n== Creating a Kubernetes cluster on IBM Cloud\n\nBefore you can deploy your microservices, you must create a {kube} cluster on IBM Cloud.\n\n// =================================================================================================\n// Configuring IBM Cloud CLI\n// =================================================================================================\n\n=== Configuring IBM Cloud CLI\n\nLog in to IBM Cloud by using the `ibmcloud` command line. When you are prompted to select a region, for example, choose `us-south`. This allows you to create a free cluster, which is limited to specific regions. Note that if you are using a federated user ID, you will have to use the `--sso` flag to get a one-time code for single sign-on.\n\n[role=command]\n```\nibmcloud login\n```\n\n// =================================================================================================\n// Provisioning a cluster\n// =================================================================================================\n\n=== Provisioning a cluster\n\nTo create a {kube} cluster on IBM Cloud, you need Administrator access to IBM Cloud Kubernetes Service. To verify your Administrator access, log in to the https://cloud.ibm.com/[IBM Cloud Dashboard^]. Then, navigate to **Manage** \u003e **Access (IAM**) \u003e **Users** \u003e [Your Username] \u003e **Access** \u003e **Access Policies**. Alternatively, if you are part of an access group, you also can check **Manage** \u003e **Access (IAM)** \u003e **Access groups** \u003e [Your Access Group] \u003e **Access**. Using these steps, you can confirm that `Administrator` is listed as a policy for all resources in the account or for the Kubernetes service.\n\nOnce you confirm that you have appropriate permissions, use the following commands to provision a cluster.\n\nRetrieve the list of available Kubernetes zones for deploying the cluster within the https://cloud.ibm.com/docs/containers?topic=containers-regions-and-zones#zones-sz[IBM Cloud classic infrastructure] \n[role=command]\n```\nibmcloud ks zone ls --provider classic\n```\n\nUse the following command to retrieve a list of the available flavors of Kubernetes worker nodes for a zone. Replace the `[available_zone]` value with a zone selected from the list you generated with previous command. \n\n[role=command]\n```\nibmcloud ks flavor ls  --provider classic --zone [available_zone]\n```\n\nLook for the following output: \n[role=\"no_copy\"]\n----\nFor more information about these flavors, see 'https://ibm.biz/flavors'\nName                      Cores   Memory   Network Speed   OS             Server Type   Storage   Secondary Storage   Flavor Class   Provider\nb3c.16x64                 16      64GB     1000Mbps        UBUNTU_20_64   virtual       25GB      100GB               -              classic\nb3c.16x64.300gb           16      64GB     1000Mbps        UBUNTU_20_64   virtual       25GB      300GB               -              classic\n...\n----\n\nUse the following command to create a Kubernetes cluster. Replacing the `[selected_flavor]` value with a flavor selected from the output of the previous command and the `[available_zone]` with the previously used zone.\n\n[role=command]\n```\nibmcloud ks cluster create classic --name guide-cluster --flavor [selected_flavor] --zone [available_zone]\n```\n\nLook for the following output:\n[source, role=\"no_copy\"]\n----\nNumber of workers was not specified. Using default: 1\nCreating cluster...\nOK\nCluster created with ID [cluster-id]\n----\n\nCheck the current status of your cluster.\n\n[role=command]\n```\nibmcloud ks clusters\n```\n\nWait until your cluster is in the `normal` state before proceeding. It will start off in the `deploying` state.\n\n[role=\"no_copy\"]\n----\nName            ID                     State       Created          Workers   Location   Version       Resource Group Name   Provider   \nguide-cluster   bpp5ge4f0ck66fue46vg   deploying   4 minutes ago    1         par01      1.16.8_1526   Default               classic \n----\n\nNext, it will transition to the `pending` state.\n\n[role=\"no_copy\"]\n----\nName            ID                     State    Created          Workers   Location   Version       Resource Group Name   Provider   \nguide-cluster   bpp5ge4f0ck66fue46vg   pending  16 minutes ago   1         par01      1.16.8_1526   Default               classic \n----\n\nFinally, it will transition to the `normal` state. It may take a while for the IBM Cloud Kubernetes Service to prepare your cluster.\n\n[role=\"no_copy\"]\n----\nName            ID                     State    Created      Workers   Location   Version       Resource Group Name   Provider   \nguide-cluster   bpp5ge4f0ck66fue46vg   normal   1 hour ago   1         par01      1.16.8_1526   Default               classic\n----\n\n\nOnce your cluster is ready, connect `kubectl` to the cluster.\n\n[role=command]\n```\nibmcloud ks cluster config --cluster guide-cluster\n```\n\nVerify that you're connected to the cluster by checking the cluster's nodes.\n\n[role=command]\n```\nkubectl get nodes\n```\n\n[source, role=\"no_copy\"]\n----\nNAME           STATUS    ROLES     AGE       VERSION\n10.70.200.73   Ready     \u003cnone\u003e    1h        v1.16.8+IKS\n----\n\n// =================================================================================================\n// Deploying microservices to IBM Cloud Kubernetes Service\n// =================================================================================================\n\n== Deploying microservices to IBM Cloud Kubernetes Service\n\nIn this section, you will learn how to deploy two microservices in Open Liberty containers to a {kube} cluster on IBM Cloud. You will build and containerize the `system` and `inventory` microservices, push them to a container registry, and then deploy them to your {kube} cluster. \n\n// =================================================================================================\n// Building and containerizing the microservices\n// =================================================================================================\n\n=== Building and containerizing the microservices\n\nThe first step of deploying to {kube} is to build and containerize your microservices.\n\nThe starting Java project, which you can find in the `start` directory, is a multi-module Maven project. It's made up of the `system` and `inventory` microservices. Each microservice resides in its own directory, `start/system` and `start/inventory`. Each of these directories also contains a Dockerfile, which is necessary for building Docker images. If you're unfamiliar with Dockerfiles, check out the https://openliberty.io/guides/containerize.html[Containerizing Microservices^] guide.\n\nTo build these microservices, navigate to the `start` directory and run the following command:\n\n\ninclude::{common-includes}/os-tabs.adoc[]\n\n[.tab_content.windows_section]\n--\n[role='command']\n```\nmvnw.cmd package\n```\n--\n\n[.tab_content.mac_section]\n--\n[role='command']\n```\n./mvnw package\n```\n--\n\n[.tab_content.linux_section]\n--\n[role='command']\n```\n./mvnw package\n```\n--\n\nNext, run the `docker build` commands to build container images for your application:\n[role='command']\n```\ndocker build --platform linux/amd64 -t system:1.0-SNAPSHOT system/.\ndocker build --platform linux/amd64 -t inventory:1.0-SNAPSHOT inventory/.\n```\n\nThe `--platform` flag in the `docker build` command specifies the target platform for the build output. Because IBM Cloud Kubernetes service supports both `x86_64` and `s390x` architectures, the target platform is `linux/amd64`. Also, the `-t` flag in the command allows the Docker image to be labeled (tagged) in the `name[:tag]` format. The tag for an image describes the specific image version. If the optional `[:tag]` tag is not specified, the `latest` tag is created by default.\n\nDuring the build, you'll see various Docker messages describing what images are being downloaded and built. When the build finishes, run the following command to list all local Docker images:\n\n[role=command]\n```\ndocker images\n```\n\nVerify that the `system:1.0-SNAPSHOT` and `inventory:1.0-SNAPSHOT` images are listed among them, for example:\n\n[source, role=\"no_copy\"]\n----\nREPOSITORY                                   TAG\nsystem                                       1.0-SNAPSHOT\ninventory                                    1.0-SNAPSHOT\nicr.io/appcafe/open-liberty                  kernel-slim-java11-openj9-ubi        \n----\n\nIf you don't see the `system:1.0-SNAPSHOT` and `inventory:1.0-SNAPSHOT` images, then check the Maven build log for any potential errors.\n\n// =================================================================================================\n// Pushing the images to a container registry\n// =================================================================================================\n\n=== Pushing the images to a container registry\n\nPushing the images to a registry enables the cluster to create pods by using your container images. It's a private repository so only users with access to your IBM Cloud account will have access to these images.\n\nThe registry you will use is called IBM Cloud Container Registry. Use the container registry plug-in to create a namespace for your container images. \n\nTo create, assign, and remove namespaces, you must have the Manager role in the Container Registry service at the account level. For more information, see link:https://cloud.ibm.com/docs/Registry?topic=Registry-registry_setup_cli_namespace#registry_setup_cli_namespace_plan_perm[User permissions for working with namespaces].\n\nThe namespace must be unique within IBM Cloud for the region you selected, so choose something relevant that you'll remember for the duration of the guide.\n\n[role=command]\n```\nibmcloud cr namespace-add [your-namespace]\n```\n\nUse the plug-in again to log in to the container registry and find out your registry name, for example, `us.icr.io`.\n\n[role=command]\n```\nibmcloud cr login\n```\n\n[source, role=\"no_copy\"]\n----\nLogging 'docker' in to 'us.icr.io'...\nLogged in to 'us.icr.io'.\n----\n\n// Tagging images\nNext, tag your container images with the relevant data about your registry. Remember to replace `us.icr.io` to your registry and `[your-namespace]` with the namespace you created earlier in the guide.\n\n[role=command]\n```\ndocker tag system:1.0-SNAPSHOT us.icr.io/[your-namespace]/system:1.0-SNAPSHOT\ndocker tag inventory:1.0-SNAPSHOT us.icr.io/[your-namespace]/inventory:1.0-SNAPSHOT\n```\n\n// Pushing images\nFinally, push your images to the registry. Remember to replace `us.icr.io` to your registry and `[your-namespace]` with the namespace you created earlier in the guide.\n\n[role=command]\n```\ndocker push us.icr.io/[your-namespace]/system:1.0-SNAPSHOT\ndocker push us.icr.io/[your-namespace]/inventory:1.0-SNAPSHOT\n```\n\n// =================================================================================================\n// Deploying the microservices\n// =================================================================================================\n\n\n// =================================================================================================\n// Deploying the microservices\n// =================================================================================================\n\n=== Deploying the microservices\n\nNow that your container images are built, deploy them using a Kubernetes resource definition.\n\nA Kubernetes resource definition is a YAML file that contains a description of all your deployments, services, or any other resources that you want to deploy. All resources can also be deleted from the cluster by using the same YAML file that you used to deploy them. For this guide, the `kubernetes.yaml` resource definition file is provided for you. If you are interested in learning more about the Kubernetes resource definition, check out the https://openliberty.io/guides/kubernetes-intro.html[Deploying microservices to Kubernetes^] guide.\n\n[role=\"code_command hotspot\", subs=\"quotes\"]\n----\n#Update the `kubernetes.yaml` file in the `start` directory.#\n`kubernetes.yaml`\n----\n\nkubernetes.yaml\n[source, yaml, linenums, role='code_column']\n----\ninclude::finish/kubernetes.yaml[]\n----\n[role=\"edit_command_text\"]\nThe [hotspot=18 hotspot=39]`image` is the name and tag of the container image that you want to use for the container. Update the system [hotspot=18]`image` and the inventory [hotspot=39]`image` fields to point to your `system` and `inventory` container images. Remember to replace `us.icr.io` with your registry and `[your-namespace]` with the namespace you created earlier in the guide.\n\n\nRun the following commands to deploy the resources as defined in the `kubernetes.yaml` file:\n[role='command']\n```\nkubectl apply -f kubernetes.yaml\n```\n\nWhen the apps are deployed, run 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 see an output similar to the following:\n[source, 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\n=== Finding the microservice's IP address and ports\n\nThe service used to expose your deployments has a type of `NodePort` service that enables you to access these services from outside of your cluster through a specific port. In this case, `nodePort` is not specified and the ports are randomized so you must obtain the ports before you make requests to the services. You must also obtain the public IP address of your cluster. Other ways to expose your services are available, such as by using a `LoadBalancer` service type or  an `Ingress` resource. In production, you typically use an `Ingress` resource.\n\nFirst, find the public IP address of your cluster.\n\n[role=command]\n```\nibmcloud ks workers --cluster guide-cluster\n```\n\nTake note of the `Public IP` in the command's output. You will substitute this value as the hostname into commands later in this guide.\n\n[role=\"no_copy\"]\n----\nOK\nID                                                       Public IP         Private IP       Flavor   State    Status   Zone    Version   \nkube-bpp5ge4f0ck66fue46vg-guidecluste-default-00000048   159.122.179.207   10.144.188.209   free     normal   Ready    mil01   1.16.8_1526 \n----\n\nGet the node port of the `system` microservice.\n\n[role=command]\n```\nkubectl get service system-service -o jsonpath=\"{.spec.ports[0].nodePort}{'\\n'}\"\n```\n\nGet the node port of the `inventory` microservice.\n\n[role=command]\n```\nkubectl get service inventory-service -o jsonpath=\"{.spec.ports[0].nodePort}{'\\n'}\"\n```\n\nTake note of the IP address and ports. They are required to make the HTTP requests.\n\n=== Making requests to the microservices\n\nTo make a request to the `system` and `inventory` microservices,  `curl` or visit the following URLs to access your microservices, substituting the appropriate hostname and node ports:\n\n* `{system-api}`\n* `{inventory-api}/system-service`\n\nThe first URL returns system properties and the name of the pod in an HTTP header called `X-Pod-Name`. To view the header, you can use the `-I` option in the `curl` when making a request to  the `{system-api}` URL. The second URL adds properties from `system-service` to the inventory.\n\n// =================================================================================================\n// Testing microservices that are running on IBM Cloud\n// =================================================================================================\n\n== Testing microservices that are running on IBM Cloud\n\nA few tests are included for you to test the basic functionality of the microservices. If a test fails, then you might have introduced a bug into the code. To run the tests, wait until all pods are in the ready state before proceeding further. The default properties that are defined in the `pom.xml` file are:\n\n[cols=\"15, 100\", options=\"header\"]\n|===\n| *Property*        | *Description*\n| `cluster.ip`        | IP or hostname for your cluster\n| `system.kube.service` | Name of the {kube} Service wrapping the `system` pods, `system-service` by default.\n| `system.node.port`    | The NodePort of the {kube} Service `system-service`, 31000 by default.\n| `inventory.node.port`    | The NodePort of the {kube} Service `inventory-service`, 32000 by default.\n|===\n\nUse the following command to run the integration tests against your cluster. Substitute \n`[hostname]`, `[system-node-port]` and `[inventory-node-port]` with the appropriate values.\n\ninclude::{common-includes}/os-tabs.adoc[]\n\n[.tab_content.windows_section]\n--\n[role='command']\n```\nmvnw.cmd failsafe:integration-test -Dcluster.ip=[hostname] -Dsystem.node.port=[system-node-port] -Dinventory.node.port=[inventory-node-port]\n```\n--\n\n[.tab_content.mac_section]\n--\n[role='command']\n```\n./mvnw failsafe:integration-test -Dcluster.ip=[hostname] -Dsystem.node.port=[system-node-port] -Dinventory.node.port=[inventory-node-port]\n```\n--\n\n[.tab_content.linux_section]\n--\n[role='command']\n```\n./mvnw failsafe:integration-test -Dcluster.ip=[hostname] -Dsystem.node.port=[system-node-port] -Dinventory.node.port=[inventory-node-port]\n```\n--\n\nIf the tests pass, you'll see an output similar to the following for each service respectively:\n\n[source, role=\"no_copy\"]\n----\n-------------------------------------------------------\n T E S T S\n-------------------------------------------------------\nRunning it.io.openliberty.guides.system.SystemEndpointIT\nTests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.673 sec - in it.io.openliberty.guides.system.SystemEndpointIT\n\nResults:\n\nTests run: 2, Failures: 0, Errors: 0, Skipped: 0\n----\n\n[source, 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== Deploying a new version of system microservice\n\nOptionally, you might want to make changes to your microservice and redeploy the updated version. In this section, you will bump the version of the `system` microservice to `2.0-SNAPSHOT` and redeploy the new version of the microservice. \n\nUse Maven to repackage your microservice:\n\ninclude::{common-includes}/os-tabs.adoc[]\n\n[.tab_content.windows_section]\n--\n[role='command']\n```\nmvnw.cmd package\n```\n--\n\n[.tab_content.mac_section]\n--\n[role='command']\n```\n./mvnw package\n```\n--\n\n[.tab_content.linux_section]\n--\n[role='command']\n```\n./mvnw package\n```\n--\n\nNext, build the new version of the container image as `2.0-SNAPSHOT`:\n[role=command]\n```\ndocker build --platform linux/amd64 -t system:2.0-SNAPSHOT system/.\n```\n\nSince you built a new image, you need to push it to the repository again. In the following `docker` and `kubectl` commands, remember to replace `us.icr.io` with your registry and `[your-namespace]` with the namespace you created earlier in the guide.\n\n// Tagging images\nTag your container image with the relevant data about your registry.\n\n[role=command]\n```\ndocker tag system:2.0-SNAPSHOT us.icr.io/[your-namespace]/system:2.0-SNAPSHOT\n```\n\n// Pushing images\nPush your image to the registry.\n\n[role=command]\n```\ndocker push us.icr.io/[your-namespace]/system:2.0-SNAPSHOT\n```\n\nUpdate the `system-deployment` deployment to use the new container image that you just pushed to the registry:\n\n[role=command]\n```\nkubectl set image deployment/system-deployment system-container=us.icr.io/[your-namespace]/system:2.0-SNAPSHOT\n```\n\nUse the following command to find the name of the pod that is running the `system` microservice.\n\n[role=command]\n```\nkubectl get pods\n```\n\n[source, role=\"no_copy\"]\n----\nNAME                                       READY    STATUS    RESTARTS   AGE\ninventory-app-ibm-open-l-994778cf7-fdkb5   1/1      Running   0          5m\nsystem-app-ibm-open-libe-85c85949c-lb49d   1/1      Running   0          23s\n----\n\nIn this case, the `system` microservice is running in the pod called `system-app-ibm-open-libe-85c85949c-lb49d`. Substitute the name of your pod into the following command to see more details about the pod.\n\n[role=command]\n```\nkubectl describe pod [pod-name]\n```\n\nSubstitute the `[pod-name]` to your pod name into the following command. Run the command to view your pod events. Observe that the pod is using the new container image `system:2.0-SNAPSHOT`.\n\n[role=command]\n```\nkubectl get event --field-selector involvedObject.name=[pod-name]\n```\n\n[source, role=\"no_copy\"]\n---- \nLAST SEEN   TYPE     REASON      OBJECT                                         MESSAGE\n12m         Normal   Scheduled   pod/system-app-ibm-open-libe-85c85949c-lb49d   Successfully assigned default/system-app-ibm-open-libe-85c85949c-lb49d to 10.144.182.122\n12m         Normal   Pulling     pod/system-app-ibm-open-libe-85c85949c-lb49d   Pulling image \"us.icr.io/[your-namespace]/system:2.0-SNAPSHOT\"\n12m         Normal   Pulled      pod/system-app-ibm-open-libe-85c85949c-lb49d   Successfully pulled image \"us.icr.io/[your-namespace]/system:2.0-SNAPSHOT\" in 6.8103423s\n12m         Normal   Created     pod/system-app-ibm-open-libe-85c85949c-lb49d   Created container ibm-open-liberty\n12m         Normal   Started     pod/system-app-ibm-open-libe-85c85949c-lb49d   Started container ibm-open-liberty\n----\n\n// =================================================================================================\n// Tear Down\n// =================================================================================================\n\n== Tearing down the environment\n\nWhen you no longer need your deployed microservices, you can delete all {kube} resources by running the `kubectl delete` command:\n[role='command']\n```\nkubectl delete -f kubernetes.yaml\n```\n\nRemove your images from your container registry. Remember to replace `us.icr.io` to your registry and `[your-namespace]` with the namespace you created earlier in the guide.\n\n[role=command]\n```\nibmcloud cr image-rm us.icr.io/[your-namespace]/system:1.0-SNAPSHOT\nibmcloud cr image-rm us.icr.io/[your-namespace]/system:2.0-SNAPSHOT\nibmcloud cr image-rm us.icr.io/[your-namespace]/inventory:1.0-SNAPSHOT\n```\n\nRemove the namespace you created in your container registry.\n\n[role=command]\n```\nibmcloud cr namespace-rm [your-namespace]\n```\n\nLog out of your container registry. Remember to replace `us.icr.io` to your registry.\n\n[role=command]\n```\ndocker logout us.icr.io\ndocker logout registry.ng.bluemix.net\n```\n\nRemove your IKS cluster.\n\n[role=command]\n```\nibmcloud ks cluster rm --cluster guide-cluster\n```\n\nLog out of the `ibmcloud` command line tool.\n\n[role=command]\n```\nibmcloud logout\n```\n\n// =================================================================================================\n// finish\n// =================================================================================================\n\n== Great work! You're done!\n\nYou just deployed two microservices to IBM Cloud. You also learned how to use the `kubectl` command 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-ibm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenliberty%2Fguide-cloud-ibm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenliberty%2Fguide-cloud-ibm/lists"}