From 390a1c555b2cf0a6216bccfcc75be2fe4fd8a420 Mon Sep 17 00:00:00 2001 From: Michal Broz Date: Sun, 12 Apr 2020 21:31:23 -0500 Subject: [PATCH 1/6] Add MP Interactive Tutorial to Config Section --- .../configure-java-microservice/_index.md | 5 +++ ...nfigure-java-microservice-interactive.html | 30 +++++++++++++ .../configure-java-microservice.md | 42 +++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100755 content/en/docs/tutorials/configuration/configure-java-microservice/_index.md create mode 100644 content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html create mode 100644 content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/_index.md b/content/en/docs/tutorials/configuration/configure-java-microservice/_index.md new file mode 100755 index 0000000000..11ac6a6d3c --- /dev/null +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/_index.md @@ -0,0 +1,5 @@ +--- +title: "Configuring a Java Microservice" +weight: 10 +--- + diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html new file mode 100644 index 0000000000..193978dfe9 --- /dev/null +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html @@ -0,0 +1,30 @@ +--- +title: Interactive Tutorial - Configuring a Java Microservice +weight: 20 +--- + + + + + + + + + + + +
+ +
+
+
+ To interact with the Terminal, please use the desktop/tablet version +
+
+
+
+ +
+ + + diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md new file mode 100644 index 0000000000..efe85518ad --- /dev/null +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md @@ -0,0 +1,42 @@ +--- +title: Externalizing config using MicroProfile, ConfigMaps and Secrets +content_template: templates/tutorial +weight: 10 +--- + +{{% capture overview %}} + +In this tutorial you will learn how and why to externalize your microservice’s configuration.  Specifically, you will learn how to use Kubernetes ConfigMaps and Secrets to set environment variables and then consume them using MicroProfile Config. + +{{% /capture %}} + + +{{% capture prerequisites %}} + +### Externalizing Config from Code +Externalized application configuration is useful because configuration usually changes depending on your environment.  In order to accomplish this, we'll use Java's Contexts and Dependency Injection (CDI) and [MicroProfile Config](https://github.com/eclipse/microprofile-config). MicroProfile Config is a feature of [MicroProfile](http://microprofile.io/), a set of open Java technologies for developing and deploying cloud-native microservices. + +CDI defines a rich set of complementary services that improve the application structure. This provides a standard dependency injection capability enabling an application to be assembled from collaborating, loosely-coupled beans.  During the interactive tutorial, you'll use the @Inject annotation to inject the value from an external configuration into your code. + +MicroProfile Config provides apps and microservices a standard way to obtain config properties from various sources, including the application, runtime, and environment.  Based on the source's defined priority, the properties are automatically combined into a single set of properties that the application can access via an API.  During the interactive tutorial you'll use the @ConfigProperty annotation to inject various externally provided property values into your code. + +Many open source frameworks and runtimes implement and support MicroProfile Config.  Throughout the interactive tutorial, you'll be using [Open Liberty](https://openliberty.io), a flexible open-source Java runtime for building and running cloud-native apps and microservices.  You can find more information on how to use MicroProfile Config in this [Open Liberty guide](https://www.openliberty.io/guides/microprofile-config-intro.html). + +### Creating Kubernetes ConfigMaps & Secrets +There are several ways to set environment variables for a Docker container in Kubernetes, including: Dockerfile, kubernetes.yml, Kubernetes ConfigMaps, and Kubernetes Secrets.  In the tutorial, you will use the latter two for setting your environment variables whose values will be injected into your microservices.  One of the benefits for using ConfigMaps and Secrets is that they can be re-used across multiple containers, including being assigned to different environment variables for the different containers.  ConfigMaps and Secrets are stores of key-value pairs, however, Secrets are intended for storing Base64 encoded sensitive information.  For more information, see the following: [ConfigMaps](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) & [Secrets](https://kubernetes.io/docs/concepts/configuration/secret/). + +{{% /capture %}} + + +{{% capture objectives %}} + +* Inject microservice configuration using MicroProfile Config +* Create a Kubernetes ConfigMap and Secret + +{{% /capture %}} + +{{% capture lessoncontent %}} + +## [Start Interactive Tutorial](/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive/) + +{{% /capture %}} \ No newline at end of file From fda5d0084b540d073f1af733c75ff0e917d4a638 Mon Sep 17 00:00:00 2001 From: Michal Broz Date: Mon, 10 Aug 2020 14:25:09 -0500 Subject: [PATCH 2/6] Updates based on feedback --- .../configure-java-microservice/_index.md | 2 +- ...nfigure-java-microservice-interactive.html | 2 +- .../configure-java-microservice.md | 39 +++++++++++-------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/_index.md b/content/en/docs/tutorials/configuration/configure-java-microservice/_index.md index 11ac6a6d3c..8a5bc5d604 100755 --- a/content/en/docs/tutorials/configuration/configure-java-microservice/_index.md +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/_index.md @@ -1,5 +1,5 @@ --- -title: "Configuring a Java Microservice" +title: "Example: Configuring a Java Microservice" weight: 10 --- diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html index 193978dfe9..b70c917531 100644 --- a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html @@ -1,5 +1,5 @@ --- -title: Interactive Tutorial - Configuring a Java Microservice +title: "Interactive Tutorial - Configuring a Java Microservice" weight: 20 --- diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md index efe85518ad..e470550758 100644 --- a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md @@ -1,42 +1,49 @@ --- -title: Externalizing config using MicroProfile, ConfigMaps and Secrets +title: "Externalizing config using MicroProfile, ConfigMaps and Secrets" content_template: templates/tutorial weight: 10 --- {{% capture overview %}} -In this tutorial you will learn how and why to externalize your microservice’s configuration.  Specifically, you will learn how to use Kubernetes ConfigMaps and Secrets to set environment variables and then consume them using MicroProfile Config. +In this tutorial you will learn how and why to externalize your microservice’s configuration. Specifically, you will learn how to use Kubernetes ConfigMaps and Secrets to set environment variables and then consume them using MicroProfile Config. {{% /capture %}} {{% capture prerequisites %}} -### Externalizing Config from Code -Externalized application configuration is useful because configuration usually changes depending on your environment.  In order to accomplish this, we'll use Java's Contexts and Dependency Injection (CDI) and [MicroProfile Config](https://github.com/eclipse/microprofile-config). MicroProfile Config is a feature of [MicroProfile](http://microprofile.io/), a set of open Java technologies for developing and deploying cloud-native microservices. - -CDI defines a rich set of complementary services that improve the application structure. This provides a standard dependency injection capability enabling an application to be assembled from collaborating, loosely-coupled beans.  During the interactive tutorial, you'll use the @Inject annotation to inject the value from an external configuration into your code. - -MicroProfile Config provides apps and microservices a standard way to obtain config properties from various sources, including the application, runtime, and environment.  Based on the source's defined priority, the properties are automatically combined into a single set of properties that the application can access via an API.  During the interactive tutorial you'll use the @ConfigProperty annotation to inject various externally provided property values into your code. - -Many open source frameworks and runtimes implement and support MicroProfile Config.  Throughout the interactive tutorial, you'll be using [Open Liberty](https://openliberty.io), a flexible open-source Java runtime for building and running cloud-native apps and microservices.  You can find more information on how to use MicroProfile Config in this [Open Liberty guide](https://www.openliberty.io/guides/microprofile-config-intro.html). - ### Creating Kubernetes ConfigMaps & Secrets -There are several ways to set environment variables for a Docker container in Kubernetes, including: Dockerfile, kubernetes.yml, Kubernetes ConfigMaps, and Kubernetes Secrets.  In the tutorial, you will use the latter two for setting your environment variables whose values will be injected into your microservices.  One of the benefits for using ConfigMaps and Secrets is that they can be re-used across multiple containers, including being assigned to different environment variables for the different containers.  ConfigMaps and Secrets are stores of key-value pairs, however, Secrets are intended for storing Base64 encoded sensitive information.  For more information, see the following: [ConfigMaps](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) & [Secrets](https://kubernetes.io/docs/concepts/configuration/secret/). +There are several ways to set environment variables for a Docker container in Kubernetes, including: Dockerfile, kubernetes.yml, Kubernetes ConfigMaps, and Kubernetes Secrets. In the tutorial, you will learn how to use the latter two for setting your environment variables whose values will be injected into your microservices. One of the benefits for using ConfigMaps and Secrets is that they can be re-used across multiple containers, including being assigned to different environment variables for the different containers. + +ConfigMaps are API Objects that store non-confidential key-value pairs. In the Interactive Tutorial you will learn how to use a ConfigMap to store the application's name. For more information regarding ConfigMaps, you can find the documentation [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/). + +Although Secrets are also used to store key-value pairs, they differ from ConfigMaps in that they're intended for confidential/sensitive information and are stored using Base64 encoding. This makes secrets tha approrpriate choice for storing such things as credentials, keys, and tokens, the former of which you'll do in the Interactive Tutorial. For more information on Secrets, you can find the documentation [here](https://kubernetes.io/docs/concepts/configuration/secret/). + + +### Externalizing Config from Code +Externalized application configuration is useful because configuration usually changes depending on your environment. In order to accomplish this, we'll use Java's Contexts and Dependency Injection (CDI) and [MicroProfile Config](https://github.com/eclipse/microprofile-config). MicroProfile Config is a feature of [MicroProfile](http://microprofile.io/), a set of open Java technologies for developing and deploying cloud-native microservices. + +CDI provides a standard dependency injection capability enabling an application to be assembled from collaborating, loosely-coupled beans. MicroProfile Config provides apps and microservices a standard way to obtain config properties from various sources, including the application, runtime, and environment. Based on the source's defined priority, the properties are automatically combined into a single set of properties that the application can access via an API. Together, CDI & MicroProfile will be used in the Interactive Tutorial to retrieve the externally provided properties from the Kubernetes ConfigMaps and Secrets and get injected into your application code. + +Many open source frameworks and runtimes implement and support MicroProfile Config. Throughout the interactive tutorial, you'll be using [Open Liberty](https://openliberty.io), a flexible open-source Java runtime for building and running cloud-native apps and microservices. You can find more information on how to use MicroProfile Config in this [Open Liberty guide](https://www.openliberty.io/guides/microprofile-config-intro.html). + + {{% /capture %}} {{% capture objectives %}} -* Inject microservice configuration using MicroProfile Config * Create a Kubernetes ConfigMap and Secret +* Inject microservice configuration using MicroProfile Config + {{% /capture %}} {{% capture lessoncontent %}} - -## [Start Interactive Tutorial](/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive/) - + +## Example: Externalizing config using MicroProfile, ConfigMaps and Secrets +### [Start Interactive Tutorial](/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive/) + {{% /capture %}} \ No newline at end of file From 235277abcbaf2ef2b149813e6efe26669055e3be Mon Sep 17 00:00:00 2001 From: Michal Broz Date: Mon, 14 Sep 2020 16:28:54 -0500 Subject: [PATCH 3/6] Align Tutorial with new Docs structure --- .../configure-java-microservice.md | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md index e470550758..615d68b3a2 100644 --- a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md @@ -1,17 +1,15 @@ --- title: "Externalizing config using MicroProfile, ConfigMaps and Secrets" -content_template: templates/tutorial +content_type: tutorial weight: 10 --- -{{% capture overview %}} + In this tutorial you will learn how and why to externalize your microservice’s configuration. Specifically, you will learn how to use Kubernetes ConfigMaps and Secrets to set environment variables and then consume them using MicroProfile Config. -{{% /capture %}} - -{{% capture prerequisites %}} +## {{% heading "prerequisites" %}} ### Creating Kubernetes ConfigMaps & Secrets There are several ways to set environment variables for a Docker container in Kubernetes, including: Dockerfile, kubernetes.yml, Kubernetes ConfigMaps, and Kubernetes Secrets. In the tutorial, you will learn how to use the latter two for setting your environment variables whose values will be injected into your microservices. One of the benefits for using ConfigMaps and Secrets is that they can be re-used across multiple containers, including being assigned to different environment variables for the different containers. @@ -29,21 +27,13 @@ CDI provides a standard dependency injection capability enabling an application Many open source frameworks and runtimes implement and support MicroProfile Config. Throughout the interactive tutorial, you'll be using [Open Liberty](https://openliberty.io), a flexible open-source Java runtime for building and running cloud-native apps and microservices. You can find more information on how to use MicroProfile Config in this [Open Liberty guide](https://www.openliberty.io/guides/microprofile-config-intro.html). - -{{% /capture %}} - - -{{% capture objectives %}} +## {{% heading "objectives" %}} * Create a Kubernetes ConfigMap and Secret * Inject microservice configuration using MicroProfile Config -{{% /capture %}} - -{{% capture lessoncontent %}} + ## Example: Externalizing config using MicroProfile, ConfigMaps and Secrets -### [Start Interactive Tutorial](/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive/) - -{{% /capture %}} \ No newline at end of file +### [Start Interactive Tutorial](/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive/) \ No newline at end of file From 7a02c0871e4c724d0033539124b6ebd7dfe2d84e Mon Sep 17 00:00:00 2001 From: Michal Broz Date: Tue, 15 Sep 2020 16:21:14 -0500 Subject: [PATCH 4/6] Remove robo font --- .../configure-java-microservice-interactive.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html index b70c917531..7af4c9451f 100644 --- a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html @@ -20,7 +20,7 @@ weight: 20
To interact with the Terminal, please use the desktop/tablet version
-
+
From 43c6ce2a5f06adb87da7180e5b4ab7bf8f45e8a9 Mon Sep 17 00:00:00 2001 From: Michal Broz Date: Wed, 16 Sep 2020 15:06:33 -0500 Subject: [PATCH 5/6] Remove External Links --- .../configure-java-microservice.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md index 615d68b3a2..dfd13a7014 100644 --- a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice.md @@ -20,11 +20,11 @@ Although Secrets are also used to store key-value pairs, they differ from Config ### Externalizing Config from Code -Externalized application configuration is useful because configuration usually changes depending on your environment. In order to accomplish this, we'll use Java's Contexts and Dependency Injection (CDI) and [MicroProfile Config](https://github.com/eclipse/microprofile-config). MicroProfile Config is a feature of [MicroProfile](http://microprofile.io/), a set of open Java technologies for developing and deploying cloud-native microservices. +Externalized application configuration is useful because configuration usually changes depending on your environment. In order to accomplish this, we'll use Java's Contexts and Dependency Injection (CDI) and MicroProfile Config. MicroProfile Config is a feature of MicroProfile, a set of open Java technologies for developing and deploying cloud-native microservices. CDI provides a standard dependency injection capability enabling an application to be assembled from collaborating, loosely-coupled beans. MicroProfile Config provides apps and microservices a standard way to obtain config properties from various sources, including the application, runtime, and environment. Based on the source's defined priority, the properties are automatically combined into a single set of properties that the application can access via an API. Together, CDI & MicroProfile will be used in the Interactive Tutorial to retrieve the externally provided properties from the Kubernetes ConfigMaps and Secrets and get injected into your application code. -Many open source frameworks and runtimes implement and support MicroProfile Config. Throughout the interactive tutorial, you'll be using [Open Liberty](https://openliberty.io), a flexible open-source Java runtime for building and running cloud-native apps and microservices. You can find more information on how to use MicroProfile Config in this [Open Liberty guide](https://www.openliberty.io/guides/microprofile-config-intro.html). +Many open source frameworks and runtimes implement and support MicroProfile Config. Throughout the interactive tutorial, you'll be using Open Liberty, a flexible open-source Java runtime for building and running cloud-native apps and microservices. However, any MicroProfile compatible runtime could be used instead. ## {{% heading "objectives" %}} From ecba51d73b71c3f134c30542aa14039072961e11 Mon Sep 17 00:00:00 2001 From: Michal Broz Date: Tue, 6 Oct 2020 14:03:16 -0500 Subject: [PATCH 6/6] Update katacoda id to kubernetes-bootcamp --- .../configure-java-microservice-interactive.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html index 7af4c9451f..bb926a1d19 100644 --- a/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html +++ b/content/en/docs/tutorials/configuration/configure-java-microservice/configure-java-microservice-interactive.html @@ -20,7 +20,7 @@ weight: 20
To interact with the Terminal, please use the desktop/tablet version
-
+