Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud cli update #188

Merged
merged 34 commits into from
Jun 5, 2024
Merged
Changes from 21 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5113216
cluster creation command & README content update
Ruilin-Ma May 8, 2024
605672c
content improvement
Ruilin-Ma May 8, 2024
9531121
docker build command updated with specifying the cpu arch
Ruilin-Ma May 21, 2024
ea72979
fixing tag and year of the README
Ruilin-Ma May 21, 2024
082e72f
add windows instructions
Ruilin-Ma May 21, 2024
1e10d91
fix content display issue
Ruilin-Ma May 21, 2024
8ceaa10
fix content display issue
Ruilin-Ma May 21, 2024
19448d4
fix content display issue
Ruilin-Ma May 21, 2024
16d59c7
Added documentation links for setting up access permissions on IBM Cloud
Ruilin-Ma May 23, 2024
97b5a0f
revise the part for access permission of creating cluster
Ruilin-Ma May 27, 2024
13c9b37
typo correction
Ruilin-Ma May 27, 2024
434c466
typo correction
Ruilin-Ma May 27, 2024
0571aab
methods -> steps
Ruilin-Ma May 27, 2024
ebb40df
typo correction
Ruilin-Ma May 28, 2024
af62538
Merge branch 'staging' into cloud-cli-update
gkwan-ibm May 28, 2024
de665bc
Update README.adoc
Ruilin-Ma May 29, 2024
2f6bd53
Update README.adoc
Ruilin-Ma May 29, 2024
7c05c71
Update README.adoc
Ruilin-Ma May 29, 2024
897337c
Update README.adoc
Ruilin-Ma May 29, 2024
1cc72c3
Update README.adoc
Ruilin-Ma May 29, 2024
58cd467
Update README.adoc
Ruilin-Ma May 29, 2024
ae751c4
Update README.adoc
Ruilin-Ma May 29, 2024
6854a9e
Update README.adoc
Ruilin-Ma May 29, 2024
c465a30
Update README.adoc
Ruilin-Ma May 29, 2024
bf634aa
Update README.adoc
Ruilin-Ma May 29, 2024
2b6c495
Update README.adoc
Ruilin-Ma May 29, 2024
c125b1c
Update README.adoc
Ruilin-Ma May 29, 2024
7a2b275
Update README.adoc
Ruilin-Ma May 29, 2024
6130bfb
Update README.adoc
Ruilin-Ma May 29, 2024
6786ff4
Update README.adoc
Ruilin-Ma May 29, 2024
af1d31e
Update README.adoc
Ruilin-Ma May 29, 2024
4bd5806
typo fixed
Ruilin-Ma May 29, 2024
b3dbc22
typo fixed
Ruilin-Ma May 29, 2024
c488a2e
Merge branch 'staging' into cloud-cli-update
gkwan-ibm Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 41 additions & 13 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018, 2023 IBM Corporation and others.
// Copyright (c) 2018, 2024 IBM Corporation and others.
// Licensed under Creative Commons Attribution-NoDerivatives
// 4.0 International (CC BY-ND 4.0)
// https://creativecommons.org/licenses/by-nd/4.0/
Expand All @@ -12,7 +12,7 @@
:page-releasedate: 2019-05-29
:page-majorupdateddate: 2022-11-03
:page-description: Explore how to deploy microservices to IBM Cloud Kubernetes Service.
:page-tags: ['Kubernetes', 'Docker', 'Cloud']
:page-tags: ['kubernetes', 'docker', 'cloud']
:page-permalink: /guides/{projectid}
:page-related-guides: ['kubernetes-intro', 'kubernetes-microprofile-config', 'kubernetes-microprofile-health', 'istio-intro']
:common-includes: https://raw.githubusercontent.com/OpenLiberty/guides-common/prod
Expand Down Expand Up @@ -49,7 +49,7 @@ Kubernetes is an open source container orchestrator that automates many tasks in

Different 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.

The IBM Cloud Kubernetes Service is part of IBM’s public cloud offerings. 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.
The IBM Cloud Kubernetes Service is part of IBM’s public cloud offerings. 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. Please note, the IBM Cloud Container Registry is hosted on IBM Cloud Platform, fees might be associated with running this guide. Please refer to https://cloud.ibm.com/docs/account?topic=account-accounts[IBM Cloud account type] document for more details.

Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
The 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.

Expand Down Expand Up @@ -151,20 +151,44 @@ ibmcloud login

=== Provisioning a cluster

