Sync docs from master to gh-pages
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,16 +1,19 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>3. DiscoveryClient for Kubernetes</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__starters.html" title="2. Starters"><link rel="next" href="multi__kubernetes_native_service_discovery.html" title="4. Kubernetes native service discovery"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3. DiscoveryClient for Kubernetes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__starters.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__kubernetes_native_service_discovery.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_discoveryclient_for_kubernetes" href="#_discoveryclient_for_kubernetes"></a>3. DiscoveryClient for Kubernetes</h1></div></div></div><p>This project provides an implementation of <a class="link" href="https://github.com/spring-cloud/spring-cloud-commons/blob/master/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClient.java" target="_top">Discovery Client</a>
|
||||
for <a class="link" href="http://kubernetes.io" target="_top">Kubernetes</a>.
|
||||
This allows you to query Kubernetes endpoints <span class="strong"><strong>(see <a class="link" href="http://kubernetes.io/docs/user-guide/services/" target="_top">services</a>)</strong></span> by name.
|
||||
A service is typically exposed by the Kubernetes API server as a collection of endpoints which represent <code class="literal">http</code>, <code class="literal">https</code> addresses that a client can
|
||||
for <a class="link" href="https://kubernetes.io" target="_top">Kubernetes</a>.
|
||||
This client lets you query Kubernetes endpoints (see <a class="link" href="https://kubernetes.io/docs/user-guide/services/" target="_top">services</a>) by name.
|
||||
A service is typically exposed by the Kubernetes API server as a collection of endpoints that represent <code class="literal">http</code> and <code class="literal">https</code> addresses and that a client can
|
||||
access from a Spring Boot application running as a pod. This discovery feature is also used by the Spring Cloud Kubernetes Ribbon project
|
||||
to fetch the list of the endpoints defined for an application to be load balanced.</p><p>To enable loading of the <code class="literal">DiscoveryClient</code>, add <code class="literal">@EnableDiscoveryClient</code> to the according configuration or application class like this:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@SpringBootApplication</span></em>
|
||||
to fetch the list of the endpoints defined for an application to be load balanced.</p><p>This is something that you get for free by adding the following dependency inside your project:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-cloud-starter-kubernetes<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre></div><p>To enable loading of the <code class="literal">DiscoveryClient</code>, add <code class="literal">@EnableDiscoveryClient</code> to the according configuration or application class, as the following example shows:</p><div class="informalexample"><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@SpringBootApplication</span></em>
|
||||
<em><span class="hl-annotation" style="color: gray">@EnableDiscoveryClient</span></em>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Application {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> main(String[] args) {
|
||||
SpringApplication.run(Application.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, args);
|
||||
}
|
||||
}</pre><p>Then you can inject the client in your code simply by:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Autowired</span></em>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> DiscoveryClient discoveryClient;</pre><p>If for any reason you need to disable the <code class="literal">DiscoveryClient</code> you can simply set the following property in <code class="literal">application.properties</code>:</p><pre class="screen">spring.cloud.kubernetes.discovery.enabled=false</pre><p>Some Spring Cloud components use the <code class="literal">DiscoveryClient</code> in order to obtain info about the local service instance. For
|
||||
this to work you need to align the Kubernetes service name with the <code class="literal">spring.application.name</code> property.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__starters.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__kubernetes_native_service_discovery.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. Starters </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 4. Kubernetes native service discovery</td></tr></table></div></body></html>
|
||||
}</pre></div><p>Then you can inject the client in your code simply by autowiring it, as the following example shows:</p><div class="informalexample"><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Autowired</span></em>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> DiscoveryClient discoveryClient;</pre></div><p>If, for any reason, you need to disable the <code class="literal">DiscoveryClient</code>, you can set the following property in <code class="literal">application.properties</code>:</p><div class="informalexample"><pre class="screen">spring.cloud.kubernetes.discovery.enabled=false</pre></div><p>Some Spring Cloud components use the <code class="literal">DiscoveryClient</code> in order to obtain information about the local service instance. For
|
||||
this to work, you need to align the Kubernetes service name with the <code class="literal">spring.application.name</code> property.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__starters.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__kubernetes_native_service_discovery.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. Starters </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 4. Kubernetes native service discovery</td></tr></table></div></body></html>
|
||||
@@ -1,5 +1,5 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>11. Examples</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__security_configurations_inside_kubernetes.html" title="10. Security Configurations inside Kubernetes"><link rel="next" href="multi__other_resources.html" title="12. Other Resources"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">11. Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__security_configurations_inside_kubernetes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__other_resources.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_examples" href="#_examples"></a>11. Examples</h1></div></div></div><p>Spring Cloud Kubernetes tries to make it transparent for your applications to consume Kubernetes Native Services
|
||||
following the Spring Cloud interfaces.</p><p>In your applications, you need to add the <span class="strong"><strong>spring-cloud-kubernetes-discovery</strong></span> dependency to your classpath and remove any other dependency that contains a <span class="strong"><strong>DiscoveryClient</strong></span> implementation (ie. Eureka Discovery Client).
|
||||
The same applies for PropertySourceLocator, where you need to add to the classpath the <span class="strong"><strong>spring-cloud-kubernetes-config</strong></span> and remove any other dependency that contains a <span class="strong"><strong>PropertySourceLocator</strong></span> implementation (ie. Config Server Client).</p><p>The following projects highlight the usage of these dependencies and demonstrate how these libraries can be used from any Spring Boot application.</p><p>List of examples using these projects:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="https://github.com/spring-cloud/spring-cloud-kubernetes/tree/master/spring-cloud-kubernetes-examples" target="_top">Spring Cloud Kubernetes Examples</a>: the ones located inside this repository.</li><li class="listitem">Spring Cloud Kubernetes Full Example: Minions and Boss</li><li class="listitem"><a class="link" href="https://github.com/salaboy/spring-cloud-k8s-minion" target="_top">Minion</a></li><li class="listitem"><a class="link" href="https://github.com/salaboy/spring-cloud-k8s-boss" target="_top">Boss</a></li><li class="listitem">Spring Cloud Kubernetes Full Example: <a class="link" href="https://github.com/salaboy/s1p_docs" target="_top">SpringOne Platform Tickets Service</a></li><li class="listitem"><a class="link" href="https://github.com/salaboy/s1p_gateway" target="_top">Spring Cloud Gateway with Spring Cloud Kubernetes Discovery and Config</a></li><li class="listitem"><a class="link" href="https://github.com/salaboy/showcase-admin-tool" target="_top">Spring Boot Admin with Spring Cloud Kubernetes Discovery and Config</a></li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__security_configurations_inside_kubernetes.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__other_resources.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">10. Security Configurations inside Kubernetes </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 12. Other Resources</td></tr></table></div></body></html>
|
||||
<title>11. Examples</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__security_configurations_inside_kubernetes.html" title="10. Security Configurations Inside Kubernetes"><link rel="next" href="multi__other_resources.html" title="12. Other Resources"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">11. Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__security_configurations_inside_kubernetes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__other_resources.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_examples" href="#_examples"></a>11. Examples</h1></div></div></div><p>Spring Cloud Kubernetes tries to make it transparent for your applications to consume Kubernetes Native Services by
|
||||
following the Spring Cloud interfaces.</p><p>In your applications, you need to add the <code class="literal">spring-cloud-kubernetes-discovery</code> dependency to your classpath and remove any other dependency that contains a <code class="literal">DiscoveryClient</code> implementation (that is, a Eureka discovery client).
|
||||
The same applies for <code class="literal">PropertySourceLocator</code>, where you need to add to the classpath the <code class="literal">spring-cloud-kubernetes-config</code> and remove any other dependency that contains a <code class="literal">PropertySourceLocator</code> implementation (that is, a configuration server client).</p><p>The following projects highlight the usage of these dependencies and demonstrate how you can use these libraries from any Spring Boot application:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="https://github.com/spring-cloud/spring-cloud-kubernetes/tree/master/spring-cloud-kubernetes-examples" target="_top">Spring Cloud Kubernetes Examples</a>: the ones located inside this repository.</li><li class="listitem"><p class="simpara">Spring Cloud Kubernetes Full Example: Minions and Boss</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><a class="link" href="https://github.com/salaboy/spring-cloud-k8s-minion" target="_top">Minion</a></li><li class="listitem"><a class="link" href="https://github.com/salaboy/spring-cloud-k8s-boss" target="_top">Boss</a></li></ul></div></li><li class="listitem">Spring Cloud Kubernetes Full Example: <a class="link" href="https://github.com/salaboy/s1p_docs" target="_top">SpringOne Platform Tickets Service</a></li><li class="listitem"><a class="link" href="https://github.com/salaboy/s1p_gateway" target="_top">Spring Cloud Gateway with Spring Cloud Kubernetes Discovery and Config</a></li><li class="listitem"><a class="link" href="https://github.com/salaboy/showcase-admin-tool" target="_top">Spring Boot Admin with Spring Cloud Kubernetes Discovery and Config</a></li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__security_configurations_inside_kubernetes.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__other_resources.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">10. Security Configurations Inside Kubernetes </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 12. Other Resources</td></tr></table></div></body></html>
|
||||
@@ -1,14 +1,14 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>7. Kubernetes Ecosystem Awareness</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__ribbon_discovery_in_kubernetes.html" title="6. Ribbon discovery in Kubernetes"><link rel="next" href="multi__pod_health_indicator.html" title="8. Pod Health Indicator"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">7. Kubernetes Ecosystem Awareness</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__ribbon_discovery_in_kubernetes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__pod_health_indicator.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_kubernetes_ecosystem_awareness" href="#_kubernetes_ecosystem_awareness"></a>7. Kubernetes Ecosystem Awareness</h1></div></div></div><p>All of the features described above will work equally well regardless of whether your application is running inside
|
||||
Kubernetes or not. This is really helpful for development and troubleshooting.
|
||||
From a development point of view, this is really helpful as you can start your Spring Boot application and debug one
|
||||
of the modules part of this project. It is not required to deploy it in Kubernetes
|
||||
<title>7. Kubernetes Ecosystem Awareness</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__ribbon_discovery_in_kubernetes.html" title="6. Ribbon Discovery in Kubernetes"><link rel="next" href="multi__pod_health_indicator.html" title="8. Pod Health Indicator"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">7. Kubernetes Ecosystem Awareness</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__ribbon_discovery_in_kubernetes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__pod_health_indicator.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_kubernetes_ecosystem_awareness" href="#_kubernetes_ecosystem_awareness"></a>7. Kubernetes Ecosystem Awareness</h1></div></div></div><p>All of the features described earlier in this guide work equally well, regardless of whether your application is running inside
|
||||
Kubernetes. This is really helpful for development and troubleshooting.
|
||||
From a development point of view, this lets you start your Spring Boot application and debug one
|
||||
of the modules that is part of this project. You need not deploy it in Kubernetes,
|
||||
as the code of the project relies on the
|
||||
<a class="link" href="https://github.com/fabric8io/kubernetes-client" target="_top">Fabric8 Kubernetes Java client</a> which is a fluent DSL able to
|
||||
communicate using <code class="literal">http</code> protocol to the REST API of Kubernetes Server.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_kubernetes_profile_autoconfiguration" href="#_kubernetes_profile_autoconfiguration"></a>7.1 Kubernetes Profile Autoconfiguration</h2></div></div></div><p>When the application runs as a pod inside Kubernetes a Spring profile named <code class="literal">kubernetes</code> will automatically get activated.
|
||||
This allows the developer to customize the configuration, to define beans that will be applied when the Spring Boot application is deployed
|
||||
within the Kubernetes platform <span class="strong"><strong>(e.g. different dev and prod configuration)</strong></span>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_istio_awareness" href="#_istio_awareness"></a>7.2 Istio Awareness</h2></div></div></div><p>When including the <span class="strong"><strong>spring-cloud-kubernetes-istio</strong></span> module into the application classpath a new profile will be added to the application,
|
||||
if the application is running inside a Kubernetes Cluster with <a class="link" href="http://istio.io" target="_top">Istio</a> installed. Then you can use
|
||||
spring <span class="strong"><strong>@Profile("istio")</strong></span> annotations into your Beans and <span class="strong"><strong>@Configuration</strong></span>'s.</p><p>The Istio awareness module uses the <span class="strong"><strong>me.snowdrop:istio-client</strong></span> to interact with Istio APIs enabling us to discover traffic rules, circuit breakers, etc.
|
||||
Making it easy for our Spring Boot applications to consume this data to dynamically configure themselves according the environment.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__ribbon_discovery_in_kubernetes.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__pod_health_indicator.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6. Ribbon discovery in Kubernetes </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 8. Pod Health Indicator</td></tr></table></div></body></html>
|
||||
<a class="link" href="https://github.com/fabric8io/kubernetes-client" target="_top">Fabric8 Kubernetes Java client</a>, which is a fluent DSL that can
|
||||
communicate by using <code class="literal">http</code> protocol to the REST API of the Kubernetes Server.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_kubernetes_profile_autoconfiguration" href="#_kubernetes_profile_autoconfiguration"></a>7.1 Kubernetes Profile Autoconfiguration</h2></div></div></div><p>When the application runs as a pod inside Kubernetes, a Spring profile named <code class="literal">kubernetes</code> automatically gets activated.
|
||||
This lets you customize the configuration, to define beans that are applied when the Spring Boot application is deployed
|
||||
within the Kubernetes platform (for example, different development and production configuration).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_istio_awareness" href="#_istio_awareness"></a>7.2 Istio Awareness</h2></div></div></div><p>When you include the <code class="literal">spring-cloud-kubernetes-istio</code> module in the application classpath, a new profile is added to the application,
|
||||
provided the application is running inside a Kubernetes Cluster with <a class="link" href="https://istio.io" target="_top">Istio</a> installed. You can then use
|
||||
spring <code class="literal">@Profile("istio")</code> annotations in your Beans and <code class="literal">@Configuration</code> classes.</p><p>The Istio awareness module uses <code class="literal">me.snowdrop:istio-client</code> to interact with Istio APIs, letting us discover traffic rules, circuit breakers, and so on,
|
||||
making it easy for our Spring Boot applications to consume this data to dynamically configure themselves according to the environment.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__ribbon_discovery_in_kubernetes.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__pod_health_indicator.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6. Ribbon Discovery in Kubernetes </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 8. Pod Health Indicator</td></tr></table></div></body></html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>4. Kubernetes native service discovery</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__discoveryclient_for_kubernetes.html" title="3. DiscoveryClient for Kubernetes"><link rel="next" href="multi__kubernetes_propertysource_implementations.html" title="5. Kubernetes PropertySource implementations"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4. Kubernetes native service discovery</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__discoveryclient_for_kubernetes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__kubernetes_propertysource_implementations.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_kubernetes_native_service_discovery" href="#_kubernetes_native_service_discovery"></a>4. Kubernetes native service discovery</h1></div></div></div><p>Kubernetes itself is capable of (server side) service discovery (see: <a class="link" href="https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services" target="_top">https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services</a>).
|
||||
Using native kubernetes service discovery ensures compatibility with additional tooling, like: istio <a class="link" href="https://istio.io" target="_top">https://istio.io</a> (service mesh, capable of load balancing, ribbon, circuit breaker, failover and much more).</p><p>The caller service just needs to refer to names resolvable in particular kubernetes cluster then. Simplest implementation might use the spring <code class="literal">RestTemplate</code> referring to fully qualified domain name (FQDN) <code class="literal"><a class="link" href="http://{service-name}.{namespace}.svc.{cluster}.local:{service-port}" target="_top">http://{service-name}.{namespace}.svc.{cluster}.local:{service-port}</a></code>.</p><p>Additionally, hystrix can be used for:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">circuit breaker implementation on the caller side, just by annotating the spring boot application class: <code class="literal">@EnableCircuitBreaker</code></li><li class="listitem">and for the fallback functionality, annotating the respective method via: <code class="literal">@HystrixCommand(fallbackMethod=</code> does the job.</li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__discoveryclient_for_kubernetes.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__kubernetes_propertysource_implementations.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3. DiscoveryClient for Kubernetes </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 5. Kubernetes PropertySource implementations</td></tr></table></div></body></html>
|
||||
Using native kubernetes service discovery ensures compatibility with additional tooling, such as Istio (<a class="link" href="https://istio.io" target="_top">https://istio.io</a>), a service mesh that is capable of load balancing, ribbon, circuit breaker, failover, and much more.</p><p>The caller service then need only refer to names resolvable in a particular Kubernetes cluster. A simple implementation might use a spring <code class="literal">RestTemplate</code> that refers to a fully qualified domain name (FQDN), such as <code class="literal"><a class="link" href="https://{service-name}.{namespace}.svc.{cluster}.local:{service-port}" target="_top">https://{service-name}.{namespace}.svc.{cluster}.local:{service-port}</a></code>.</p><p>Additionally, you can use Hystrix for:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Circuit breaker implementation on the caller side, by annotating the spring boot application class with <code class="literal">@EnableCircuitBreaker</code></li><li class="listitem">Fallback functionality, by annotating the respective method with <code class="literal">@HystrixCommand(fallbackMethod=</code></li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__discoveryclient_for_kubernetes.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__kubernetes_propertysource_implementations.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3. DiscoveryClient for Kubernetes </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 5. Kubernetes PropertySource implementations</td></tr></table></div></body></html>
|
||||
@@ -1,17 +1,17 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>5. Kubernetes PropertySource implementations</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__kubernetes_native_service_discovery.html" title="4. Kubernetes native service discovery"><link rel="next" href="multi__ribbon_discovery_in_kubernetes.html" title="6. Ribbon discovery in Kubernetes"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5. Kubernetes PropertySource implementations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__kubernetes_native_service_discovery.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__ribbon_discovery_in_kubernetes.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_kubernetes_propertysource_implementations" href="#_kubernetes_propertysource_implementations"></a>5. Kubernetes PropertySource implementations</h1></div></div></div><p>The most common approach to configure your Spring Boot application is to create an <code class="literal">application.properties|yaml</code> or
|
||||
an <code class="literal">application-profile.properties|yaml</code> file containing key-value pairs providing customization values to your
|
||||
application or Spring Boot starters. Users may override these properties by specifying system properties or environment
|
||||
variables.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_configmap_propertysource" href="#_configmap_propertysource"></a>5.1 ConfigMap PropertySource</h2></div></div></div><p>Kubernetes provides a resource named <a class="link" href="http://kubernetes.io/docs/user-guide/configmap/" target="_top">ConfigMap</a> to externalize the
|
||||
parameters to pass to your application in the form of key-value pairs or embedded <code class="literal">application.properties|yaml</code> files.
|
||||
The <a class="link" href="./spring-cloud-kubernetes-config" target="_top">Spring Cloud Kubernetes Config</a> project makes Kubernetes `ConfigMap`s available
|
||||
<title>5. Kubernetes PropertySource implementations</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__kubernetes_native_service_discovery.html" title="4. Kubernetes native service discovery"><link rel="next" href="multi__ribbon_discovery_in_kubernetes.html" title="6. Ribbon Discovery in Kubernetes"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5. Kubernetes PropertySource implementations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__kubernetes_native_service_discovery.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__ribbon_discovery_in_kubernetes.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_kubernetes_propertysource_implementations" href="#_kubernetes_propertysource_implementations"></a>5. Kubernetes PropertySource implementations</h1></div></div></div><p>The most common approach to configuring your Spring Boot application is to create an <code class="literal">application.properties</code> or <code class="literal">applicaiton.yaml</code> or
|
||||
an <code class="literal">application-profile.properties</code> or <code class="literal">application-profile.yaml</code> file that contains key-value pairs that provide customization values to your
|
||||
application or Spring Boot starters. You can override these properties by specifying system properties or environment
|
||||
variables.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="configmap-propertysource" href="#configmap-propertysource"></a>5.1 Using a <code class="literal">ConfigMap</code> <code class="literal">PropertySource</code></h2></div></div></div><p>Kubernetes provides a resource named <a class="link" href="https://kubernetes.io/docs/user-guide/configmap/" target="_top"><code class="literal">ConfigMap</code></a> to externalize the
|
||||
parameters to pass to your application in the form of key-value pairs or embedded <code class="literal">application.properties</code> or <code class="literal">application.yaml</code> files.
|
||||
The <a class="link" href="./spring-cloud-kubernetes-config" target="_top">Spring Cloud Kubernetes Config</a> project makes Kubernetes <code class="literal">ConfigMap</code> instances available
|
||||
during application bootstrapping and triggers hot reloading of beans or Spring context when changes are detected on
|
||||
observed `ConfigMap`s.</p><p>The default behavior is to create a <code class="literal">ConfigMapPropertySource</code> based on a Kubernetes <code class="literal">ConfigMap</code> which has <code class="literal">metadata.name</code> of either the name of
|
||||
observed <code class="literal">ConfigMap</code> instances.</p><p>The default behavior is to create a <code class="literal">ConfigMapPropertySource</code> based on a Kubernetes <code class="literal">ConfigMap</code> that has a <code class="literal">metadata.name</code> value of either the name of
|
||||
your Spring application (as defined by its <code class="literal">spring.application.name</code> property) or a custom name defined within the
|
||||
<code class="literal">bootstrap.properties</code> file under the following key <code class="literal">spring.cloud.kubernetes.config.name</code>.</p><p>However, more advanced configuration are possible where multiple ConfigMaps can be used
|
||||
This is made possible by the <code class="literal">spring.cloud.kubernetes.config.sources</code> list.
|
||||
For example one could define the following ConfigMaps</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
|
||||
<code class="literal">bootstrap.properties</code> file under the following key: <code class="literal">spring.cloud.kubernetes.config.name</code>.</p><p>However, more advanced configuration is possible where you can use multiple <code class="literal">ConfigMap</code> instances.
|
||||
The <code class="literal">spring.cloud.kubernetes.config.sources</code> list makes this possible.
|
||||
For example, you could define the following <code class="literal">ConfigMap</code> instances:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> application</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: cloud-k8s-app
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> cloud</span>:
|
||||
@@ -20,25 +20,25 @@ For example one could define the following ConfigMaps</p><pre class="programlist
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: default-name
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> namespace</span>: default-namespace
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> sources</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Spring Cloud Kubernetes will lookup a ConfigMap named c1 in namespace default-namespace</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Spring Cloud Kubernetes looks up a ConfigMap named c1 in namespace default-namespace</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> - name</span>: c1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Spring Cloud Kubernetes will lookup a ConfigMap named default-name in whatever namespace n2</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Spring Cloud Kubernetes looks up a ConfigMap named default-name in whatever namespace n2</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> - namespace</span>: n2
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Spring Cloud Kubernetes will lookup a ConfigMap named c3 in namespace n3</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Spring Cloud Kubernetes looks up a ConfigMap named c3 in namespace n3</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> - namespace</span>: n3
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: c3</pre><p>In the example above, it <code class="literal">spring.cloud.kubernetes.config.namespace</code> had not been set,
|
||||
then the ConfigMap named <code class="literal">c1</code> would be looked up in the namespace that the application runs</p><p>Any matching <code class="literal">ConfigMap</code> that is found, will be processed as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">apply individual configuration properties.</li><li class="listitem">apply as <code class="literal">yaml</code> the content of any property named <code class="literal">application.yaml</code></li><li class="listitem">apply as properties file the content of any property named <code class="literal">application.properties</code></li></ul></div><p>The single exception to the aforementioned flow is when the <code class="literal">ConfigMap</code> contains a <span class="strong"><strong>single</strong></span> key that indicates
|
||||
the file is a YAML or Properties file. In that case the name of the key does NOT have to be <code class="literal">application.yaml</code> or
|
||||
<code class="literal">application.properties</code> (it can be anything) and the value of the property will be treated correctly.
|
||||
This features facilitates the use case where the <code class="literal">ConfigMap</code> was created using something like:</p><p><code class="literal">kubectl create configmap game-config --from-file=/path/to/app-config.yaml</code></p><p>Example:</p><p>Let’s assume that we have a Spring Boot application named <code class="literal">demo</code> that uses properties to read its thread pool
|
||||
configuration.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">pool.size.core</code></li><li class="listitem"><code class="literal">pool.size.maximum</code></li></ul></div><p>This can be externalized to config map in <code class="literal">yaml</code> format:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: ConfigMap
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: c3</pre></div><p>In the preceding example, if <code class="literal">spring.cloud.kubernetes.config.namespace</code> had not been set,
|
||||
the <code class="literal">ConfigMap</code> named <code class="literal">c1</code> would be looked up in the namespace that the application runs.</p><p>Any matching <code class="literal">ConfigMap</code> that is found is processed as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Apply individual configuration properties.</li><li class="listitem">Apply as <code class="literal">yaml</code> the content of any property named <code class="literal">application.yaml</code>.</li><li class="listitem">Apply as a properties file the content of any property named <code class="literal">application.properties</code>.</li></ul></div><p>The single exception to the aforementioned flow is when the <code class="literal">ConfigMap</code> contains a <span class="strong"><strong>single</strong></span> key that indicates
|
||||
the file is a YAML or properties file. In that case, the name of the key does NOT have to be <code class="literal">application.yaml</code> or
|
||||
<code class="literal">application.properties</code> (it can be anything) and the value of the property is treated correctly.
|
||||
This features facilitates the use case where the <code class="literal">ConfigMap</code> was created by using something like the following:</p><div class="informalexample"><pre class="screen">kubectl create configmap game-config --from-file=/path/to/app-config.yaml</pre></div><p>Assume that we have a Spring Boot application named <code class="literal">demo</code> that uses the following properties to read its thread pool
|
||||
configuration.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">pool.size.core</code></li><li class="listitem"><code class="literal">pool.size.maximum</code></li></ul></div><p>This can be externalized to config map in <code class="literal">yaml</code> format as follows:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: ConfigMap
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">metadata</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: demo
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">data</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> pool.size.core</span>: <span class="hl-number">1</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> pool.size.max</span>: <span class="hl-number">16</span></pre><p>Individual properties work fine for most cases but sometimes embedded <code class="literal">yaml</code> is more convenient. In this case we will
|
||||
use a single property named <code class="literal">application.yaml</code> to embed our <code class="literal">yaml</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: ConfigMap
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> pool.size.max</span>: <span class="hl-number">16</span></pre></div><p>Individual properties work fine for most cases. However, sometimes, embedded <code class="literal">yaml</code> is more convenient. In this case, we
|
||||
use a single property named <code class="literal">application.yaml</code> to embed our <code class="literal">yaml</code>, as follows:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: ConfigMap
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">metadata</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: demo
|
||||
@@ -47,7 +47,7 @@ use a single property named <code class="literal">application.yaml</code> to emb
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> pool</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> size</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> core</span>: <span class="hl-number">1</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> max</span>:<span class="hl-number">16</span></pre><p>The following also works:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: ConfigMap
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> max</span>:<span class="hl-number">16</span></pre></div><p>The following example also works:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: ConfigMap
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">metadata</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: demo
|
||||
@@ -56,10 +56,10 @@ use a single property named <code class="literal">application.yaml</code> to emb
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> pool</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> size</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> core</span>: <span class="hl-number">1</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> max</span>:<span class="hl-number">16</span></pre><p>Spring Boot applications can also be configured differently depending on active profiles which will be merged together
|
||||
when the ConfigMap is read. It is possible to provide different property values for different profiles using an
|
||||
<code class="literal">application.properties|yaml</code> property, specifying profile-specific values each in their own document
|
||||
(indicated by the <code class="literal">---</code> sequence) as follows:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: ConfigMap
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> max</span>:<span class="hl-number">16</span></pre></div><p>You can also configure Spring Boot applications differently depending on active profiles that are merged together
|
||||
when the <code class="literal">ConfigMap</code> is read. You can provide different property values for different profiles by using an
|
||||
<code class="literal">application.properties</code> or <code class="literal">application.yaml</code> property, specifying profile-specific values, each in their own document
|
||||
(indicated by the <code class="literal">---</code> sequence), as follows:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: ConfigMap
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">metadata</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: demo
|
||||
@@ -80,15 +80,15 @@ when the ConfigMap is read. It is possible to provide different property values
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> spring</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> profiles</span>: production
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> greeting</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> message</span>: Say Hello to the Ops</pre><p>In the above case, the configuration loaded into your Spring Application with the <code class="literal">development</code> profile will be:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> greeting</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> message</span>: Say Hello to the Ops</pre></div><p>In the preceding case, the configuration loaded into your Spring Application with the <code class="literal">development</code> profile is as follows:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> greeting</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> message</span>: Say Hello to the Developers
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> farewell</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> message</span>: Say Goodbye to the Developers</pre><p>whereas if the <code class="literal">production</code> profile is active, the configuration will be:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> greeting</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> message</span>: Say Goodbye to the Developers</pre></div><p>However, if the <code class="literal">production</code> profile is active, the configuration becomes:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> greeting</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> message</span>: Say Hello to the Ops
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> farewell</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> message</span>: Say Goodbye</pre><p>If both profiles are active, the property which appears last within the configmap will overwrite preceding values.</p><p>To tell to Spring Boot which <code class="literal">profile</code> should be enabled at bootstrap, a system property can be passed to the Java
|
||||
command launching your Spring Boot application using an env variable that you will define with the OpenShift
|
||||
<code class="literal">DeploymentConfig</code> or Kubernetes <code class="literal">ReplicationConfig</code> resource file as follows:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> message</span>: Say Goodbye</pre></div><p>If both profiles are active, the property that appears last within the <code class="literal">ConfigMap</code> overwrites any preceding values.</p><p>To tell Spring Boot which <code class="literal">profile</code> should be enabled at bootstrap, you can pass a system property to the Java
|
||||
command. To do so, you can launch your Spring Boot application with an environment variable that you can define with the OpenShift
|
||||
<code class="literal">DeploymentConfig</code> or Kubernetes <code class="literal">ReplicationConfig</code> resource file, as follows:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: DeploymentConfig
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spec</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> replicas</span>: <span class="hl-number">1</span>
|
||||
@@ -99,20 +99,18 @@ command launching your Spring Boot application using an env variable that you wi
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> - name</span>: JAVA_APP_DIR
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> value</span>: /deployments
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> - name</span>: JAVA_OPTIONS
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> value</span>: -Dspring.profiles.active=developer</pre><p><span class="strong"><strong>Notes:</strong></span>
|
||||
- check the security configuration section, to access config maps from inside a pod you need to have the correct
|
||||
Kubernetes service accounts, roles and role bindings.</p><p>Another option for using ConfigMaps, is to mount them into the Pod running the Spring Cloud Kubernetes application
|
||||
and have Spring Cloud Kubernetes read them from the file system.
|
||||
This behavior is controlled by the <code class="literal">spring.cloud.kubernetes.config.paths</code> property and can be used in
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> value</span>: -Dspring.profiles.active=developer</pre></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You should check the security configuration section. To access config maps from inside a pod you need to have the correct
|
||||
Kubernetes service accounts, roles and role bindings.</p></td></tr></table></div><p>Another option for using <code class="literal">ConfigMap</code> instances is to mount them into the Pod by running the Spring Cloud Kubernetes application
|
||||
and having Spring Cloud Kubernetes read them from the file system.
|
||||
This behavior is controlled by the <code class="literal">spring.cloud.kubernetes.config.paths</code> property. You can use it in
|
||||
addition to or instead of the mechanism described earlier.
|
||||
Multiple (exact) file paths can be specified in <code class="literal">spring.cloud.kubernetes.config.paths</code> by using the <code class="literal">,</code> delimiter</p><p><span class="strong"><strong>Notes:</strong></span>
|
||||
You have to provide full exact path to each property file, because directories are not being recursively parsed.</p><div class="table"><a name="d0e360" href="#d0e360"></a><p class="title"><b>Table 5.1. Properties:</b></p><div class="table-contents"><table class="table" summary="Properties:" style="border-collapse: collapse;border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"><col class="col_4"></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Name</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Type</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Default</th><th style="border-bottom: 1px solid ; " align="left" valign="top">Description</th></tr></thead><tfoot><tr><th style="border-right: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.config.enableApi</p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p>Boolean</p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p>true</p></th><th style="" align="left" valign="top"><p>Enable/Disable consuming ConfigMaps via APIs</p></th></tr></tfoot><tbody><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.config.enabled</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Boolean</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>true</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Enable Secrets PropertySource</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.config.name</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>String</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>${spring.application.name}</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the name of ConfigMap to lookup</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.config.namespace</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>String</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Client namespace</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the Kubernetes namespace where to lookup</p></td></tr><tr><td style="border-right: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.config.paths</p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p>List</p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p>null</p></td><td style="" align="left" valign="top"><p>Sets the paths where ConfigMaps are mounted</p></td></tr></tbody></table></div></div><br class="table-break"></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_secrets_propertysource" href="#_secrets_propertysource"></a>5.2 Secrets PropertySource</h2></div></div></div><p>Kubernetes has the notion of <a class="link" href="https://kubernetes.io/docs/concepts/configuration/secret/" target="_top">Secrets</a> for storing
|
||||
sensitive data such as password, OAuth tokens, etc. This project provides integration with <code class="literal">Secrets</code> to make secrets
|
||||
accessible by Spring Boot applications. This feature can be explicitly enabled/disabled using the <code class="literal">spring.cloud.kubernetes.secrets.enabled</code> property.</p><p>The <code class="literal">SecretsPropertySource</code> when enabled will lookup Kubernetes for <code class="literal">Secrets</code> from the following sources:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">reading recursively from secrets mounts</li><li class="listitem">named after the application (as defined by <code class="literal">spring.application.name</code>)</li><li class="listitem">matching some labels</li></ol></div><p>Please note that by default, consuming Secrets via API (points 2 and 3 above) <span class="strong"><strong>is not enabled</strong></span> for security reasons
|
||||
and it is recommended that containers share secrets via mounted volumes.
|
||||
If you enable consuming Secrets via API, then it is recommended access to Secrets is limited by an
|
||||
[authorization policy such as RBAC](<a class="link" href="https://kubernetes.io/docs/concepts/configuration/secret/#best-practices" target="_top">https://kubernetes.io/docs/concepts/configuration/secret/#best-practices</a>).</p><p>If the secrets are found their data is made available to the application.</p><p><span class="strong"><strong>Example:</strong></span></p><p>Let’s assume that we have a spring boot application named <code class="literal">demo</code> that uses properties to read its database
|
||||
configuration. We can create a Kubernetes secret using the following command:</p><pre class="screen">oc create secret generic db-secret --from-literal=username=user --from-literal=password=p455w0rd</pre><p>This would create the following secret (shown using <code class="literal">oc get secrets db-secret -o yaml</code>):</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
You can specify multiple (exact) file paths in <code class="literal">spring.cloud.kubernetes.config.paths</code> by using the <code class="literal">,</code> delimiter.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You have to provide the full exact path to each property file, because directories are not being recursively parsed.</p></td></tr></table></div><div class="table"><a name="d0e416" href="#d0e416"></a><p class="title"><b>Table 5.1. Properties:</b></p><div class="table-contents"><table class="table" summary="Properties:" style="border-collapse: collapse;border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"><col class="col_4"></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Name</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Type</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Default</th><th style="border-bottom: 1px solid ; " align="left" valign="top">Description</th></tr></thead><tfoot><tr><th style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.config.enableApi</code></p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">Boolean</code></p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">true</code></p></th><th style="" align="left" valign="top"><p>Enable or disable consuming <code class="literal">ConfigMap</code> instances through APIs</p></th></tr></tfoot><tbody><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.config.enabled</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">Boolean</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">true</code></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Enable Secrets <code class="literal">PropertySource</code></p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.config.name</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">String</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">${spring.application.name}</code></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the name of <code class="literal">ConfigMap</code> to look up</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.config.namespace</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">String</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Client namespace</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the Kubernetes namespace where to lookup</p></td></tr><tr><td style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.config.paths</code></p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">List</code></p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">null</code></p></td><td style="" align="left" valign="top"><p>Sets the paths where <code class="literal">ConfigMap</code> instances are mounted</p></td></tr></tbody></table></div></div><br class="table-break"></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_secrets_propertysource" href="#_secrets_propertysource"></a>5.2 Secrets PropertySource</h2></div></div></div><p>Kubernetes has the notion of <a class="link" href="https://kubernetes.io/docs/concepts/configuration/secret/" target="_top">Secrets</a> for storing
|
||||
sensitive data such as passwords, OAuth tokens, and so on. This project provides integration with <code class="literal">Secrets</code> to make secrets
|
||||
accessible by Spring Boot applications. You can explicitly enable or disable This feature by setting the <code class="literal">spring.cloud.kubernetes.secrets.enabled</code> property.</p><p>When enabled, the <code class="literal">SecretsPropertySource</code> looks up Kubernetes for <code class="literal">Secrets</code> from the following sources:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Reading recursively from secrets mounts</li><li class="listitem">Named after the application (as defined by <code class="literal">spring.application.name</code>)</li><li class="listitem">Matching some labels</li></ol></div><p>Note that, by default, consuming Secrets through the API (points 2 and 3 above) <span class="strong"><strong>is not enabled</strong></span> for security reasons.
|
||||
Further, we recommend that containers share secrets through mounted volumes.
|
||||
If you enable consuming Secrets through the API, we recommend that you limit access to Secrets by using an
|
||||
[authorization policy, such as RBAC](<a class="link" href="https://kubernetes.io/docs/concepts/configuration/secret/#best-practices" target="_top">https://kubernetes.io/docs/concepts/configuration/secret/#best-practices</a>).</p><p>If the secrets are found, their data is made available to the application.</p><p>Assume that we have a spring boot application named <code class="literal">demo</code> that uses properties to read its database
|
||||
configuration. We can create a Kubernetes secret by using the following command:</p><div class="informalexample"><pre class="screen">oc create secret generic db-secret --from-literal=username=user --from-literal=password=p455w0rd</pre></div><p>The preceding command would create the following secret (which you can see by using <code class="literal">oc get secrets db-secret -o yaml</code>):</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">data</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> password</span>: cDQ1NXcwcmQ=
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> username</span>: dXNlcg==
|
||||
@@ -124,7 +122,7 @@ configuration. We can create a Kubernetes secret using the following command:</p
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> resourceVersion</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"357496"</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> selfLink</span>: /api/v1/namespaces/default/secrets/db-secret
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> uid</span>: <span class="hl-number">63</span>c89263-<span class="hl-number">6099</span>-<span class="hl-number">11e7</span>-b3da-<span class="hl-number">76d</span>6186905a8
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">type</span>: Opaque</pre><p>Note that the data contains Base64-encoded versions of the literal provided by the create command.</p><p>This secret can then be used by your application for example by exporting the secret’s value as environment variables:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">type</span>: Opaque</pre></div><p>Note that the data contains Base64-encoded versions of the literal provided by the <code class="literal">create</code> command.</p><p>Your application can then use this secret — for example, by exporting the secret’s value as environment variables:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: Deployment
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">metadata</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: ${project.artifactId<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span>
|
||||
@@ -142,31 +140,30 @@ configuration. We can create a Kubernetes secret using the following command:</p
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> valueFrom</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> secretKeyRef</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: db-secret
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> key</span>: password</pre><p>You can select the Secrets to consume in a number of ways:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p class="simpara">By listing the directories where secrets are mapped:</p><pre class="screen">-Dspring.cloud.kubernetes.secrets.paths=/etc/secrets/db-secret,etc/secrets/postgresql</pre><p class="simpara">If you have all the secrets mapped to a common root, you can set them like:</p><pre class="screen">-Dspring.cloud.kubernetes.secrets.paths=/etc/secrets</pre></li><li class="listitem"><p class="simpara">By setting a named secret:</p><pre class="screen">-Dspring.cloud.kubernetes.secrets.name=db-secret</pre></li><li class="listitem"><p class="simpara">By defining a list of labels:</p><pre class="screen">-Dspring.cloud.kubernetes.secrets.labels.broker=activemq
|
||||
-Dspring.cloud.kubernetes.secrets.labels.db=postgresql</pre></li></ol></div><div class="table"><a name="d0e535" href="#d0e535"></a><p class="title"><b>Table 5.2. Properties:</b></p><div class="table-contents"><table class="table" summary="Properties:" style="border-collapse: collapse;border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"><col class="col_4"></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Name</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Type</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Default</th><th style="border-bottom: 1px solid ; " align="left" valign="top">Description</th></tr></thead><tfoot><tr><th style="border-right: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.secrets.enableApi</p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p>Boolean</p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p>false</p></th><th style="" align="left" valign="top"><p>Enable/Disable consuming secrets via APIs (examples 2 and 3)</p></th></tr></tfoot><tbody><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.secrets.enabled</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Boolean</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>true</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Enable Secrets PropertySource</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.secrets.name</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>String</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>${spring.application.name}</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the name of the secret to lookup</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.secrets.namespace</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>String</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Client namespace</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the Kubernetes namespace where to lookup</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.secrets.labels</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Map</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>null</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the labels used to lookup secrets</p></td></tr><tr><td style="border-right: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.secrets.paths</p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p>List</p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p>null</p></td><td style="" align="left" valign="top"><p>Sets the paths where secrets are mounted (example 1)</p></td></tr></tbody></table></div></div><br class="table-break"><p><span class="strong"><strong>Notes:</strong></span>
|
||||
- The property <code class="literal">spring.cloud.kubernetes.secrets.labels</code> behaves as defined by
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> key</span>: password</pre></div><p>You can select the Secrets to consume in a number of ways:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p class="simpara">By listing the directories where secrets are mapped:</p><div class="informalexample"><pre class="programlisting">-Dspring.cloud.kubernetes.secrets.paths=/etc/secrets/db-secret,etc/secrets/postgresql</pre></div><p class="simpara">If you have all the secrets mapped to a common root, you can set them like:</p><div class="informalexample"><pre class="programlisting">-Dspring.cloud.kubernetes.secrets.paths=/etc/secrets</pre></div></li><li class="listitem"><p class="simpara">By setting a named secret:</p><div class="informalexample"><pre class="programlisting">-Dspring.cloud.kubernetes.secrets.name=db-secret</pre></div></li><li class="listitem"><p class="simpara">By defining a list of labels:</p><div class="informalexample"><pre class="programlisting">-Dspring.cloud.kubernetes.secrets.labels.broker=activemq
|
||||
-Dspring.cloud.kubernetes.secrets.labels.db=postgresql</pre></div></li></ol></div><div class="table"><a name="d0e623" href="#d0e623"></a><p class="title"><b>Table 5.2. Properties:</b></p><div class="table-contents"><table class="table" summary="Properties:" style="border-collapse: collapse;border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"><col class="col_4"></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Name</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Type</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Default</th><th style="border-bottom: 1px solid ; " align="left" valign="top">Description</th></tr></thead><tfoot><tr><th style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.secrets.enableApi</code></p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">Boolean</code></p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">false</code></p></th><th style="" align="left" valign="top"><p>Enables or disables consuming secrets through APIs (examples 2 and 3)</p></th></tr></tfoot><tbody><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.secrets.enabled</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">Boolean</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">true</code></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Enable Secrets <code class="literal">PropertySource</code></p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.secrets.name</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">String</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">${spring.application.name}</code></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the name of the secret to look up</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.secrets.namespace</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">String</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Client namespace</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the Kubernetes namespace where to look up</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.secrets.labels</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">Map</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">null</code></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Sets the labels used to lookup secrets</p></td></tr><tr><td style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.secrets.paths</code></p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">List</code></p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">null</code></p></td><td style="" align="left" valign="top"><p>Sets the paths where secrets are mounted (example 1)</p></td></tr></tbody></table></div></div><br class="table-break"><p>Notes:
|
||||
* The <code class="literal">spring.cloud.kubernetes.secrets.labels</code> property behaves as defined by
|
||||
<a class="link" href="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-Configuration-Binding#map-based-binding" target="_top">Map-based binding</a>.
|
||||
- The property <code class="literal">spring.cloud.kubernetes.secrets.paths</code> behaves as defined by
|
||||
* The <code class="literal">spring.cloud.kubernetes.secrets.paths</code> property behaves as defined by
|
||||
<a class="link" href="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-Configuration-Binding#collection-based-binding" target="_top">Collection-based binding</a>.
|
||||
- Access to secrets via API may be restricted for security reasons, the preferred way is to mount secret to the POD.</p><p>Example of application using secrets (though it hasn’t been updated to use the new <code class="literal">spring-cloud-kubernetes</code> project):
|
||||
<a class="link" href="https://github.com/fabric8-quickstarts/spring-boot-camel-config" target="_top">spring-boot-camel-config</a></p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_propertysource_reload" href="#_propertysource_reload"></a>5.3 PropertySource Reload</h2></div></div></div><p>Some applications may need to detect changes on external property sources and update their internal status to reflect the new configuration.
|
||||
* Access to secrets through the API may be restricted for security reasons. The preferred way is to mount secrets to the Pod.</p><p>You can find an example of an application that uses secrets (though it has not been updated to use the new <code class="literal">spring-cloud-kubernetes</code> project) at
|
||||
<a class="link" href="https://github.com/fabric8-quickstarts/spring-boot-camel-config" target="_top">spring-boot-camel-config</a></p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_propertysource_reload" href="#_propertysource_reload"></a>5.3 <code class="literal">PropertySource</code> Reload</h2></div></div></div><p>Some applications may need to detect changes on external property sources and update their internal status to reflect the new configuration.
|
||||
The reload feature of Spring Cloud Kubernetes is able to trigger an application reload when a related <code class="literal">ConfigMap</code> or
|
||||
<code class="literal">Secret</code> changes.</p><p>This feature is disabled by default and can be enabled using the configuration property <code class="literal">spring.cloud.kubernetes.reload.enabled=true</code>
|
||||
(eg. in the <span class="strong"><strong>application.properties</strong></span> file).</p><p>The following levels of reload are supported (property <code class="literal">spring.cloud.kubernetes.reload.strategy</code>):
|
||||
- <span class="strong"><strong><code class="literal">refresh</code> (default)</strong></span>: only configuration beans annotated with <code class="literal">@ConfigurationProperties</code> or <code class="literal">@RefreshScope</code> are reloaded.
|
||||
<code class="literal">Secret</code> changes.</p><p>By default, this feature is disabled. You can enable it by using the <code class="literal">spring.cloud.kubernetes.reload.enabled=true</code> configuration property (for example, in the <code class="literal">application.properties</code> file).</p><p>The following levels of reload are supported (by setting the <code class="literal">spring.cloud.kubernetes.reload.strategy</code> property):
|
||||
* <code class="literal">refresh</code> (default): Only configuration beans annotated with <code class="literal">@ConfigurationProperties</code> or <code class="literal">@RefreshScope</code> are reloaded.
|
||||
This reload level leverages the refresh feature of Spring Cloud Context.
|
||||
- <span class="strong"><strong><code class="literal">restart_context</code></strong></span>: the whole Spring <span class="emphasis"><em>ApplicationContext</em></span> is gracefully restarted. Beans are recreated with the new configuration.
|
||||
- <span class="strong"><strong><code class="literal">shutdown</code></strong></span>: the Spring <span class="emphasis"><em>ApplicationContext</em></span> is shut down to activate a restart of the container.
|
||||
When using this level, make sure that the lifecycle of all non-daemon threads is bound to the ApplicationContext
|
||||
and that a replication controller or replica set is configured to restart the pod.</p><p>Example:</p><p>Assuming that the reload feature is enabled with default settings (<span class="strong"><strong><code class="literal">refresh</code></strong></span> mode), the following bean will be refreshed when the config map changes:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Configuration</span></em>
|
||||
<em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix = "bean")</span></em>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyConfig {
|
||||
* <code class="literal">restart_context</code>: the whole Spring <code class="literal">ApplicationContext</code> is gracefully restarted. Beans are recreated with the new configuration.
|
||||
* <code class="literal">shutdown</code>: the Spring <code class="literal">ApplicationContext</code> is shut down to activate a restart of the container.
|
||||
When you use this level, make sure that the lifecycle of all non-daemon threads is bound to the <code class="literal">ApplicationContext</code>
|
||||
and that a replication controller or replica set is configured to restart the pod.</p><p>Assuming that the reload feature is enabled with default settings (<code class="literal">refresh</code> mode), the following bean is refreshed when the config map changes:</p><div class="informalexample"><pre class="screen">@Configuration
|
||||
@ConfigurationProperties(prefix = "bean")
|
||||
public class MyConfig {
|
||||
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String message = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"a message that can be changed live"</span>;
|
||||
private String message = "a message that can be changed live";
|
||||
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// getter and setters</span>
|
||||
// getter and setters
|
||||
|
||||
}</pre><p>A way to see that changes effectively happen is creating another bean that prints the message periodically.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em>
|
||||
}</pre></div><p>To see that changes effectively happen, you can create another bean that prints the message periodically, as follows</p><div class="informalexample"><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean {
|
||||
|
||||
<em><span class="hl-annotation" style="color: gray">@Autowired</span></em>
|
||||
@@ -176,23 +173,23 @@ This reload level leverages the refresh feature of Spring Cloud Context.
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> hello() {
|
||||
System.out.println(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"The message is: "</span> + config.getMessage());
|
||||
}
|
||||
}</pre><p>The message printed by the application can be changed using a <code class="literal">ConfigMap</code> as follows:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
}</pre></div><p>You can change the message printed by the application by using a <code class="literal">ConfigMap</code>, as follows:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">apiVersion</span>: v1
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">kind</span>: ConfigMap
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">metadata</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: reload-example
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">data</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> application.properties</span>: |-
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> bean.message</span>=Hello World!</pre><p>Any change to the property named <code class="literal">bean.message</code> in the <code class="literal">ConfigMap</code> associated to the pod will be reflected in the
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> bean.message</span>=Hello World!</pre></div><p>Any change to the property named <code class="literal">bean.message</code> in the <code class="literal">ConfigMap</code> associated with the pod is reflected in the
|
||||
output. More generally speaking, changes associated to properties prefixed with the value defined by the <code class="literal">prefix</code>
|
||||
field of the <code class="literal">@ConfigurationProperties</code> annotation will be detected and reflected in the application.
|
||||
[Associating a <code class="literal">ConfigMap</code> to a pod](#configmap-propertysource) is explained above.</p><p>The full example is available in [spring-cloud-kubernetes-reload-example](spring-cloud-kubernetes-examples/kubernetes-reload-example).</p><p>The reload feature supports two operating modes:
|
||||
- <span class="strong"><strong>event (default)</strong></span>: watches for changes in config maps or secrets using the Kubernetes API (web socket).
|
||||
Any event will produce a re-check on the configuration and a reload in case of changes.
|
||||
The <code class="literal">view</code> role on the service account is required in order to listen for config map changes. A higher level role (eg. <code class="literal">edit</code>) is required for secrets
|
||||
(secrets are not monitored by default).
|
||||
- <span class="strong"><strong>polling</strong></span>: re-creates the configuration periodically from config maps and secrets to see if it has changed.
|
||||
The polling period can be configured using the property <code class="literal">spring.cloud.kubernetes.reload.period</code> and defaults to <span class="strong"><strong>15 seconds</strong></span>.
|
||||
field of the <code class="literal">@ConfigurationProperties</code> annotation are detected and reflected in the application.
|
||||
<a class="link" href="multi__kubernetes_propertysource_implementations.html#configmap-propertysource" title="5.1 Using a ConfigMap PropertySource">Associating a <code class="literal">ConfigMap</code> with a pod</a> is explained earlier in this chapter.</p><p>The full example is available in <a class="link" href="https://github.com/fabric8io/spring-cloud-kubernetes/tree/master/spring-cloud-kubernetes-examples/kubernetes-reload-example" target="_top"><code class="literal">spring-cloud-kubernetes-reload-example</code></a>.</p><p>The reload feature supports two operating modes:
|
||||
* Event (default): Watches for changes in config maps or secrets by using the Kubernetes API (web socket).
|
||||
Any event produces a re-check on the configuration and, in case of changes, a reload.
|
||||
The <code class="literal">view</code> role on the service account is required in order to listen for config map changes. A higher level role (such as <code class="literal">edit</code>) is required for secrets
|
||||
(by default, secrets are not monitored).
|
||||
* Polling: Oeriodically re-creates the configuration from config maps and secrets to see if it has changed.
|
||||
You can configure the polling period by using the <code class="literal">spring.cloud.kubernetes.reload.period</code> property and defaults to 15 seconds.
|
||||
It requires the same role as the monitored property source.
|
||||
This means, for example, that using polling on file mounted secret sources does not require particular privileges.</p><div class="table"><a name="d0e765" href="#d0e765"></a><p class="title"><b>Table 5.3. Properties:</b></p><div class="table-contents"><table class="table" summary="Properties:" style="border-collapse: collapse;border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"><col class="col_4"></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Name</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Type</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Default</th><th style="border-bottom: 1px solid ; " align="left" valign="top">Description</th></tr></thead><tfoot><tr><th style="border-right: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.reload.period</p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p>Duration</p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p>15s</p></th><th style="" align="left" valign="top"><p>The period for verifying changes when using the <span class="strong"><strong>polling</strong></span> strategy</p></th></tr></tfoot><tbody><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.reload.enabled</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Boolean</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>false</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Enables monitoring of property sources and configuration reload</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.reload.monitoring-config-maps</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Boolean</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>true</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Allow monitoring changes in config maps</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.reload.monitoring-secrets</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Boolean</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>false</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Allow monitoring changes in secrets</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.reload.strategy</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Enum</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>refresh</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>The strategy to use when firing a reload (<span class="strong"><strong>refresh</strong></span>, <span class="strong"><strong>restart_context</strong></span>, <span class="strong"><strong>shutdown</strong></span>)</p></td></tr><tr><td style="border-right: 1px solid ; " align="left" valign="top"><p>spring.cloud.kubernetes.reload.mode</p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p>Enum</p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p>event</p></td><td style="" align="left" valign="top"><p>Specifies how to listen for changes in property sources (<span class="strong"><strong>event</strong></span>, <span class="strong"><strong>polling</strong></span>)</p></td></tr></tbody></table></div></div><br class="table-break"><p><span class="strong"><strong>Notes</strong></span>:
|
||||
- Properties under <span class="strong"><strong>spring.cloud.kubernetes.reload.</strong></span> should not be used in config maps or secrets: changing such properties at runtime may lead to unexpected results;
|
||||
- Deleting a property or the whole config map does not restore the original state of the beans when using the <span class="strong"><strong>refresh</strong></span> level.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__kubernetes_native_service_discovery.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__ribbon_discovery_in_kubernetes.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4. Kubernetes native service discovery </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 6. Ribbon discovery in Kubernetes</td></tr></table></div></body></html>
|
||||
This means, for example, that using polling on file-mounted secret sources does not require particular privileges.</p><div class="table"><a name="d0e869" href="#d0e869"></a><p class="title"><b>Table 5.3. Properties:</b></p><div class="table-contents"><table class="table" summary="Properties:" style="border-collapse: collapse;border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"><col class="col_4"></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Name</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Type</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Default</th><th style="border-bottom: 1px solid ; " align="left" valign="top">Description</th></tr></thead><tfoot><tr><th style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.reload.period</code></p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">Duration</code></p></th><th style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">15s</code></p></th><th style="" align="left" valign="top"><p>The period for verifying changes when using the <code class="literal">polling</code> strategy</p></th></tr></tfoot><tbody><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.reload.enabled</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">Boolean</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">false</code></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Enables monitoring of property sources and configuration reload</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.reload.monitoring-config-maps</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">Boolean</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">true</code></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Allow monitoring changes in config maps</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.reload.monitoring-secrets</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">Boolean</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">false</code></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Allow monitoring changes in secrets</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>`spring.cloud.kubernetes.reload.strategy `</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">Enum</code></p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><code class="literal">refresh</code></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>The strategy to use when firing a reload (<code class="literal">refresh</code>, <code class="literal">restart_context</code>, or <code class="literal">shutdown</code>)</p></td></tr><tr><td style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">spring.cloud.kubernetes.reload.mode</code></p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">Enum</code></p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p><code class="literal">event</code></p></td><td style="" align="left" valign="top"><p>Specifies how to listen for changes in property sources (<code class="literal">event</code> or <code class="literal">polling</code>)</p></td></tr></tbody></table></div></div><br class="table-break"><p>Notes:
|
||||
* You should not use properties under <code class="literal">spring.cloud.kubernetes.reload</code> in config maps or secrets. Changing such properties at runtime may lead to unexpected results.
|
||||
* Deleting a property or the whole config map does not restore the original state of the beans when you use the <code class="literal">refresh</code> level.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__kubernetes_native_service_discovery.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__ribbon_discovery_in_kubernetes.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4. Kubernetes native service discovery </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 6. Ribbon Discovery in Kubernetes</td></tr></table></div></body></html>
|
||||
@@ -1,3 +1,3 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>9. Leader Election</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__pod_health_indicator.html" title="8. Pod Health Indicator"><link rel="next" href="multi__security_configurations_inside_kubernetes.html" title="10. Security Configurations inside Kubernetes"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">9. Leader Election</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__pod_health_indicator.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__security_configurations_inside_kubernetes.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_leader_election" href="#_leader_election"></a>9. Leader Election</h1></div></div></div><p><TBD></p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__pod_health_indicator.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__security_configurations_inside_kubernetes.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">8. Pod Health Indicator </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 10. Security Configurations inside Kubernetes</td></tr></table></div></body></html>
|
||||
<title>9. Leader Election</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__pod_health_indicator.html" title="8. Pod Health Indicator"><link rel="next" href="multi__security_configurations_inside_kubernetes.html" title="10. Security Configurations Inside Kubernetes"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">9. Leader Election</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__pod_health_indicator.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__security_configurations_inside_kubernetes.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_leader_election" href="#_leader_election"></a>9. Leader Election</h1></div></div></div><p><TBD></p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__pod_health_indicator.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__security_configurations_inside_kubernetes.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">8. Pod Health Indicator </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 10. Security Configurations Inside Kubernetes</td></tr></table></div></body></html>
|
||||
@@ -1,3 +1,3 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>12. Other Resources</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__examples.html" title="11. Examples"><link rel="next" href="multi__building.html" title="13. Building"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">12. Other Resources</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__examples.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__building.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_other_resources" href="#_other_resources"></a>12. Other Resources</h1></div></div></div><p>Here you can find other resources such as presentations(slides) and videos about Spring Cloud Kubernetes.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="https://salaboy.com/2018/09/27/the-s1p-experience/" target="_top">S1P Spring Cloud on PKS</a></li><li class="listitem"><a class="link" href="https://salaboy.com/2018/07/18/ljc-july-18-spring-cloud-docker-k8s/" target="_top">Spring Cloud, Docker, Kubernetes → London Java Community July 2018</a></li></ul></div><p>Please feel free to submit other resources via PR to <a class="link" href="http://github.com/spring-cloud/spring-cloud-kubernetes" target="_top">this repository</a>.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__examples.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__building.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">11. Examples </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 13. Building</td></tr></table></div></body></html>
|
||||
<title>12. Other Resources</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__examples.html" title="11. Examples"><link rel="next" href="multi__building.html" title="13. Building"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">12. Other Resources</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__examples.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__building.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_other_resources" href="#_other_resources"></a>12. Other Resources</h1></div></div></div><p>This section lists other resources, such as presentations (slides) and videos about Spring Cloud Kubernetes.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="https://salaboy.com/2018/09/27/the-s1p-experience/" target="_top">S1P Spring Cloud on PKS</a></li><li class="listitem"><a class="link" href="https://salaboy.com/2018/07/18/ljc-july-18-spring-cloud-docker-k8s/" target="_top">Spring Cloud, Docker, Kubernetes → London Java Community July 2018</a></li></ul></div><p>Please feel free to submit other resources through pull requests to <a class="link" href="https://github.com/spring-cloud/spring-cloud-kubernetes" target="_top">this repository</a>.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__examples.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__building.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">11. Examples </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 13. Building</td></tr></table></div></body></html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>8. Pod Health Indicator</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__kubernetes_ecosystem_awareness.html" title="7. Kubernetes Ecosystem Awareness"><link rel="next" href="multi__leader_election.html" title="9. Leader Election"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">8. Pod Health Indicator</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__kubernetes_ecosystem_awareness.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__leader_election.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_pod_health_indicator" href="#_pod_health_indicator"></a>8. Pod Health Indicator</h1></div></div></div><p>Spring Boot uses <a class="link" href="https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java" target="_top">HealthIndicator</a> to expose info about the health of an application.
|
||||
That makes it really useful for exposing health related information to the user and are also a good fit for use as <a class="link" href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/" target="_top">readiness probes</a>.</p><p>The Kubernetes health indicator which is part of the core module exposes the following info:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">pod name, ip address, namespace, service account, node name and its ip address</li><li class="listitem">flag that indicates if the Spring Boot application is internal or external to Kubernetes</li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__kubernetes_ecosystem_awareness.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__leader_election.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7. Kubernetes Ecosystem Awareness </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 9. Leader Election</td></tr></table></div></body></html>
|
||||
<title>8. Pod Health Indicator</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__kubernetes_ecosystem_awareness.html" title="7. Kubernetes Ecosystem Awareness"><link rel="next" href="multi__leader_election.html" title="9. Leader Election"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">8. Pod Health Indicator</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__kubernetes_ecosystem_awareness.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__leader_election.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_pod_health_indicator" href="#_pod_health_indicator"></a>8. Pod Health Indicator</h1></div></div></div><p>Spring Boot uses <a class="link" href="https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java" target="_top"><code class="literal">HealthIndicator</code></a> to expose info about the health of an application.
|
||||
That makes it really useful for exposing health-related information to the user and makes it a good fit for use as <a class="link" href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/" target="_top">readiness probes</a>.</p><p>The Kubernetes health indicator (which is part of the core module) exposes the following info:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Pod name, IP address, namespace, service account, node name, and its IP address</li><li class="listitem">A flag that indicates whether the Spring Boot application is internal or external to Kubernetes</li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__kubernetes_ecosystem_awareness.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__leader_election.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7. Kubernetes Ecosystem Awareness </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 9. Leader Election</td></tr></table></div></body></html>
|
||||
@@ -1,17 +1,20 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>6. Ribbon discovery in Kubernetes</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__kubernetes_propertysource_implementations.html" title="5. Kubernetes PropertySource implementations"><link rel="next" href="multi__kubernetes_ecosystem_awareness.html" title="7. Kubernetes Ecosystem Awareness"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">6. Ribbon discovery in Kubernetes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__kubernetes_propertysource_implementations.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__kubernetes_ecosystem_awareness.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_ribbon_discovery_in_kubernetes" href="#_ribbon_discovery_in_kubernetes"></a>6. Ribbon discovery in Kubernetes</h1></div></div></div><p>Spring Cloud client applications calling a microservice should be interested on relying on a client load-balancing
|
||||
<title>6. Ribbon Discovery in Kubernetes</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__kubernetes_propertysource_implementations.html" title="5. Kubernetes PropertySource implementations"><link rel="next" href="multi__kubernetes_ecosystem_awareness.html" title="7. Kubernetes Ecosystem Awareness"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">6. Ribbon Discovery in Kubernetes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__kubernetes_propertysource_implementations.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__kubernetes_ecosystem_awareness.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_ribbon_discovery_in_kubernetes" href="#_ribbon_discovery_in_kubernetes"></a>6. Ribbon Discovery in Kubernetes</h1></div></div></div><p>Spring Cloud client applications that call a microservice should be interested on relying on a client load-balancing
|
||||
feature in order to automatically discover at which endpoint(s) it can reach a given service. This mechanism has been
|
||||
implemented within the [spring-cloud-kubernetes-ribbon](spring-cloud-kubernetes-ribbon/pom.xml) project where a
|
||||
Kubernetes client will populate a <a class="link" href="https://github.com/Netflix/ribbon" target="_top">Ribbon</a> <code class="literal">ServerList</code> containing information
|
||||
about such endpoints.</p><p>When the list of the endpoints is populated, the Kubernetes client will search the registered endpoints living in
|
||||
the current namespace/project matching the service name defined using the Ribbon Client annotation:</p><pre class="programlisting">@RibbonClient(name = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"name-service"</span>)</pre><p>You can configure Ribbon’s behavior by providing properties in your <code class="literal">application.properties</code> (via your application’s
|
||||
dedicated <code class="literal">ConfigMap</code>) using the following format: <code class="literal"><name of your service>.ribbon.<Ribbon configuration key></code> where:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal"><name of your service></code> corresponds to the service name you’re accessing over Ribbon, as configured using the
|
||||
<code class="literal">@RibbonClient</code> annotation (e.g. <code class="literal">name-service</code> in the example above)</li><li class="listitem"><code class="literal"><Ribbon configuration key></code> is one of the Ribbon configuration key defined by
|
||||
<a class="link" href="https://github.com/Netflix/ribbon/blob/master/ribbon-core/src/main/java/com/netflix/client/config/CommonClientConfigKey.java" target="_top">Ribbon’s CommonClientConfigKey class</a></li></ul></div><p>Additionally, the <code class="literal">spring-cloud-kubernetes-ribbon</code> project defines two additional configuration keys to further
|
||||
implemented within the <a class="link" href="https://github.com/spring-cloud/spring-cloud-kubernetes/tree/master/spring-cloud-kubernetes-ribbon" target="_top">spring-cloud-kubernetes-ribbon</a> project, where a
|
||||
Kubernetes client populates a <a class="link" href="https://github.com/Netflix/ribbon" target="_top">Ribbon</a> <code class="literal">ServerList</code> that contains information
|
||||
about such endpoints.</p><p>The implementation is part of the following starter that you can use by adding its dependency to your pom file:</p><div class="informalexample"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-cloud-starter-kubernetes-ribbon<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>${latest.version}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre></div><p>When the list of the endpoints is populated, the Kubernetes client searches the registered endpoints that live in
|
||||
the current namespace or project by matching the service name defined in the Ribbon Client annotation, as follows:</p><div class="informalexample"><pre class="programlisting">@RibbonClient(name = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"name-service"</span>)</pre></div><p>You can configure Ribbon’s behavior by providing properties in your <code class="literal">application.properties</code> (through your application’s
|
||||
dedicated <code class="literal">ConfigMap</code>) by using the following format: <code class="literal"><name of your service>.ribbon.<Ribbon configuration key></code>, where:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal"><name of your service></code> corresponds to the service name you access over Ribbon, as configured by using the
|
||||
<code class="literal">@RibbonClient</code> annotation (such as <code class="literal">name-service</code> in the preceding example).</li><li class="listitem"><code class="literal"><Ribbon configuration key></code> is one of the Ribbon configuration keys defined by
|
||||
<a class="link" href="https://github.com/Netflix/ribbon/blob/master/ribbon-core/src/main/java/com/netflix/client/config/CommonClientConfigKey.java" target="_top">Ribbon’s <code class="literal">CommonClientConfigKey</code> class</a>.</li></ul></div><p>Additionally, the <code class="literal">spring-cloud-kubernetes-ribbon</code> project defines two additional configuration keys to further
|
||||
control how Ribbon interacts with Kubernetes. In particular, if an endpoint defines multiple ports, the default
|
||||
behavior is to use the first one found. To select more specifically which port to use, in a multi-port service, use
|
||||
the <code class="literal">PortName</code> key. If you want to specify in which Kubernetes' namespace the target service should be looked up, use
|
||||
behavior is to use the first one found. To select more specifically which port to use in a multi-port service, you can use
|
||||
the <code class="literal">PortName</code> key. If you want to specify in which Kubernetes namespace the target service should be looked up, you can use
|
||||
the <code class="literal">KubernetesNamespace</code> key, remembering in both instances to prefix these keys with your service name and
|
||||
<code class="literal">ribbon</code> prefix as specified above.</p><p>Examples that are using this module for ribbon discovery are:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="./spring-cloud-kubernetes-examples/kubernetes-circuitbreaker-ribbon-example" target="_top">Spring Cloud Circuitbreaker and Ribbon</a></li><li class="listitem"><a class="link" href="https://github.com/fabric8-quickstarts/spring-boot-ribbon" target="_top">fabric8-quickstarts - Spring Boot - Ribbon</a></li><li class="listitem"><a class="link" href="https://github.com/fabric8io/kubeflix/tree/master/examples/loanbroker/bank" target="_top">Kubeflix - LoanBroker - Bank</a></li></ul></div><p><span class="strong"><strong>Note</strong></span>: The Ribbon discovery client can be disabled by setting this key within the application properties file
|
||||
<code class="literal">spring.cloud.kubernetes.ribbon.enabled=false</code>.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__kubernetes_propertysource_implementations.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__kubernetes_ecosystem_awareness.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5. Kubernetes PropertySource implementations </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 7. Kubernetes Ecosystem Awareness</td></tr></table></div></body></html>
|
||||
<code class="literal">ribbon</code> prefix, as specified earlier.</p><p>The following examples use this module for ribbon discovery:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="./spring-cloud-kubernetes-examples/kubernetes-circuitbreaker-ribbon-example" target="_top">Spring Cloud Circuitbreaker and Ribbon</a></li><li class="listitem"><a class="link" href="https://github.com/fabric8-quickstarts/spring-boot-ribbon" target="_top">fabric8-quickstarts - Spring Boot - Ribbon</a></li><li class="listitem"><a class="link" href="https://github.com/fabric8io/kubeflix/tree/master/examples/loanbroker/bank" target="_top">Kubeflix - LoanBroker - Bank</a></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You can disable the Ribbon discovery client by setting the <code class="literal">spring.cloud.kubernetes.ribbon.enabled=false</code> key within the application properties file.</p></td></tr></table></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__kubernetes_propertysource_implementations.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__kubernetes_ecosystem_awareness.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5. Kubernetes PropertySource implementations </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 7. Kubernetes Ecosystem Awareness</td></tr></table></div></body></html>
|
||||
@@ -1,9 +1,9 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>10. Security Configurations inside Kubernetes</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__leader_election.html" title="9. Leader Election"><link rel="next" href="multi__examples.html" title="11. Examples"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">10. Security Configurations inside Kubernetes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__leader_election.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__examples.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_security_configurations_inside_kubernetes" href="#_security_configurations_inside_kubernetes"></a>10. Security Configurations inside Kubernetes</h1></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_namespace" href="#_namespace"></a>10.1 Namespace</h2></div></div></div><p>Most of the components provided in this project need to know the namespace. For Kubernetes (1.3+) the namespace is made available to pod as part of the service account secret and automatically detected by the client.
|
||||
For earlier version it needs to be specified as an env var to the pod. A quick way to do this is:</p><pre class="literallayout">env:
|
||||
- name: "KUBERNETES_NAMESPACE"
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: "metadata.namespace"</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_service_account" href="#_service_account"></a>10.2 Service Account</h2></div></div></div><p>For distros of Kubernetes that support more fine-grained role-based access within the cluster, you need to make sure a pod that runs with spring-cloud-kubernetes has access to the Kubernetes API.
|
||||
For any service accounts you assign to a deployment/pod, you need to make sure it has the correct roles. For example, you can add <code class="literal">cluster-reader</code> permissions to your <code class="literal">default</code> service account depending on the project you’re in:</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__leader_election.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__examples.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9. Leader Election </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 11. Examples</td></tr></table></div></body></html>
|
||||
<title>10. Security Configurations Inside Kubernetes</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi__leader_election.html" title="9. Leader Election"><link rel="next" href="multi__examples.html" title="11. Examples"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">10. Security Configurations Inside Kubernetes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__leader_election.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__examples.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_security_configurations_inside_kubernetes" href="#_security_configurations_inside_kubernetes"></a>10. Security Configurations Inside Kubernetes</h1></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_namespace" href="#_namespace"></a>10.1 Namespace</h2></div></div></div><p>Most of the components provided in this project need to know the namespace. For Kubernetes (1.3+), the namespace is made available to the pod as part of the service account secret and is automatically detected by the client.
|
||||
For earlier versions, it needs to be specified as an environment variable to the pod. A quick way to do this is as follows:</p><div class="informalexample"><pre class="screen"> env:
|
||||
- name: "KUBERNETES_NAMESPACE"
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: "metadata.namespace"</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_service_account" href="#_service_account"></a>10.2 Service Account</h2></div></div></div><p>For distributions of Kubernetes that support more fine-grained role-based access within the cluster, you need to make sure a pod that runs with <code class="literal">spring-cloud-kubernetes</code> has access to the Kubernetes API.
|
||||
For any service accounts you assign to a deployment or pod, you need to make sure they have the correct roles. For example, you can add <code class="literal">cluster-reader</code> permissions to your <code class="literal">default</code> service account, depending on the project you’re in.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__leader_election.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__examples.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9. Leader Election </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 11. Examples</td></tr></table></div></body></html>
|
||||
@@ -10,12 +10,12 @@ resolves service names to Kubernetes Services.</p></td></tr><tr><td style="borde
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-cloud-starter-kubernetes-config<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Load application properties from Kubernetes
|
||||
<a class="link" href="multi__kubernetes_propertysource_implementations.html#_configmap_propertysource" title="5.1 ConfigMap PropertySource">ConfigMaps</a> and <a class="link" href="multi__kubernetes_propertysource_implementations.html#_secrets_propertysource" title="5.2 Secrets PropertySource">Secrets</a>.
|
||||
<a class="link" href="multi__kubernetes_propertysource_implementations.html#_propertysource_reload" title="5.3 PropertySource Reload">Reload</a> application properties when a ConfigMap or
|
||||
<a class="link" href="">ConfigMaps</a> and <a class="link" href="multi__kubernetes_propertysource_implementations.html#_secrets_propertysource" title="5.2 Secrets PropertySource">Secrets</a>.
|
||||
<a class="link" href="">Reload</a> application properties when a ConfigMap or
|
||||
Secret changes.</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-cloud-starter-kubernetes-ribbon<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p><a class="link" href="multi__ribbon_discovery_in_kubernetes.html" title="6. Ribbon discovery in Kubernetes">Ribbon</a> client-side load balancer with
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p><a class="link" href="">Ribbon</a> client-side load balancer with
|
||||
server list obtained from Kubernetes Endpoints.</p></td></tr><tr><td style="border-right: 1px solid ; " align="left" valign="top"><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-cloud-starter-kubernetes-all<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>1. Why do you need Spring Cloud Kubernetes?</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="next" href="multi__starters.html" title="2. Starters"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">1. Why do you need Spring Cloud Kubernetes?</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi_spring-cloud-kubernetes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__starters.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_why_do_you_need_spring_cloud_kubernetes" href="#_why_do_you_need_spring_cloud_kubernetes"></a>1. Why do you need Spring Cloud Kubernetes?</h1></div></div></div><p>Spring Cloud Kubernetes provide Spring Cloud common interfaces implementations to consume Kubernetes native services.
|
||||
The main objective of the projects provided in this repository is to facilitate the integration of Spring Cloud/Spring Boot applications running inside Kubernetes.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_spring-cloud-kubernetes.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__starters.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Spring Cloud Kubernetes </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 2. Starters</td></tr></table></div></body></html>
|
||||
<title>1. Why do you need Spring Cloud Kubernetes?</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi_pr01.html" title=""><link rel="next" href="multi__starters.html" title="2. Starters"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">1. Why do you need Spring Cloud Kubernetes?</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi_pr01.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__starters.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_why_do_you_need_spring_cloud_kubernetes" href="#_why_do_you_need_spring_cloud_kubernetes"></a>1. Why do you need Spring Cloud Kubernetes?</h1></div></div></div><p>Spring Cloud Kubernetes provide Spring Cloud common interface implementations that consume Kubernetes native services.
|
||||
The main objective of the projects provided in this repository is to facilitate the integration of Spring Cloud and Spring Boot applications running inside Kubernetes.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_pr01.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__starters.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 2. Starters</td></tr></table></div></body></html>
|
||||
3
multi/multi_pr01.html
Normal file
3
multi/multi_pr01.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title></title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="up" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="prev" href="multi_spring-cloud-kubernetes.html" title="Spring Cloud Kubernetes"><link rel="next" href="multi__why_do_you_need_spring_cloud_kubernetes.html" title="1. Why do you need Spring Cloud Kubernetes?"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi_spring-cloud-kubernetes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__why_do_you_need_spring_cloud_kubernetes.html">Next</a></td></tr></table><hr></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a name="d0e9" href="#d0e9"></a></h1></div></div></div><p>This reference guide covers how to use Spring Cloud Kubernetes.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_spring-cloud-kubernetes.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__why_do_you_need_spring_cloud_kubernetes.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Spring Cloud Kubernetes </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-kubernetes.html">Home</a></td><td width="40%" align="right" valign="top"> 1. Why do you need Spring Cloud Kubernetes?</td></tr></table></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -6,10 +6,14 @@
|
||||
<title>Spring Cloud Kubernetes</title>
|
||||
<date>2019-02-28</date>
|
||||
</info>
|
||||
<preface>
|
||||
<title></title>
|
||||
<simpara>This reference guide covers how to use Spring Cloud Kubernetes.</simpara>
|
||||
</preface>
|
||||
<chapter xml:id="_why_do_you_need_spring_cloud_kubernetes">
|
||||
<title>Why do you need Spring Cloud Kubernetes?</title>
|
||||
<simpara>Spring Cloud Kubernetes provide Spring Cloud common interfaces implementations to consume Kubernetes native services.
|
||||
The main objective of the projects provided in this repository is to facilitate the integration of Spring Cloud/Spring Boot applications running inside Kubernetes.</simpara>
|
||||
<simpara>Spring Cloud Kubernetes provide Spring Cloud common interface implementations that consume Kubernetes native services.
|
||||
The main objective of the projects provided in this repository is to facilitate the integration of Spring Cloud and Spring Boot applications running inside Kubernetes.</simpara>
|
||||
</chapter>
|
||||
<chapter xml:id="_starters">
|
||||
<title>Starters</title>
|
||||
@@ -41,8 +45,8 @@ resolves service names to Kubernetes Services.</simpara></entry>
|
||||
<artifactId>spring-cloud-starter-kubernetes-config</artifactId>
|
||||
</dependency></programlisting></entry>
|
||||
<entry align="left" valign="top"><simpara>Load application properties from Kubernetes
|
||||
<link linkend="_configmap_propertysource">ConfigMaps</link> and <link linkend="_secrets_propertysource">Secrets</link>.
|
||||
<link linkend="_propertysource_reload">Reload</link> application properties when a ConfigMap or
|
||||
<link linkend="ConfigMap PropertySource">ConfigMaps</link> and <link linkend="_secrets_propertysource">Secrets</link>.
|
||||
<link linkend="PropertySource Reload">Reload</link> application properties when a ConfigMap or
|
||||
Secret changes.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
@@ -50,7 +54,7 @@ Secret changes.</simpara></entry>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-ribbon</artifactId>
|
||||
</dependency></programlisting></entry>
|
||||
<entry align="left" valign="top"><simpara><link linkend="_ribbon_discovery_in_kubernetes">Ribbon</link> client-side load balancer with
|
||||
<entry align="left" valign="top"><simpara><link linkend="Ribbon discovery in Kubernetes">Ribbon</link> client-side load balancer with
|
||||
server list obtained from Kubernetes Endpoints.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
@@ -67,12 +71,20 @@ server list obtained from Kubernetes Endpoints.</simpara></entry>
|
||||
<chapter xml:id="_discoveryclient_for_kubernetes">
|
||||
<title>DiscoveryClient for Kubernetes</title>
|
||||
<simpara>This project provides an implementation of <link xl:href="https://github.com/spring-cloud/spring-cloud-commons/blob/master/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClient.java">Discovery Client</link>
|
||||
for <link xl:href="http://kubernetes.io">Kubernetes</link>.
|
||||
This allows you to query Kubernetes endpoints <emphasis role="strong">(see <link xl:href="http://kubernetes.io/docs/user-guide/services/">services</link>)</emphasis> by name.
|
||||
A service is typically exposed by the Kubernetes API server as a collection of endpoints which represent <literal>http</literal>, <literal>https</literal> addresses that a client can
|
||||
for <link xl:href="https://kubernetes.io">Kubernetes</link>.
|
||||
This client lets you query Kubernetes endpoints (see <link xl:href="https://kubernetes.io/docs/user-guide/services/">services</link>) by name.
|
||||
A service is typically exposed by the Kubernetes API server as a collection of endpoints that represent <literal>http</literal> and <literal>https</literal> addresses and that a client can
|
||||
access from a Spring Boot application running as a pod. This discovery feature is also used by the Spring Cloud Kubernetes Ribbon project
|
||||
to fetch the list of the endpoints defined for an application to be load balanced.</simpara>
|
||||
<simpara>To enable loading of the <literal>DiscoveryClient</literal>, add <literal>@EnableDiscoveryClient</literal> to the according configuration or application class like this:</simpara>
|
||||
<simpara>This is something that you get for free by adding the following dependency inside your project:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="xml" linenumbering="unnumbered"><dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes</artifactId>
|
||||
</dependency></programlisting>
|
||||
</informalexample>
|
||||
<simpara>To enable loading of the <literal>DiscoveryClient</literal>, add <literal>@EnableDiscoveryClient</literal> to the according configuration or application class, as the following example shows:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="java" linenumbering="unnumbered">@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class Application {
|
||||
@@ -80,48 +92,54 @@ public class Application {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
}</programlisting>
|
||||
<simpara>Then you can inject the client in your code simply by:</simpara>
|
||||
</informalexample>
|
||||
<simpara>Then you can inject the client in your code simply by autowiring it, as the following example shows:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="java" linenumbering="unnumbered">@Autowired
|
||||
private DiscoveryClient discoveryClient;</programlisting>
|
||||
<simpara>If for any reason you need to disable the <literal>DiscoveryClient</literal> you can simply set the following property in <literal>application.properties</literal>:</simpara>
|
||||
</informalexample>
|
||||
<simpara>If, for any reason, you need to disable the <literal>DiscoveryClient</literal>, you can set the following property in <literal>application.properties</literal>:</simpara>
|
||||
<informalexample>
|
||||
<screen>spring.cloud.kubernetes.discovery.enabled=false</screen>
|
||||
<simpara>Some Spring Cloud components use the <literal>DiscoveryClient</literal> in order to obtain info about the local service instance. For
|
||||
this to work you need to align the Kubernetes service name with the <literal>spring.application.name</literal> property.</simpara>
|
||||
</informalexample>
|
||||
<simpara>Some Spring Cloud components use the <literal>DiscoveryClient</literal> in order to obtain information about the local service instance. For
|
||||
this to work, you need to align the Kubernetes service name with the <literal>spring.application.name</literal> property.</simpara>
|
||||
</chapter>
|
||||
<chapter xml:id="_kubernetes_native_service_discovery">
|
||||
<title>Kubernetes native service discovery</title>
|
||||
<simpara>Kubernetes itself is capable of (server side) service discovery (see: <link xl:href="https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services">https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services</link>).
|
||||
Using native kubernetes service discovery ensures compatibility with additional tooling, like: istio <link xl:href="https://istio.io">https://istio.io</link> (service mesh, capable of load balancing, ribbon, circuit breaker, failover and much more).</simpara>
|
||||
<simpara>The caller service just needs to refer to names resolvable in particular kubernetes cluster then. Simplest implementation might use the spring <literal>RestTemplate</literal> referring to fully qualified domain name (FQDN) <literal><link xl:href="http://{service-name}.{namespace}.svc.{cluster}.local:{service-port}">http://{service-name}.{namespace}.svc.{cluster}.local:{service-port}</link></literal>.</simpara>
|
||||
<simpara>Additionally, hystrix can be used for:</simpara>
|
||||
Using native kubernetes service discovery ensures compatibility with additional tooling, such as Istio (<link xl:href="https://istio.io">https://istio.io</link>), a service mesh that is capable of load balancing, ribbon, circuit breaker, failover, and much more.</simpara>
|
||||
<simpara>The caller service then need only refer to names resolvable in a particular Kubernetes cluster. A simple implementation might use a spring <literal>RestTemplate</literal> that refers to a fully qualified domain name (FQDN), such as <literal><link xl:href="https://{service-name}.{namespace}.svc.{cluster}.local:{service-port}">https://{service-name}.{namespace}.svc.{cluster}.local:{service-port}</link></literal>.</simpara>
|
||||
<simpara>Additionally, you can use Hystrix for:</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>circuit breaker implementation on the caller side, just by annotating the spring boot application class: <literal>@EnableCircuitBreaker</literal></simpara>
|
||||
<simpara>Circuit breaker implementation on the caller side, by annotating the spring boot application class with <literal>@EnableCircuitBreaker</literal></simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>and for the fallback functionality, annotating the respective method via: <literal>@HystrixCommand(fallbackMethod=</literal> does the job.</simpara>
|
||||
<simpara>Fallback functionality, by annotating the respective method with <literal>@HystrixCommand(fallbackMethod=</literal></simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</chapter>
|
||||
<chapter xml:id="_kubernetes_propertysource_implementations">
|
||||
<title>Kubernetes PropertySource implementations</title>
|
||||
<simpara>The most common approach to configure your Spring Boot application is to create an <literal>application.properties|yaml</literal> or
|
||||
an <literal>application-profile.properties|yaml</literal> file containing key-value pairs providing customization values to your
|
||||
application or Spring Boot starters. Users may override these properties by specifying system properties or environment
|
||||
<simpara>The most common approach to configuring your Spring Boot application is to create an <literal>application.properties</literal> or <literal>applicaiton.yaml</literal> or
|
||||
an <literal>application-profile.properties</literal> or <literal>application-profile.yaml</literal> file that contains key-value pairs that provide customization values to your
|
||||
application or Spring Boot starters. You can override these properties by specifying system properties or environment
|
||||
variables.</simpara>
|
||||
<section xml:id="_configmap_propertysource">
|
||||
<title>ConfigMap PropertySource</title>
|
||||
<simpara>Kubernetes provides a resource named <link xl:href="http://kubernetes.io/docs/user-guide/configmap/">ConfigMap</link> to externalize the
|
||||
parameters to pass to your application in the form of key-value pairs or embedded <literal>application.properties|yaml</literal> files.
|
||||
The <link xl:href="./spring-cloud-kubernetes-config">Spring Cloud Kubernetes Config</link> project makes Kubernetes `ConfigMap`s available
|
||||
<section xml:id="configmap-propertysource">
|
||||
<title>Using a <literal>ConfigMap</literal> <literal>PropertySource</literal></title>
|
||||
<simpara>Kubernetes provides a resource named <link xl:href="https://kubernetes.io/docs/user-guide/configmap/"><literal>ConfigMap</literal></link> to externalize the
|
||||
parameters to pass to your application in the form of key-value pairs or embedded <literal>application.properties</literal> or <literal>application.yaml</literal> files.
|
||||
The <link xl:href="./spring-cloud-kubernetes-config">Spring Cloud Kubernetes Config</link> project makes Kubernetes <literal>ConfigMap</literal> instances available
|
||||
during application bootstrapping and triggers hot reloading of beans or Spring context when changes are detected on
|
||||
observed `ConfigMap`s.</simpara>
|
||||
<simpara>The default behavior is to create a <literal>ConfigMapPropertySource</literal> based on a Kubernetes <literal>ConfigMap</literal> which has <literal>metadata.name</literal> of either the name of
|
||||
observed <literal>ConfigMap</literal> instances.</simpara>
|
||||
<simpara>The default behavior is to create a <literal>ConfigMapPropertySource</literal> based on a Kubernetes <literal>ConfigMap</literal> that has a <literal>metadata.name</literal> value of either the name of
|
||||
your Spring application (as defined by its <literal>spring.application.name</literal> property) or a custom name defined within the
|
||||
<literal>bootstrap.properties</literal> file under the following key <literal>spring.cloud.kubernetes.config.name</literal>.</simpara>
|
||||
<simpara>However, more advanced configuration are possible where multiple ConfigMaps can be used
|
||||
This is made possible by the <literal>spring.cloud.kubernetes.config.sources</literal> list.
|
||||
For example one could define the following ConfigMaps</simpara>
|
||||
<literal>bootstrap.properties</literal> file under the following key: <literal>spring.cloud.kubernetes.config.name</literal>.</simpara>
|
||||
<simpara>However, more advanced configuration is possible where you can use multiple <literal>ConfigMap</literal> instances.
|
||||
The <literal>spring.cloud.kubernetes.config.sources</literal> list makes this possible.
|
||||
For example, you could define the following <literal>ConfigMap</literal> instances:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">spring:
|
||||
application:
|
||||
name: cloud-k8s-app
|
||||
@@ -131,34 +149,36 @@ For example one could define the following ConfigMaps</simpara>
|
||||
name: default-name
|
||||
namespace: default-namespace
|
||||
sources:
|
||||
# Spring Cloud Kubernetes will lookup a ConfigMap named c1 in namespace default-namespace
|
||||
# Spring Cloud Kubernetes looks up a ConfigMap named c1 in namespace default-namespace
|
||||
- name: c1
|
||||
# Spring Cloud Kubernetes will lookup a ConfigMap named default-name in whatever namespace n2
|
||||
# Spring Cloud Kubernetes looks up a ConfigMap named default-name in whatever namespace n2
|
||||
- namespace: n2
|
||||
# Spring Cloud Kubernetes will lookup a ConfigMap named c3 in namespace n3
|
||||
# Spring Cloud Kubernetes looks up a ConfigMap named c3 in namespace n3
|
||||
- namespace: n3
|
||||
name: c3</programlisting>
|
||||
<simpara>In the example above, it <literal>spring.cloud.kubernetes.config.namespace</literal> had not been set,
|
||||
then the ConfigMap named <literal>c1</literal> would be looked up in the namespace that the application runs</simpara>
|
||||
<simpara>Any matching <literal>ConfigMap</literal> that is found, will be processed as follows:</simpara>
|
||||
</informalexample>
|
||||
<simpara>In the preceding example, if <literal>spring.cloud.kubernetes.config.namespace</literal> had not been set,
|
||||
the <literal>ConfigMap</literal> named <literal>c1</literal> would be looked up in the namespace that the application runs.</simpara>
|
||||
<simpara>Any matching <literal>ConfigMap</literal> that is found is processed as follows:</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>apply individual configuration properties.</simpara>
|
||||
<simpara>Apply individual configuration properties.</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>apply as <literal>yaml</literal> the content of any property named <literal>application.yaml</literal></simpara>
|
||||
<simpara>Apply as <literal>yaml</literal> the content of any property named <literal>application.yaml</literal>.</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>apply as properties file the content of any property named <literal>application.properties</literal></simpara>
|
||||
<simpara>Apply as a properties file the content of any property named <literal>application.properties</literal>.</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<simpara>The single exception to the aforementioned flow is when the <literal>ConfigMap</literal> contains a <emphasis role="strong">single</emphasis> key that indicates
|
||||
the file is a YAML or Properties file. In that case the name of the key does NOT have to be <literal>application.yaml</literal> or
|
||||
<literal>application.properties</literal> (it can be anything) and the value of the property will be treated correctly.
|
||||
This features facilitates the use case where the <literal>ConfigMap</literal> was created using something like:</simpara>
|
||||
<simpara><literal>kubectl create configmap game-config --from-file=/path/to/app-config.yaml</literal></simpara>
|
||||
<simpara>Example:</simpara>
|
||||
<simpara>Let’s assume that we have a Spring Boot application named <literal>demo</literal> that uses properties to read its thread pool
|
||||
the file is a YAML or properties file. In that case, the name of the key does NOT have to be <literal>application.yaml</literal> or
|
||||
<literal>application.properties</literal> (it can be anything) and the value of the property is treated correctly.
|
||||
This features facilitates the use case where the <literal>ConfigMap</literal> was created by using something like the following:</simpara>
|
||||
<informalexample>
|
||||
<screen>kubectl create configmap game-config --from-file=/path/to/app-config.yaml</screen>
|
||||
</informalexample>
|
||||
<simpara>Assume that we have a Spring Boot application named <literal>demo</literal> that uses the following properties to read its thread pool
|
||||
configuration.</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
@@ -168,7 +188,8 @@ configuration.</simpara>
|
||||
<simpara><literal>pool.size.maximum</literal></simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<simpara>This can be externalized to config map in <literal>yaml</literal> format:</simpara>
|
||||
<simpara>This can be externalized to config map in <literal>yaml</literal> format as follows:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
@@ -176,8 +197,10 @@ metadata:
|
||||
data:
|
||||
pool.size.core: 1
|
||||
pool.size.max: 16</programlisting>
|
||||
<simpara>Individual properties work fine for most cases but sometimes embedded <literal>yaml</literal> is more convenient. In this case we will
|
||||
use a single property named <literal>application.yaml</literal> to embed our <literal>yaml</literal>:</simpara>
|
||||
</informalexample>
|
||||
<simpara>Individual properties work fine for most cases. However, sometimes, embedded <literal>yaml</literal> is more convenient. In this case, we
|
||||
use a single property named <literal>application.yaml</literal> to embed our <literal>yaml</literal>, as follows:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
@@ -188,7 +211,9 @@ data:
|
||||
size:
|
||||
core: 1
|
||||
max:16</programlisting>
|
||||
<simpara>The following also works:</simpara>
|
||||
</informalexample>
|
||||
<simpara>The following example also works:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
@@ -199,10 +224,12 @@ data:
|
||||
size:
|
||||
core: 1
|
||||
max:16</programlisting>
|
||||
<simpara>Spring Boot applications can also be configured differently depending on active profiles which will be merged together
|
||||
when the ConfigMap is read. It is possible to provide different property values for different profiles using an
|
||||
<literal>application.properties|yaml</literal> property, specifying profile-specific values each in their own document
|
||||
(indicated by the <literal>---</literal> sequence) as follows:</simpara>
|
||||
</informalexample>
|
||||
<simpara>You can also configure Spring Boot applications differently depending on active profiles that are merged together
|
||||
when the <literal>ConfigMap</literal> is read. You can provide different property values for different profiles by using an
|
||||
<literal>application.properties</literal> or <literal>application.yaml</literal> property, specifying profile-specific values, each in their own document
|
||||
(indicated by the <literal>---</literal> sequence), as follows:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
@@ -225,20 +252,26 @@ data:
|
||||
profiles: production
|
||||
greeting:
|
||||
message: Say Hello to the Ops</programlisting>
|
||||
<simpara>In the above case, the configuration loaded into your Spring Application with the <literal>development</literal> profile will be:</simpara>
|
||||
</informalexample>
|
||||
<simpara>In the preceding case, the configuration loaded into your Spring Application with the <literal>development</literal> profile is as follows:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered"> greeting:
|
||||
message: Say Hello to the Developers
|
||||
farewell:
|
||||
message: Say Goodbye to the Developers</programlisting>
|
||||
<simpara>whereas if the <literal>production</literal> profile is active, the configuration will be:</simpara>
|
||||
</informalexample>
|
||||
<simpara>However, if the <literal>production</literal> profile is active, the configuration becomes:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered"> greeting:
|
||||
message: Say Hello to the Ops
|
||||
farewell:
|
||||
message: Say Goodbye</programlisting>
|
||||
<simpara>If both profiles are active, the property which appears last within the configmap will overwrite preceding values.</simpara>
|
||||
<simpara>To tell to Spring Boot which <literal>profile</literal> should be enabled at bootstrap, a system property can be passed to the Java
|
||||
command launching your Spring Boot application using an env variable that you will define with the OpenShift
|
||||
<literal>DeploymentConfig</literal> or Kubernetes <literal>ReplicationConfig</literal> resource file as follows:</simpara>
|
||||
</informalexample>
|
||||
<simpara>If both profiles are active, the property that appears last within the <literal>ConfigMap</literal> overwrites any preceding values.</simpara>
|
||||
<simpara>To tell Spring Boot which <literal>profile</literal> should be enabled at bootstrap, you can pass a system property to the Java
|
||||
command. To do so, you can launch your Spring Boot application with an environment variable that you can define with the OpenShift
|
||||
<literal>DeploymentConfig</literal> or Kubernetes <literal>ReplicationConfig</literal> resource file, as follows:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">apiVersion: v1
|
||||
kind: DeploymentConfig
|
||||
spec:
|
||||
@@ -251,16 +284,19 @@ spec:
|
||||
value: /deployments
|
||||
- name: JAVA_OPTIONS
|
||||
value: -Dspring.profiles.active=developer</programlisting>
|
||||
<simpara><emphasis role="strong">Notes:</emphasis>
|
||||
- check the security configuration section, to access config maps from inside a pod you need to have the correct
|
||||
</informalexample>
|
||||
<note>
|
||||
<simpara>You should check the security configuration section. To access config maps from inside a pod you need to have the correct
|
||||
Kubernetes service accounts, roles and role bindings.</simpara>
|
||||
<simpara>Another option for using ConfigMaps, is to mount them into the Pod running the Spring Cloud Kubernetes application
|
||||
and have Spring Cloud Kubernetes read them from the file system.
|
||||
This behavior is controlled by the <literal>spring.cloud.kubernetes.config.paths</literal> property and can be used in
|
||||
</note>
|
||||
<simpara>Another option for using <literal>ConfigMap</literal> instances is to mount them into the Pod by running the Spring Cloud Kubernetes application
|
||||
and having Spring Cloud Kubernetes read them from the file system.
|
||||
This behavior is controlled by the <literal>spring.cloud.kubernetes.config.paths</literal> property. You can use it in
|
||||
addition to or instead of the mechanism described earlier.
|
||||
Multiple (exact) file paths can be specified in <literal>spring.cloud.kubernetes.config.paths</literal> by using the <literal>,</literal> delimiter</simpara>
|
||||
<simpara><emphasis role="strong">Notes:</emphasis>
|
||||
You have to provide full exact path to each property file, because directories are not being recursively parsed.</simpara>
|
||||
You can specify multiple (exact) file paths in <literal>spring.cloud.kubernetes.config.paths</literal> by using the <literal>,</literal> delimiter.</simpara>
|
||||
<note>
|
||||
<simpara>You have to provide the full exact path to each property file, because directories are not being recursively parsed.</simpara>
|
||||
</note>
|
||||
<table frame="all" rowsep="1" colsep="1">
|
||||
<title>Properties:</title>
|
||||
<tgroup cols="4">
|
||||
@@ -278,36 +314,36 @@ You have to provide full exact path to each property file, because directories a
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.config.enabled</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Boolean</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>true</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enable Secrets PropertySource</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.config.enabled</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Boolean</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>true</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enable Secrets <literal>PropertySource</literal></simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.config.name</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>String</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>${spring.application.name}</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the name of ConfigMap to lookup</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.config.name</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>String</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>${spring.application.name}</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the name of <literal>ConfigMap</literal> to look up</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.config.namespace</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>String</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.config.namespace</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>String</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Client namespace</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the Kubernetes namespace where to lookup</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.config.paths</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>List</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>null</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the paths where ConfigMaps are mounted</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.config.paths</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>List</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>null</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the paths where <literal>ConfigMap</literal> instances are mounted</simpara></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.config.enableApi</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Boolean</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>true</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enable/Disable consuming ConfigMaps via APIs</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.config.enableApi</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Boolean</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>true</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enable or disable consuming <literal>ConfigMap</literal> instances through APIs</simpara></entry>
|
||||
</row>
|
||||
</tfoot>
|
||||
</tgroup>
|
||||
@@ -316,30 +352,32 @@ You have to provide full exact path to each property file, because directories a
|
||||
<section xml:id="_secrets_propertysource">
|
||||
<title>Secrets PropertySource</title>
|
||||
<simpara>Kubernetes has the notion of <link xl:href="https://kubernetes.io/docs/concepts/configuration/secret/">Secrets</link> for storing
|
||||
sensitive data such as password, OAuth tokens, etc. This project provides integration with <literal>Secrets</literal> to make secrets
|
||||
accessible by Spring Boot applications. This feature can be explicitly enabled/disabled using the <literal>spring.cloud.kubernetes.secrets.enabled</literal> property.</simpara>
|
||||
<simpara>The <literal>SecretsPropertySource</literal> when enabled will lookup Kubernetes for <literal>Secrets</literal> from the following sources:</simpara>
|
||||
sensitive data such as passwords, OAuth tokens, and so on. This project provides integration with <literal>Secrets</literal> to make secrets
|
||||
accessible by Spring Boot applications. You can explicitly enable or disable This feature by setting the <literal>spring.cloud.kubernetes.secrets.enabled</literal> property.</simpara>
|
||||
<simpara>When enabled, the <literal>SecretsPropertySource</literal> looks up Kubernetes for <literal>Secrets</literal> from the following sources:</simpara>
|
||||
<orderedlist numeration="arabic">
|
||||
<listitem>
|
||||
<simpara>reading recursively from secrets mounts</simpara>
|
||||
<simpara>Reading recursively from secrets mounts</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>named after the application (as defined by <literal>spring.application.name</literal>)</simpara>
|
||||
<simpara>Named after the application (as defined by <literal>spring.application.name</literal>)</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>matching some labels</simpara>
|
||||
<simpara>Matching some labels</simpara>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<simpara>Please note that by default, consuming Secrets via API (points 2 and 3 above) <emphasis role="strong">is not enabled</emphasis> for security reasons
|
||||
and it is recommended that containers share secrets via mounted volumes.
|
||||
If you enable consuming Secrets via API, then it is recommended access to Secrets is limited by an
|
||||
[authorization policy such as RBAC](<link xl:href="https://kubernetes.io/docs/concepts/configuration/secret/#best-practices">https://kubernetes.io/docs/concepts/configuration/secret/#best-practices</link>).</simpara>
|
||||
<simpara>If the secrets are found their data is made available to the application.</simpara>
|
||||
<simpara><emphasis role="strong">Example:</emphasis></simpara>
|
||||
<simpara>Let’s assume that we have a spring boot application named <literal>demo</literal> that uses properties to read its database
|
||||
configuration. We can create a Kubernetes secret using the following command:</simpara>
|
||||
<simpara>Note that, by default, consuming Secrets through the API (points 2 and 3 above) <emphasis role="strong">is not enabled</emphasis> for security reasons.
|
||||
Further, we recommend that containers share secrets through mounted volumes.
|
||||
If you enable consuming Secrets through the API, we recommend that you limit access to Secrets by using an
|
||||
[authorization policy, such as RBAC](<link xl:href="https://kubernetes.io/docs/concepts/configuration/secret/#best-practices">https://kubernetes.io/docs/concepts/configuration/secret/#best-practices</link>).</simpara>
|
||||
<simpara>If the secrets are found, their data is made available to the application.</simpara>
|
||||
<simpara>Assume that we have a spring boot application named <literal>demo</literal> that uses properties to read its database
|
||||
configuration. We can create a Kubernetes secret by using the following command:</simpara>
|
||||
<informalexample>
|
||||
<screen>oc create secret generic db-secret --from-literal=username=user --from-literal=password=p455w0rd</screen>
|
||||
<simpara>This would create the following secret (shown using <literal>oc get secrets db-secret -o yaml</literal>):</simpara>
|
||||
</informalexample>
|
||||
<simpara>The preceding command would create the following secret (which you can see by using <literal>oc get secrets db-secret -o yaml</literal>):</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">apiVersion: v1
|
||||
data:
|
||||
password: cDQ1NXcwcmQ=
|
||||
@@ -353,8 +391,10 @@ metadata:
|
||||
selfLink: /api/v1/namespaces/default/secrets/db-secret
|
||||
uid: 63c89263-6099-11e7-b3da-76d6186905a8
|
||||
type: Opaque</programlisting>
|
||||
<simpara>Note that the data contains Base64-encoded versions of the literal provided by the create command.</simpara>
|
||||
<simpara>This secret can then be used by your application for example by exporting the secret’s value as environment variables:</simpara>
|
||||
</informalexample>
|
||||
<simpara>Note that the data contains Base64-encoded versions of the literal provided by the <literal>create</literal> command.</simpara>
|
||||
<simpara>Your application can then use this secret — for example, by exporting the secret’s value as environment variables:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -374,22 +414,31 @@ spec:
|
||||
secretKeyRef:
|
||||
name: db-secret
|
||||
key: password</programlisting>
|
||||
</informalexample>
|
||||
<simpara>You can select the Secrets to consume in a number of ways:</simpara>
|
||||
<orderedlist numeration="arabic">
|
||||
<listitem>
|
||||
<simpara>By listing the directories where secrets are mapped:</simpara>
|
||||
<screen>-Dspring.cloud.kubernetes.secrets.paths=/etc/secrets/db-secret,etc/secrets/postgresql</screen>
|
||||
<informalexample>
|
||||
<programlisting language="bash" linenumbering="unnumbered">-Dspring.cloud.kubernetes.secrets.paths=/etc/secrets/db-secret,etc/secrets/postgresql</programlisting>
|
||||
</informalexample>
|
||||
<simpara>If you have all the secrets mapped to a common root, you can set them like:</simpara>
|
||||
<screen>-Dspring.cloud.kubernetes.secrets.paths=/etc/secrets</screen>
|
||||
<informalexample>
|
||||
<programlisting language="bash" linenumbering="unnumbered">-Dspring.cloud.kubernetes.secrets.paths=/etc/secrets</programlisting>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>By setting a named secret:</simpara>
|
||||
<screen>-Dspring.cloud.kubernetes.secrets.name=db-secret</screen>
|
||||
<informalexample>
|
||||
<programlisting language="bash" linenumbering="unnumbered">-Dspring.cloud.kubernetes.secrets.name=db-secret</programlisting>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>By defining a list of labels:</simpara>
|
||||
<screen>-Dspring.cloud.kubernetes.secrets.labels.broker=activemq
|
||||
-Dspring.cloud.kubernetes.secrets.labels.db=postgresql</screen>
|
||||
<informalexample>
|
||||
<programlisting language="bash" linenumbering="unnumbered">-Dspring.cloud.kubernetes.secrets.labels.broker=activemq
|
||||
-Dspring.cloud.kubernetes.secrets.labels.db=postgresql</programlisting>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<table frame="all" rowsep="1" colsep="1">
|
||||
@@ -409,72 +458,71 @@ spec:
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.secrets.enabled</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Boolean</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>true</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enable Secrets PropertySource</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.secrets.enabled</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Boolean</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>true</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enable Secrets <literal>PropertySource</literal></simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.secrets.name</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>String</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>${spring.application.name}</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the name of the secret to lookup</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.secrets.name</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>String</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>${spring.application.name}</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the name of the secret to look up</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.secrets.namespace</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>String</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.secrets.namespace</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>String</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Client namespace</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the Kubernetes namespace where to lookup</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the Kubernetes namespace where to look up</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.secrets.labels</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Map</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>null</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.secrets.labels</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Map</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>null</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the labels used to lookup secrets</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.secrets.paths</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>List</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>null</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.secrets.paths</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>List</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>null</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Sets the paths where secrets are mounted (example 1)</simpara></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.secrets.enableApi</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Boolean</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>false</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enable/Disable consuming secrets via APIs (examples 2 and 3)</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.secrets.enableApi</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Boolean</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>false</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enables or disables consuming secrets through APIs (examples 2 and 3)</simpara></entry>
|
||||
</row>
|
||||
</tfoot>
|
||||
</tgroup>
|
||||
</table>
|
||||
<simpara><emphasis role="strong">Notes:</emphasis>
|
||||
- The property <literal>spring.cloud.kubernetes.secrets.labels</literal> behaves as defined by
|
||||
<simpara>Notes:
|
||||
* The <literal>spring.cloud.kubernetes.secrets.labels</literal> property behaves as defined by
|
||||
<link xl:href="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-Configuration-Binding#map-based-binding">Map-based binding</link>.
|
||||
- The property <literal>spring.cloud.kubernetes.secrets.paths</literal> behaves as defined by
|
||||
* The <literal>spring.cloud.kubernetes.secrets.paths</literal> property behaves as defined by
|
||||
<link xl:href="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-Configuration-Binding#collection-based-binding">Collection-based binding</link>.
|
||||
- Access to secrets via API may be restricted for security reasons, the preferred way is to mount secret to the POD.</simpara>
|
||||
<simpara>Example of application using secrets (though it hasn’t been updated to use the new <literal>spring-cloud-kubernetes</literal> project):
|
||||
* Access to secrets through the API may be restricted for security reasons. The preferred way is to mount secrets to the Pod.</simpara>
|
||||
<simpara>You can find an example of an application that uses secrets (though it has not been updated to use the new <literal>spring-cloud-kubernetes</literal> project) at
|
||||
<link xl:href="https://github.com/fabric8-quickstarts/spring-boot-camel-config">spring-boot-camel-config</link></simpara>
|
||||
</section>
|
||||
<section xml:id="_propertysource_reload">
|
||||
<title>PropertySource Reload</title>
|
||||
<title><literal>PropertySource</literal> Reload</title>
|
||||
<simpara>Some applications may need to detect changes on external property sources and update their internal status to reflect the new configuration.
|
||||
The reload feature of Spring Cloud Kubernetes is able to trigger an application reload when a related <literal>ConfigMap</literal> or
|
||||
<literal>Secret</literal> changes.</simpara>
|
||||
<simpara>This feature is disabled by default and can be enabled using the configuration property <literal>spring.cloud.kubernetes.reload.enabled=true</literal>
|
||||
(eg. in the <emphasis role="strong">application.properties</emphasis> file).</simpara>
|
||||
<simpara>The following levels of reload are supported (property <literal>spring.cloud.kubernetes.reload.strategy</literal>):
|
||||
- <emphasis role="strong"><literal>refresh</literal> (default)</emphasis>: only configuration beans annotated with <literal>@ConfigurationProperties</literal> or <literal>@RefreshScope</literal> are reloaded.
|
||||
<simpara>By default, this feature is disabled. You can enable it by using the <literal>spring.cloud.kubernetes.reload.enabled=true</literal> configuration property (for example, in the <literal>application.properties</literal> file).</simpara>
|
||||
<simpara>The following levels of reload are supported (by setting the <literal>spring.cloud.kubernetes.reload.strategy</literal> property):
|
||||
* <literal>refresh</literal> (default): Only configuration beans annotated with <literal>@ConfigurationProperties</literal> or <literal>@RefreshScope</literal> are reloaded.
|
||||
This reload level leverages the refresh feature of Spring Cloud Context.
|
||||
- <emphasis role="strong"><literal>restart_context</literal></emphasis>: the whole Spring <emphasis>ApplicationContext</emphasis> is gracefully restarted. Beans are recreated with the new configuration.
|
||||
- <emphasis role="strong"><literal>shutdown</literal></emphasis>: the Spring <emphasis>ApplicationContext</emphasis> is shut down to activate a restart of the container.
|
||||
When using this level, make sure that the lifecycle of all non-daemon threads is bound to the ApplicationContext
|
||||
and that a replication controller or replica set is configured to restart the pod.</simpara>
|
||||
<simpara>Example:</simpara>
|
||||
<simpara>Assuming that the reload feature is enabled with default settings (<emphasis role="strong"><literal>refresh</literal></emphasis> mode), the following bean will be refreshed when the config map changes:</simpara>
|
||||
<programlisting language="java" linenumbering="unnumbered">@Configuration
|
||||
* <literal>restart_context</literal>: the whole Spring <literal>ApplicationContext</literal> is gracefully restarted. Beans are recreated with the new configuration.
|
||||
* <literal>shutdown</literal>: the Spring <literal>ApplicationContext</literal> is shut down to activate a restart of the container.
|
||||
When you use this level, make sure that the lifecycle of all non-daemon threads is bound to the <literal>ApplicationContext</literal>
|
||||
and that a replication controller or replica set is configured to restart the pod.</simpara>
|
||||
<simpara>Assuming that the reload feature is enabled with default settings (<literal>refresh</literal> mode), the following bean is refreshed when the config map changes:</simpara>
|
||||
<informalexample>
|
||||
<screen>@Configuration
|
||||
@ConfigurationProperties(prefix = "bean")
|
||||
public class MyConfig {
|
||||
|
||||
@@ -482,8 +530,10 @@ public class MyConfig {
|
||||
|
||||
// getter and setters
|
||||
|
||||
}</programlisting>
|
||||
<simpara>A way to see that changes effectively happen is creating another bean that prints the message periodically.</simpara>
|
||||
}</screen>
|
||||
</informalexample>
|
||||
<simpara>To see that changes effectively happen, you can create another bean that prints the message periodically, as follows</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="java" linenumbering="unnumbered">@Component
|
||||
public class MyBean {
|
||||
|
||||
@@ -495,7 +545,9 @@ public class MyBean {
|
||||
System.out.println("The message is: " + config.getMessage());
|
||||
}
|
||||
}</programlisting>
|
||||
<simpara>The message printed by the application can be changed using a <literal>ConfigMap</literal> as follows:</simpara>
|
||||
</informalexample>
|
||||
<simpara>You can change the message printed by the application by using a <literal>ConfigMap</literal>, as follows:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
@@ -503,20 +555,21 @@ metadata:
|
||||
data:
|
||||
application.properties: |-
|
||||
bean.message=Hello World!</programlisting>
|
||||
<simpara>Any change to the property named <literal>bean.message</literal> in the <literal>ConfigMap</literal> associated to the pod will be reflected in the
|
||||
</informalexample>
|
||||
<simpara>Any change to the property named <literal>bean.message</literal> in the <literal>ConfigMap</literal> associated with the pod is reflected in the
|
||||
output. More generally speaking, changes associated to properties prefixed with the value defined by the <literal>prefix</literal>
|
||||
field of the <literal>@ConfigurationProperties</literal> annotation will be detected and reflected in the application.
|
||||
[Associating a <literal>ConfigMap</literal> to a pod](#configmap-propertysource) is explained above.</simpara>
|
||||
<simpara>The full example is available in [spring-cloud-kubernetes-reload-example](spring-cloud-kubernetes-examples/kubernetes-reload-example).</simpara>
|
||||
field of the <literal>@ConfigurationProperties</literal> annotation are detected and reflected in the application.
|
||||
<link linkend="configmap-propertysource">Associating a <literal>ConfigMap</literal> with a pod</link> is explained earlier in this chapter.</simpara>
|
||||
<simpara>The full example is available in <link xl:href="https://github.com/fabric8io/spring-cloud-kubernetes/tree/master/spring-cloud-kubernetes-examples/kubernetes-reload-example"><literal>spring-cloud-kubernetes-reload-example</literal></link>.</simpara>
|
||||
<simpara>The reload feature supports two operating modes:
|
||||
- <emphasis role="strong">event (default)</emphasis>: watches for changes in config maps or secrets using the Kubernetes API (web socket).
|
||||
Any event will produce a re-check on the configuration and a reload in case of changes.
|
||||
The <literal>view</literal> role on the service account is required in order to listen for config map changes. A higher level role (eg. <literal>edit</literal>) is required for secrets
|
||||
(secrets are not monitored by default).
|
||||
- <emphasis role="strong">polling</emphasis>: re-creates the configuration periodically from config maps and secrets to see if it has changed.
|
||||
The polling period can be configured using the property <literal>spring.cloud.kubernetes.reload.period</literal> and defaults to <emphasis role="strong">15 seconds</emphasis>.
|
||||
* Event (default): Watches for changes in config maps or secrets by using the Kubernetes API (web socket).
|
||||
Any event produces a re-check on the configuration and, in case of changes, a reload.
|
||||
The <literal>view</literal> role on the service account is required in order to listen for config map changes. A higher level role (such as <literal>edit</literal>) is required for secrets
|
||||
(by default, secrets are not monitored).
|
||||
* Polling: Oeriodically re-creates the configuration from config maps and secrets to see if it has changed.
|
||||
You can configure the polling period by using the <literal>spring.cloud.kubernetes.reload.period</literal> property and defaults to 15 seconds.
|
||||
It requires the same role as the monitored property source.
|
||||
This means, for example, that using polling on file mounted secret sources does not require particular privileges.</simpara>
|
||||
This means, for example, that using polling on file-mounted secret sources does not require particular privileges.</simpara>
|
||||
<table frame="all" rowsep="1" colsep="1">
|
||||
<title>Properties:</title>
|
||||
<tgroup cols="4">
|
||||
@@ -534,80 +587,90 @@ This means, for example, that using polling on file mounted secret sources does
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.reload.enabled</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Boolean</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>false</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.reload.enabled</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Boolean</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>false</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enables monitoring of property sources and configuration reload</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.reload.monitoring-config-maps</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Boolean</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>true</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.reload.monitoring-config-maps</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Boolean</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>true</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Allow monitoring changes in config maps</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.reload.monitoring-secrets</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Boolean</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>false</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.reload.monitoring-secrets</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Boolean</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>false</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Allow monitoring changes in secrets</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.reload.strategy</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enum</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>refresh</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>The strategy to use when firing a reload (<emphasis role="strong">refresh</emphasis>, <emphasis role="strong">restart_context</emphasis>, <emphasis role="strong">shutdown</emphasis>)</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>`spring.cloud.kubernetes.reload.strategy `</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Enum</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>refresh</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>The strategy to use when firing a reload (<literal>refresh</literal>, <literal>restart_context</literal>, or <literal>shutdown</literal>)</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.reload.mode</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Enum</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>event</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Specifies how to listen for changes in property sources (<emphasis role="strong">event</emphasis>, <emphasis role="strong">polling</emphasis>)</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.reload.mode</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Enum</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>event</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Specifies how to listen for changes in property sources (<literal>event</literal> or <literal>polling</literal>)</simpara></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara>spring.cloud.kubernetes.reload.period</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Duration</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>15s</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>The period for verifying changes when using the <emphasis role="strong">polling</emphasis> strategy</simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>spring.cloud.kubernetes.reload.period</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>Duration</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>15s</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>The period for verifying changes when using the <literal>polling</literal> strategy</simpara></entry>
|
||||
</row>
|
||||
</tfoot>
|
||||
</tgroup>
|
||||
</table>
|
||||
<simpara><emphasis role="strong">Notes</emphasis>:
|
||||
- Properties under <emphasis role="strong">spring.cloud.kubernetes.reload.</emphasis> should not be used in config maps or secrets: changing such properties at runtime may lead to unexpected results;
|
||||
- Deleting a property or the whole config map does not restore the original state of the beans when using the <emphasis role="strong">refresh</emphasis> level.</simpara>
|
||||
<simpara>Notes:
|
||||
* You should not use properties under <literal>spring.cloud.kubernetes.reload</literal> in config maps or secrets. Changing such properties at runtime may lead to unexpected results.
|
||||
* Deleting a property or the whole config map does not restore the original state of the beans when you use the <literal>refresh</literal> level.</simpara>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter xml:id="_ribbon_discovery_in_kubernetes">
|
||||
<title>Ribbon discovery in Kubernetes</title>
|
||||
<simpara>Spring Cloud client applications calling a microservice should be interested on relying on a client load-balancing
|
||||
<title>Ribbon Discovery in Kubernetes</title>
|
||||
<simpara>Spring Cloud client applications that call a microservice should be interested on relying on a client load-balancing
|
||||
feature in order to automatically discover at which endpoint(s) it can reach a given service. This mechanism has been
|
||||
implemented within the [spring-cloud-kubernetes-ribbon](spring-cloud-kubernetes-ribbon/pom.xml) project where a
|
||||
Kubernetes client will populate a <link xl:href="https://github.com/Netflix/ribbon">Ribbon</link> <literal>ServerList</literal> containing information
|
||||
implemented within the <link xl:href="https://github.com/spring-cloud/spring-cloud-kubernetes/tree/master/spring-cloud-kubernetes-ribbon">spring-cloud-kubernetes-ribbon</link> project, where a
|
||||
Kubernetes client populates a <link xl:href="https://github.com/Netflix/ribbon">Ribbon</link> <literal>ServerList</literal> that contains information
|
||||
about such endpoints.</simpara>
|
||||
<simpara>When the list of the endpoints is populated, the Kubernetes client will search the registered endpoints living in
|
||||
the current namespace/project matching the service name defined using the Ribbon Client annotation:</simpara>
|
||||
<simpara>The implementation is part of the following starter that you can use by adding its dependency to your pom file:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="xml" linenumbering="unnumbered"><dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-ribbon</artifactId>
|
||||
<version>${latest.version}</version>
|
||||
</dependency></programlisting>
|
||||
</informalexample>
|
||||
<simpara>When the list of the endpoints is populated, the Kubernetes client searches the registered endpoints that live in
|
||||
the current namespace or project by matching the service name defined in the Ribbon Client annotation, as follows:</simpara>
|
||||
<informalexample>
|
||||
<programlisting language="java" linenumbering="unnumbered">@RibbonClient(name = "name-service")</programlisting>
|
||||
<simpara>You can configure Ribbon’s behavior by providing properties in your <literal>application.properties</literal> (via your application’s
|
||||
dedicated <literal>ConfigMap</literal>) using the following format: <literal><name of your service>.ribbon.<Ribbon configuration key></literal> where:</simpara>
|
||||
</informalexample>
|
||||
<simpara>You can configure Ribbon’s behavior by providing properties in your <literal>application.properties</literal> (through your application’s
|
||||
dedicated <literal>ConfigMap</literal>) by using the following format: <literal><name of your service>.ribbon.<Ribbon configuration key></literal>, where:</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara><literal><name of your service></literal> corresponds to the service name you’re accessing over Ribbon, as configured using the
|
||||
<literal>@RibbonClient</literal> annotation (e.g. <literal>name-service</literal> in the example above)</simpara>
|
||||
<simpara><literal><name of your service></literal> corresponds to the service name you access over Ribbon, as configured by using the
|
||||
<literal>@RibbonClient</literal> annotation (such as <literal>name-service</literal> in the preceding example).</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara><literal><Ribbon configuration key></literal> is one of the Ribbon configuration key defined by
|
||||
<link xl:href="https://github.com/Netflix/ribbon/blob/master/ribbon-core/src/main/java/com/netflix/client/config/CommonClientConfigKey.java">Ribbon’s CommonClientConfigKey class</link></simpara>
|
||||
<simpara><literal><Ribbon configuration key></literal> is one of the Ribbon configuration keys defined by
|
||||
<link xl:href="https://github.com/Netflix/ribbon/blob/master/ribbon-core/src/main/java/com/netflix/client/config/CommonClientConfigKey.java">Ribbon’s <literal>CommonClientConfigKey</literal> class</link>.</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<simpara>Additionally, the <literal>spring-cloud-kubernetes-ribbon</literal> project defines two additional configuration keys to further
|
||||
control how Ribbon interacts with Kubernetes. In particular, if an endpoint defines multiple ports, the default
|
||||
behavior is to use the first one found. To select more specifically which port to use, in a multi-port service, use
|
||||
the <literal>PortName</literal> key. If you want to specify in which Kubernetes' namespace the target service should be looked up, use
|
||||
behavior is to use the first one found. To select more specifically which port to use in a multi-port service, you can use
|
||||
the <literal>PortName</literal> key. If you want to specify in which Kubernetes namespace the target service should be looked up, you can use
|
||||
the <literal>KubernetesNamespace</literal> key, remembering in both instances to prefix these keys with your service name and
|
||||
<literal>ribbon</literal> prefix as specified above.</simpara>
|
||||
<simpara>Examples that are using this module for ribbon discovery are:</simpara>
|
||||
<literal>ribbon</literal> prefix, as specified earlier.</simpara>
|
||||
<simpara>The following examples use this module for ribbon discovery:</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara><link xl:href="./spring-cloud-kubernetes-examples/kubernetes-circuitbreaker-ribbon-example">Spring Cloud Circuitbreaker and Ribbon</link></simpara>
|
||||
@@ -619,44 +682,45 @@ the <literal>KubernetesNamespace</literal> key, remembering in both instances to
|
||||
<simpara><link xl:href="https://github.com/fabric8io/kubeflix/tree/master/examples/loanbroker/bank">Kubeflix - LoanBroker - Bank</link></simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<simpara><emphasis role="strong">Note</emphasis>: The Ribbon discovery client can be disabled by setting this key within the application properties file
|
||||
<literal>spring.cloud.kubernetes.ribbon.enabled=false</literal>.</simpara>
|
||||
<note>
|
||||
<simpara>You can disable the Ribbon discovery client by setting the <literal>spring.cloud.kubernetes.ribbon.enabled=false</literal> key within the application properties file.</simpara>
|
||||
</note>
|
||||
</chapter>
|
||||
<chapter xml:id="_kubernetes_ecosystem_awareness">
|
||||
<title>Kubernetes Ecosystem Awareness</title>
|
||||
<simpara>All of the features described above will work equally well regardless of whether your application is running inside
|
||||
Kubernetes or not. This is really helpful for development and troubleshooting.
|
||||
From a development point of view, this is really helpful as you can start your Spring Boot application and debug one
|
||||
of the modules part of this project. It is not required to deploy it in Kubernetes
|
||||
<simpara>All of the features described earlier in this guide work equally well, regardless of whether your application is running inside
|
||||
Kubernetes. This is really helpful for development and troubleshooting.
|
||||
From a development point of view, this lets you start your Spring Boot application and debug one
|
||||
of the modules that is part of this project. You need not deploy it in Kubernetes,
|
||||
as the code of the project relies on the
|
||||
<link xl:href="https://github.com/fabric8io/kubernetes-client">Fabric8 Kubernetes Java client</link> which is a fluent DSL able to
|
||||
communicate using <literal>http</literal> protocol to the REST API of Kubernetes Server.</simpara>
|
||||
<link xl:href="https://github.com/fabric8io/kubernetes-client">Fabric8 Kubernetes Java client</link>, which is a fluent DSL that can
|
||||
communicate by using <literal>http</literal> protocol to the REST API of the Kubernetes Server.</simpara>
|
||||
<section xml:id="_kubernetes_profile_autoconfiguration">
|
||||
<title>Kubernetes Profile Autoconfiguration</title>
|
||||
<simpara>When the application runs as a pod inside Kubernetes a Spring profile named <literal>kubernetes</literal> will automatically get activated.
|
||||
This allows the developer to customize the configuration, to define beans that will be applied when the Spring Boot application is deployed
|
||||
within the Kubernetes platform <emphasis role="strong">(e.g. different dev and prod configuration)</emphasis>.</simpara>
|
||||
<simpara>When the application runs as a pod inside Kubernetes, a Spring profile named <literal>kubernetes</literal> automatically gets activated.
|
||||
This lets you customize the configuration, to define beans that are applied when the Spring Boot application is deployed
|
||||
within the Kubernetes platform (for example, different development and production configuration).</simpara>
|
||||
</section>
|
||||
<section xml:id="_istio_awareness">
|
||||
<title>Istio Awareness</title>
|
||||
<simpara>When including the <emphasis role="strong">spring-cloud-kubernetes-istio</emphasis> module into the application classpath a new profile will be added to the application,
|
||||
if the application is running inside a Kubernetes Cluster with <link xl:href="http://istio.io">Istio</link> installed. Then you can use
|
||||
spring <emphasis role="strong">@Profile("istio")</emphasis> annotations into your Beans and <emphasis role="strong">@Configuration</emphasis>'s.</simpara>
|
||||
<simpara>The Istio awareness module uses the <emphasis role="strong">me.snowdrop:istio-client</emphasis> to interact with Istio APIs enabling us to discover traffic rules, circuit breakers, etc.
|
||||
Making it easy for our Spring Boot applications to consume this data to dynamically configure themselves according the environment.</simpara>
|
||||
<simpara>When you include the <literal>spring-cloud-kubernetes-istio</literal> module in the application classpath, a new profile is added to the application,
|
||||
provided the application is running inside a Kubernetes Cluster with <link xl:href="https://istio.io">Istio</link> installed. You can then use
|
||||
spring <literal>@Profile("istio")</literal> annotations in your Beans and <literal>@Configuration</literal> classes.</simpara>
|
||||
<simpara>The Istio awareness module uses <literal>me.snowdrop:istio-client</literal> to interact with Istio APIs, letting us discover traffic rules, circuit breakers, and so on,
|
||||
making it easy for our Spring Boot applications to consume this data to dynamically configure themselves according to the environment.</simpara>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter xml:id="_pod_health_indicator">
|
||||
<title>Pod Health Indicator</title>
|
||||
<simpara>Spring Boot uses <link xl:href="https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java">HealthIndicator</link> to expose info about the health of an application.
|
||||
That makes it really useful for exposing health related information to the user and are also a good fit for use as <link xl:href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/">readiness probes</link>.</simpara>
|
||||
<simpara>The Kubernetes health indicator which is part of the core module exposes the following info:</simpara>
|
||||
<simpara>Spring Boot uses <link xl:href="https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java"><literal>HealthIndicator</literal></link> to expose info about the health of an application.
|
||||
That makes it really useful for exposing health-related information to the user and makes it a good fit for use as <link xl:href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/">readiness probes</link>.</simpara>
|
||||
<simpara>The Kubernetes health indicator (which is part of the core module) exposes the following info:</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>pod name, ip address, namespace, service account, node name and its ip address</simpara>
|
||||
<simpara>Pod name, IP address, namespace, service account, node name, and its IP address</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>flag that indicates if the Spring Boot application is internal or external to Kubernetes</simpara>
|
||||
<simpara>A flag that indicates whether the Spring Boot application is internal or external to Kubernetes</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</chapter>
|
||||
@@ -665,44 +729,47 @@ That makes it really useful for exposing health related information to the user
|
||||
<simpara><TBD></simpara>
|
||||
</chapter>
|
||||
<chapter xml:id="_security_configurations_inside_kubernetes">
|
||||
<title>Security Configurations inside Kubernetes</title>
|
||||
<title>Security Configurations Inside Kubernetes</title>
|
||||
<section xml:id="_namespace">
|
||||
<title>Namespace</title>
|
||||
<simpara>Most of the components provided in this project need to know the namespace. For Kubernetes (1.3+) the namespace is made available to pod as part of the service account secret and automatically detected by the client.
|
||||
For earlier version it needs to be specified as an env var to the pod. A quick way to do this is:</simpara>
|
||||
<literallayout class="monospaced">env:
|
||||
- name: "KUBERNETES_NAMESPACE"
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: "metadata.namespace"</literallayout>
|
||||
<simpara>Most of the components provided in this project need to know the namespace. For Kubernetes (1.3+), the namespace is made available to the pod as part of the service account secret and is automatically detected by the client.
|
||||
For earlier versions, it needs to be specified as an environment variable to the pod. A quick way to do this is as follows:</simpara>
|
||||
<informalexample>
|
||||
<screen> env:
|
||||
- name: "KUBERNETES_NAMESPACE"
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: "metadata.namespace"</screen>
|
||||
</informalexample>
|
||||
</section>
|
||||
<section xml:id="_service_account">
|
||||
<title>Service Account</title>
|
||||
<simpara>For distros of Kubernetes that support more fine-grained role-based access within the cluster, you need to make sure a pod that runs with spring-cloud-kubernetes has access to the Kubernetes API.
|
||||
For any service accounts you assign to a deployment/pod, you need to make sure it has the correct roles. For example, you can add <literal>cluster-reader</literal> permissions to your <literal>default</literal> service account depending on the project you’re in:</simpara>
|
||||
<simpara>For distributions of Kubernetes that support more fine-grained role-based access within the cluster, you need to make sure a pod that runs with <literal>spring-cloud-kubernetes</literal> has access to the Kubernetes API.
|
||||
For any service accounts you assign to a deployment or pod, you need to make sure they have the correct roles. For example, you can add <literal>cluster-reader</literal> permissions to your <literal>default</literal> service account, depending on the project you’re in.</simpara>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter xml:id="_examples">
|
||||
<title>Examples</title>
|
||||
<simpara>Spring Cloud Kubernetes tries to make it transparent for your applications to consume Kubernetes Native Services
|
||||
<simpara>Spring Cloud Kubernetes tries to make it transparent for your applications to consume Kubernetes Native Services by
|
||||
following the Spring Cloud interfaces.</simpara>
|
||||
<simpara>In your applications, you need to add the <emphasis role="strong">spring-cloud-kubernetes-discovery</emphasis> dependency to your classpath and remove any other dependency that contains a <emphasis role="strong">DiscoveryClient</emphasis> implementation (ie. Eureka Discovery Client).
|
||||
The same applies for PropertySourceLocator, where you need to add to the classpath the <emphasis role="strong">spring-cloud-kubernetes-config</emphasis> and remove any other dependency that contains a <emphasis role="strong">PropertySourceLocator</emphasis> implementation (ie. Config Server Client).</simpara>
|
||||
<simpara>The following projects highlight the usage of these dependencies and demonstrate how these libraries can be used from any Spring Boot application.</simpara>
|
||||
<simpara>List of examples using these projects:</simpara>
|
||||
<simpara>In your applications, you need to add the <literal>spring-cloud-kubernetes-discovery</literal> dependency to your classpath and remove any other dependency that contains a <literal>DiscoveryClient</literal> implementation (that is, a Eureka discovery client).
|
||||
The same applies for <literal>PropertySourceLocator</literal>, where you need to add to the classpath the <literal>spring-cloud-kubernetes-config</literal> and remove any other dependency that contains a <literal>PropertySourceLocator</literal> implementation (that is, a configuration server client).</simpara>
|
||||
<simpara>The following projects highlight the usage of these dependencies and demonstrate how you can use these libraries from any Spring Boot application:</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara><link xl:href="https://github.com/spring-cloud/spring-cloud-kubernetes/tree/master/spring-cloud-kubernetes-examples">Spring Cloud Kubernetes Examples</link>: the ones located inside this repository.</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>Spring Cloud Kubernetes Full Example: Minions and Boss</simpara>
|
||||
</listitem>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara><link xl:href="https://github.com/salaboy/spring-cloud-k8s-minion">Minion</link></simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara><link xl:href="https://github.com/salaboy/spring-cloud-k8s-boss">Boss</link></simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>Spring Cloud Kubernetes Full Example: <link xl:href="https://github.com/salaboy/s1p_docs">SpringOne Platform Tickets Service</link></simpara>
|
||||
</listitem>
|
||||
@@ -716,7 +783,7 @@ The same applies for PropertySourceLocator, where you need to add to the classpa
|
||||
</chapter>
|
||||
<chapter xml:id="_other_resources">
|
||||
<title>Other Resources</title>
|
||||
<simpara>Here you can find other resources such as presentations(slides) and videos about Spring Cloud Kubernetes.</simpara>
|
||||
<simpara>This section lists other resources, such as presentations (slides) and videos about Spring Cloud Kubernetes.</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara><link xl:href="https://salaboy.com/2018/09/27/the-s1p-experience/">S1P Spring Cloud on PKS</link></simpara>
|
||||
@@ -725,7 +792,7 @@ The same applies for PropertySourceLocator, where you need to add to the classpa
|
||||
<simpara><link xl:href="https://salaboy.com/2018/07/18/ljc-july-18-spring-cloud-docker-k8s/">Spring Cloud, Docker, Kubernetes → London Java Community July 2018</link></simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<simpara>Please feel free to submit other resources via PR to <link xl:href="http://github.com/spring-cloud/spring-cloud-kubernetes">this repository</link>.</simpara>
|
||||
<simpara>Please feel free to submit other resources through pull requests to <link xl:href="https://github.com/spring-cloud/spring-cloud-kubernetes">this repository</link>.</simpara>
|
||||
</chapter>
|
||||
<chapter xml:id="_building">
|
||||
<title>Building</title>
|
||||
|
||||
Reference in New Issue
Block a user