diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml
index bf70e0284c..baf86a4386 100644
--- a/spring-cloud/pom.xml
+++ b/spring-cloud/pom.xml
@@ -32,7 +32,6 @@
spring-cloud-zuul-eureka-integration
spring-cloud-contract
spring-cloud-kubernetes
- spring-cloud-kubernetes-2
spring-cloud-archaius
spring-cloud-functions
spring-cloud-vault
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/.gitignore b/spring-cloud/spring-cloud-kubernetes/client-service/.gitignore
new file mode 100644
index 0000000000..2af7cefb0a
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/.gitignore
@@ -0,0 +1,24 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+.nb-gradle/
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/Dockerfile b/spring-cloud/spring-cloud-kubernetes/client-service/Dockerfile
new file mode 100644
index 0000000000..bd8cf2918f
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/Dockerfile
@@ -0,0 +1,5 @@
+FROM openjdk:8-jdk-alpine
+VOLUME /tmp
+COPY target/client-service-1.0-SNAPSHOT.jar app.jar
+ENV JAVA_OPTS=""
+ENTRYPOINT exec java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999 -jar /app.jar
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/client-config.yaml b/spring-cloud/spring-cloud-kubernetes/client-service/client-config.yaml
new file mode 100644
index 0000000000..329c01582e
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/client-config.yaml
@@ -0,0 +1,8 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: client-service
+data:
+ application.properties: |-
+ bean.message=Testing reload ! Message from backend is: %s
Services : %s
+
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/client-service-deployment.yaml b/spring-cloud/spring-cloud-kubernetes/client-service/client-service-deployment.yaml
new file mode 100644
index 0000000000..8867aecc33
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/client-service-deployment.yaml
@@ -0,0 +1,33 @@
+kind: Service
+apiVersion: v1
+metadata:
+ name: client-service
+spec:
+ selector:
+ app: client-service
+ ports:
+ - protocol: TCP
+ port: 8080
+ nodePort: 30083
+ type: NodePort
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: client-service
+spec:
+ selector:
+ matchLabels:
+ app: client-service
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ app: client-service
+ spec:
+ containers:
+ - name: client-service
+ image: client-service:latest
+ imagePullPolicy: Never
+ ports:
+ - containerPort: 8080
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/pom.xml b/spring-cloud/spring-cloud-kubernetes/client-service/pom.xml
new file mode 100644
index 0000000000..b929dbde61
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/pom.xml
@@ -0,0 +1,96 @@
+
+
+ 4.0.0
+ client-service
+ client-service
+ 1.0-SNAPSHOT
+
+
+ com.baeldung.spring.cloud
+ spring-cloud-kubernetes
+ 1.0-SNAPSHOT
+
+
+
+ 1.8
+ Finchley.SR2
+ 1.0.0.RELEASE
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud-dependencies.version}
+ pom
+ import
+
+
+ org.springframework.cloud
+ spring-cloud-kubernetes-dependencies
+ ${spring.cloud.k8s.version}
+ pom
+ import
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-kubernetes-discovery
+
+
+ org.springframework.cloud
+ spring-cloud-starter-kubernetes-config
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-hystrix
+
+
+ org.springframework.cloud
+ spring-cloud-starter-kubernetes-ribbon
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-ribbon
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ com.baeldung.spring.cloud.kubernetes.client.Application
+ JAR
+
+
+
+
+ repackage
+
+
+
+
+
+
+
+
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/Application.java b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/Application.java
new file mode 100644
index 0000000000..24e562c79b
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/Application.java
@@ -0,0 +1,27 @@
+package com.baeldung.spring.cloud.kubernetes.client;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
+import org.springframework.cloud.netflix.ribbon.RibbonClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+
+@SpringBootApplication
+@EnableDiscoveryClient
+@EnableCircuitBreaker
+@RibbonClient(name = "travel-agency-service", configuration = RibbonConfiguration.class)
+public class Application {
+
+ @LoadBalanced
+ @Bean
+ RestTemplate restTemplate() {
+ return new RestTemplate();
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientConfig.java b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientConfig.java
new file mode 100644
index 0000000000..4bc8fbe327
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientConfig.java
@@ -0,0 +1,19 @@
+package com.baeldung.spring.cloud.kubernetes.client;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConfigurationProperties(prefix = "bean")
+public class ClientConfig {
+
+ private String message = "Message from backend is: %s
Services : %s";
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientController.java b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientController.java
new file mode 100755
index 0000000000..952bccc3a8
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/ClientController.java
@@ -0,0 +1,54 @@
+package com.baeldung.spring.cloud.kubernetes.client;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.client.ServiceInstance;
+import org.springframework.cloud.client.discovery.DiscoveryClient;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestTemplate;
+
+import java.net.UnknownHostException;
+import java.util.List;
+
+@RestController
+public class ClientController {
+
+ @Autowired
+ private DiscoveryClient discoveryClient;
+
+ @Autowired
+ private ClientConfig config;
+
+ @Autowired
+ private TravelAgencyService travelAgencyService;
+
+ @RequestMapping("/deals")
+ public String getDeals() {
+ return travelAgencyService.getDeals();
+ }
+
+ @GetMapping
+ public String load() {
+
+ RestTemplate restTemplate = new RestTemplate();
+ String resourceUrl = "http://travel-agency-service:8080";
+ ResponseEntity response = restTemplate.getForEntity(resourceUrl, String.class);
+
+ String serviceList = "";
+ if (discoveryClient != null) {
+ List services = this.discoveryClient.getServices();
+
+ for (String service : services) {
+
+ List instances = this.discoveryClient.getInstances(service);
+
+ serviceList += ("[" + service + " : " + ((!CollectionUtils.isEmpty(instances)) ? instances.size() : 0) + " instances ]");
+ }
+ }
+
+ return String.format(config.getMessage(), response.getBody(), serviceList);
+ }
+}
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/RibbonConfiguration.java b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/RibbonConfiguration.java
new file mode 100755
index 0000000000..2b81c78be4
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/RibbonConfiguration.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016 to the original authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.baeldung.spring.cloud.kubernetes.client;
+
+import com.netflix.client.config.IClientConfig;
+import com.netflix.loadbalancer.AvailabilityFilteringRule;
+import com.netflix.loadbalancer.IPing;
+import com.netflix.loadbalancer.IRule;
+import com.netflix.loadbalancer.PingUrl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+
+public class RibbonConfiguration {
+
+ @Autowired
+ IClientConfig ribbonClientConfig;
+
+ /**
+ * PingUrl will ping a URL to check the status of each server.
+ * Say Hello has, as you’ll recall, a method mapped to the /path; that means that Ribbon will get an HTTP 200 response when it pings a running Backend Server
+ *
+ * @param config Client configuration
+ * @return The URL to be used for the Ping
+ */
+ @Bean
+ public IPing ribbonPing(IClientConfig config) {
+ return new PingUrl();
+ }
+
+ /**
+ * AvailabilityFilteringRule will use Ribbon’s built-in circuit breaker functionality to filter out any servers in an “open-circuit” state:
+ * if a ping fails to connect to a given server, or if it gets a read failure for the server, Ribbon will consider that server “dead” until it begins to respond normally.
+ *
+ * @param config Client configuration
+ * @return The Load Balancer rule
+ */
+ @Bean
+ public IRule ribbonRule(IClientConfig config) {
+ return new AvailabilityFilteringRule();
+ }
+}
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/TravelAgencyService.java b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/TravelAgencyService.java
new file mode 100644
index 0000000000..5ce6d7b8a1
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/java/com/baeldung/spring/cloud/kubernetes/client/TravelAgencyService.java
@@ -0,0 +1,26 @@
+package com.baeldung.spring.cloud.kubernetes.client;
+
+import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
+import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+@Service
+public class TravelAgencyService {
+
+ private final RestTemplate restTemplate;
+
+ public TravelAgencyService(RestTemplate restTemplate) {
+ this.restTemplate = restTemplate;
+ }
+
+ @HystrixCommand(fallbackMethod = "getFallbackName", commandProperties = {
+ @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "1000") })
+ public String getDeals() {
+ return this.restTemplate.getForObject("http://travel-agency-service:8080/deals", String.class);
+ }
+
+ private String getFallbackName() {
+ return "Fallback";
+ }
+}
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/application.yaml b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/application.yaml
new file mode 100644
index 0000000000..f966fdd7a5
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/application.yaml
@@ -0,0 +1,16 @@
+spring:
+ application.name: client-service
+ cloud.kubernetes.reload.enabled: true
+server.port: 8080
+management:
+ endpoint:
+ restart:
+ enabled: true
+ health:
+ enabled: true
+ info:
+ enabled: true
+ribbon:
+ http:
+ client:
+ enabled: true
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/client-service/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/client-service/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..a6a978a354
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/client-service/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.kubernetes.client.Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void contextLoads() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-kubernetes/deployment-travel-client.sh b/spring-cloud/spring-cloud-kubernetes/deployment-travel-client.sh
new file mode 100755
index 0000000000..90f92f31a6
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/deployment-travel-client.sh
@@ -0,0 +1,34 @@
+### set docker env
+eval $(minikube docker-env)
+
+### build the repository
+#mvn clean install
+
+### build the docker images on minikube
+cd travel-agency-service
+docker build -t travel-agency-service .
+cd ../client-service
+docker build -t client-service .
+cd ..
+
+### secret and mongodb
+kubectl delete -f travel-agency-service/secret.yaml
+kubectl delete -f travel-agency-service/mongo-deployment.yaml
+
+kubectl create -f travel-agency-service/secret.yaml
+kubectl create -f travel-agency-service/mongo-deployment.yaml
+
+### travel-agency-service
+kubectl delete -f travel-agency-service/travel-agency-deployment.yaml
+kubectl create -f travel-agency-service/travel-agency-deployment.yaml
+
+
+### client-service
+kubectl delete configmap client-service
+kubectl delete -f client-service/client-service-deployment.yaml
+
+kubectl create -f client-service/client-config.yaml
+kubectl create -f client-service/client-service-deployment.yaml
+
+# Check that the pods are running
+kubectl get pods
diff --git a/spring-cloud/spring-cloud-kubernetes/pom.xml b/spring-cloud/spring-cloud-kubernetes/pom.xml
index 51e1456358..a9563fc582 100644
--- a/spring-cloud/spring-cloud-kubernetes/pom.xml
+++ b/spring-cloud/spring-cloud-kubernetes/pom.xml
@@ -9,17 +9,19 @@
pom
- parent-boot-1
+ parent-boot-2
com.baeldung
0.0.1-SNAPSHOT
- ../../parent-boot-1
+ ../../parent-boot-2
-
+
demo-frontend
demo-backend
liveness-example
readiness-example
+ client-service
+ travel-agency-service
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/Dockerfile b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/Dockerfile
new file mode 100755
index 0000000000..30b66d5eff
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/Dockerfile
@@ -0,0 +1,5 @@
+FROM openjdk:8-jdk-alpine
+VOLUME /tmp
+COPY target/travel-agency-service-1.0-SNAPSHOT.jar app.jar
+ENV JAVA_OPTS=""
+ENTRYPOINT exec java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999 -jar /app.jar
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/mongo-deployment.yaml b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/mongo-deployment.yaml
new file mode 100644
index 0000000000..3d40581578
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/mongo-deployment.yaml
@@ -0,0 +1,45 @@
+apiVersion: v1
+kind: Service
+metadata:
+ labels:
+ app: mongo
+ name: mongodb-service
+spec:
+ type: NodePort
+ ports:
+ - name: "http"
+ port: 27017
+ protocol: TCP
+ targetPort: 27017
+ selector:
+ service: mongo
+---
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+ name: mongo
+spec:
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ service: mongo
+ name: mongodb-service
+ spec:
+ containers:
+ - args:
+ - mongod
+ - --smallfiles
+ image: mongo:latest
+ name: mongo
+ env:
+ - name: MONGO_INITDB_ROOT_USERNAME
+ valueFrom:
+ secretKeyRef:
+ name: db-secret
+ key: username
+ - name: MONGO_INITDB_ROOT_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: db-secret
+ key: password
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/pom.xml b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/pom.xml
new file mode 100755
index 0000000000..4b0b32b65a
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/pom.xml
@@ -0,0 +1,76 @@
+
+
+ 4.0.0
+ travel-agency-service
+ 1.0-SNAPSHOT
+
+
+ com.baeldung.spring.cloud
+ spring-cloud-kubernetes
+ 1.0-SNAPSHOT
+
+
+
+ 1.8
+ Finchley.SR2
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud-dependencies.version}
+ pom
+ import
+
+
+ ch.qos.logback
+ logback-classic
+ 1.2.3
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-actuator
+
+
+ org.springframework.boot
+ spring-boot-actuator-autoconfigure
+
+
+ org.springframework.boot
+ spring-boot-starter-data-mongodb
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ com.baeldung.spring.cloud.kubernetes.travelagency.Application
+ JAR
+
+
+
+
+ repackage
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/secret.yaml b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/secret.yaml
new file mode 100644
index 0000000000..a813c35be7
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/secret.yaml
@@ -0,0 +1,7 @@
+apiVersion: v1
+kind: Secret
+metadata:
+ name: db-secret
+data:
+ username: dXNlcg==
+ password: cDQ1NXcwcmQ=
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/Application.java b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/Application.java
new file mode 100755
index 0000000000..bfc7356176
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/Application.java
@@ -0,0 +1,23 @@
+package com.baeldung.spring.cloud.kubernetes.travelagency;
+
+import com.baeldung.spring.cloud.kubernetes.travelagency.controller.TravelAgencyController;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application implements CommandLineRunner {
+
+ private static final Log log = LogFactory.getLog(TravelAgencyController.class);
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+ public void run(String... args) throws Exception {
+ log.info("Travel Agency Started! ");
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/controller/TravelAgencyController.java b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/controller/TravelAgencyController.java
new file mode 100644
index 0000000000..42f001616a
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/controller/TravelAgencyController.java
@@ -0,0 +1,55 @@
+package com.baeldung.spring.cloud.kubernetes.travelagency.controller;
+
+import com.baeldung.spring.cloud.kubernetes.travelagency.model.TravelDeal;
+import com.baeldung.spring.cloud.kubernetes.travelagency.repository.TravelDealRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.List;
+import java.util.Random;
+import static org.springframework.web.bind.annotation.RequestMethod.GET;
+
+@RestController
+public class TravelAgencyController {
+
+ @Autowired
+ private TravelDealRepository travelDealRepository;
+
+ private static final Log log = LogFactory.getLog(TravelAgencyController.class);
+
+ @RequestMapping(method = GET, path = "/deals")
+ public String deals() {
+ log.info("Client is requesting new deals!");
+
+ List travelDealList = travelDealRepository.findAll();
+ if (!travelDealList.isEmpty()) {
+ int randomDeal = new Random().nextInt(travelDealList.size());
+ return travelDealList.get(randomDeal)
+ .toString();
+ } else {
+ return "NO DEALS";
+ }
+ }
+
+ @RequestMapping(method = GET, path = "/")
+ @ResponseBody
+ public String get() throws UnknownHostException {
+
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.append("Host: ")
+ .append(InetAddress.getLocalHost()
+ .getHostName())
+ .append("
");
+ stringBuilder.append("IP: ")
+ .append(InetAddress.getLocalHost()
+ .getHostAddress())
+ .append("
");
+ stringBuilder.append("Type: ")
+ .append("Travel Agency")
+ .append("
");
+ return stringBuilder.toString();
+ }
+}
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/model/TravelDeal.java b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/model/TravelDeal.java
new file mode 100644
index 0000000000..2cd2bf2d45
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/model/TravelDeal.java
@@ -0,0 +1,92 @@
+package com.baeldung.spring.cloud.kubernetes.travelagency.model;
+
+import org.springframework.data.annotation.Id;
+import org.springframework.data.mongodb.core.mapping.Document;
+import org.springframework.data.mongodb.core.mapping.Field;
+
+import java.math.BigInteger;
+import java.util.Date;
+
+@Document(collection = "travel_deal")
+public class TravelDeal {
+
+ @Id
+ private BigInteger id;
+
+ private String destination;
+
+ private String description;
+
+ @Field("deal_price")
+ private double dealPrice;
+
+ @Field("old_price")
+ private double oldPrice;
+
+ @Field("departure_date")
+ private Date departureDate;
+
+ @Field("arrival_date")
+ private Date arrivalDate;
+
+ public BigInteger getId() {
+ return id;
+ }
+
+ public void setId(BigInteger id) {
+ this.id = id;
+ }
+
+ public String getDestination() {
+ return destination;
+ }
+
+ public void setDestination(String destination) {
+ this.destination = destination;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public double getDealPrice() {
+ return dealPrice;
+ }
+
+ public void setDealPrice(double dealPrice) {
+ this.dealPrice = dealPrice;
+ }
+
+ public double getOldPrice() {
+ return oldPrice;
+ }
+
+ public void setOldPrice(double oldPrice) {
+ this.oldPrice = oldPrice;
+ }
+
+ public Date getDepartureDate() {
+ return departureDate;
+ }
+
+ public void setDepartureDate(Date departureDate) {
+ this.departureDate = departureDate;
+ }
+
+ public Date getArrivalDate() {
+ return arrivalDate;
+ }
+
+ public void setArrivalDate(Date arrivalDate) {
+ this.arrivalDate = arrivalDate;
+ }
+
+ @Override
+ public String toString() {
+ return "TravelDeal{" + "id=" + id + ", destination='" + destination + '\'' + ", description='" + description + '\'' + ", dealPrice=" + dealPrice + ", oldPrice=" + oldPrice + ", departureDate=" + departureDate + ", arrivalDate=" + arrivalDate + '}';
+ }
+}
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/repository/TravelDealRepository.java b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/repository/TravelDealRepository.java
new file mode 100644
index 0000000000..20c1e3b67a
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/java/com/baeldung/spring/cloud/kubernetes/travelagency/repository/TravelDealRepository.java
@@ -0,0 +1,12 @@
+package com.baeldung.spring.cloud.kubernetes.travelagency.repository;
+
+import java.util.List;
+
+import com.baeldung.spring.cloud.kubernetes.travelagency.model.TravelDeal;
+import org.springframework.data.mongodb.repository.MongoRepository;
+
+public interface TravelDealRepository extends MongoRepository {
+
+ public List findByDestination(String destination);
+
+}
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/application.properties b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/application.properties
new file mode 100644
index 0000000000..ffe78f0917
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/application.properties
@@ -0,0 +1,14 @@
+spring.application.name=travel-agency-service
+server.port=8080
+spring.cloud.kubernetes.reload.enabled=true
+spring.cloud.kubernetes.secrets.name=db-secret
+spring.data.mongodb.host=mongodb-service
+spring.data.mongodb.port=27017
+spring.data.mongodb.database=admin
+spring.data.mongodb.username=${MONGO_USERNAME}
+spring.data.mongodb.password=${MONGO_PASSWORD}
+management.endpoint.health.enabled=true
+management.endpoint.info.enabled=true
+management.endpoint.restart.enabled=true
+com.baeldung.spring.cloud.kubernetes.services=debug
+
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback-spring.xml b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback-spring.xml
new file mode 100644
index 0000000000..49aeda8f9f
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback-spring.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ logstash:5000
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback.xml
new file mode 100644
index 0000000000..37492be5bf
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+
+
+
+
+
+
+
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/travel-agency-config.yaml b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/travel-agency-config.yaml
new file mode 100644
index 0000000000..93a67e3777
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/travel-agency-config.yaml
@@ -0,0 +1,8 @@
+apiVersion: v1
+kind: Secret
+metadata:
+ name: travel-agency-service
+data:
+ application.properties: |-
+ bean.message=Testing reload ! Message from backend is: %s
Services : %s
+
diff --git a/spring-cloud/spring-cloud-kubernetes/travel-agency-service/travel-agency-deployment.yaml b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/travel-agency-deployment.yaml
new file mode 100644
index 0000000000..a41f13bf61
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/travel-agency-service/travel-agency-deployment.yaml
@@ -0,0 +1,44 @@
+kind: Service
+apiVersion: v1
+metadata:
+ name: travel-agency-service
+spec:
+ selector:
+ app: travel-agency-service
+ ports:
+ - protocol: TCP
+ port: 8080
+ nodePort: 30081
+ type: NodePort
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: travel-agency-service
+spec:
+ selector:
+ matchLabels:
+ app: travel-agency-service
+ replicas: 2
+ template:
+ metadata:
+ labels:
+ app: travel-agency-service
+ spec:
+ containers:
+ - name: travel-agency-service
+ image: travel-agency-service:latest
+ imagePullPolicy: Never
+ ports:
+ - containerPort: 8080
+ env:
+ - name: MONGO_USERNAME
+ valueFrom:
+ secretKeyRef:
+ name: db-secret
+ key: username
+ - name: MONGO_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: db-secret
+ key: password
\ No newline at end of file