To create a {kube} cluster, you need `Administrator` access to IBM Cloud Kubernetes Service. To confirm that you have `Administrator` access, navigate to the https://cloud.ibm.com/[IBM Cloud Dashboard^]. Then, navigate to `Manage > Access (IAM) > Users > [Your Username] > Access Policies` and confirm that `Administrator` is listed as a policy for all resources in the account or for the Kubernetes service.
To 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 > Access (IAM) > Users > [Your Username] > Access > Access Policies`. Alternatively, if you are part of an access group, you also can check `Manage > Access (IAM) > Access groups > [Your Access Group] > Access`. Using the steps mentioned previously, you can confirm that `Administrator` is listed as a policy for all resources in the account or for the Kubernetes service.

Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
Once you have confirmed that you have appropriate permissions, use the following command to provision a cluster.
Once you have confirmed that you have appropriate permissions, use the following commands to provision a cluster.

Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
Retrieve the list of available Kubernetes zone for deploying the cluster within the https://cloud.ibm.com/docs/containers?topic=containers-regions-and-zones#zones-sz[IBM Cloud classic infrastructure]
[role=command]
Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
```
ibmcloud ks cluster create classic --name guide-cluster
ibmcloud ks zone ls --provider classic
```

This command provisions a free cluster that expires in a month if you do not delete it.
Use the following command to retrieve the list of the available flavors of Kubernetes worker nodes for a zone by replacing the `[available_zone]` with an available zone selected from the previous command.

Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
[role=command]
```
ibmcloud ks flavor ls --provider classic --zone [available_zone]
```

You will see the following output:
[role="no_copy"]
Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
----
For more information about these flavors, see 'https://ibm.biz/flavors'
Name Cores Memory Network Speed OS Server Type Storage Secondary Storage Flavor Class Provider
b3c.16x64 16 64GB 1000Mbps UBUNTU_20_64 virtual 25GB 100GB - classic
b3c.16x64.300gb 16 64GB 1000Mbps UBUNTU_20_64 virtual 25GB 300GB - classic
...
Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
----

Use the following command to create a Kubernetes cluster by replacing the `[selected_flavor]` with an available flavor selected from the output of the previous command, and the `[available_zone]` with the previously used zone.

Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
[role=command]
```
ibmcloud ks cluster create classic --name guide-cluster --flavor [selected_flavor] --zone [available_zone]
```

You will see the following output:
[source, role="no_copy"]
Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
----
The 'flavor' flag was not specified. So a free cluster will be created.
Number of workers was not specified. Using default: 1
Creating cluster...
OK
Cluster created with ID [cluster-id]
Expand Down Expand Up @@ -250,11 +274,11 @@ mvn package
Next, run the `docker build` commands to build container images for your application:
[role='command']
```
docker build -t system:1.0-SNAPSHOT system/.
docker build -t inventory:1.0-SNAPSHOT inventory/.
docker build --platform linux/amd64 -t system:1.0-SNAPSHOT system/.
docker build --platform linux/amd64 -t inventory:1.0-SNAPSHOT inventory/.
```

The `-t` flag in the `docker build` 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.
The `--platform` flag in the `docker build` command allows user to specify the target platform for the build output. As IBM Cloud Kubernetes service supports both `x86_64` and `s390x` architectures, the target platform will be `linux/amd64`. In addition, 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.

Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
During 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:

Expand Down Expand Up @@ -283,7 +307,11 @@ If you don't see the `system:1.0-SNAPSHOT` and `inventory:1.0-SNAPSHOT` images,

Pushing 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.

The registry you will use is called IBM Cloud Container Registry. Use the container registry plug-in to create a namespace for your container images. The 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.
The registry you will use is called IBM Cloud Container Registry. Use the container registry plug-in to create a namespace for your container images.

To create, assign, and remove namespaces, you must have the Manager role in the Container Registry service at the account level. For more information, see the https://cloud.ibm.com/docs/Registry?topic=Registry-registry_setup_cli_namespace#registry_setup_cli_namespace_plan_perm[User permissions for working with namespaces] documentation.

Ruilin-Ma marked this conversation as resolved.
Show resolved Hide resolved
The 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.

[role=command]
```
Expand Down Expand Up @@ -483,7 +511,7 @@ mvn package
Next, build the new version of the container image as `2.0-SNAPSHOT`:
[role=command]
```
docker build -t system:2.0-SNAPSHOT system/.
docker build --platform linux/amd64 -t system:2.0-SNAPSHOT system/.
```

Since 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.
Expand Down
Loading