{"id":83700,"date":"2018-11-19T16:00:36","date_gmt":"2018-11-19T14:00:36","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=83700"},"modified":"2018-11-17T19:44:52","modified_gmt":"2018-11-17T17:44:52","slug":"spring-microservices-docker-kubernetes","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html","title":{"rendered":"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1"},"content":{"rendered":"<p>In this series of workshop we will build few micro services using spring boot, docker and then deploy them into kubernetes. So, Lets get started.<\/p>\n<p>First we need to define a problem statement to begin with. Lets say we want to build a <strong>order management system.<\/strong><\/p>\n<p><strong>Identifying domains<\/strong><\/p>\n<p>First step would be to understand what domains are required, for simplicity lets assume we need the following domains:<\/p>\n<blockquote>\n<p>Orders<br \/>\nProducts<br \/>\nCustomers or Users<br \/>\nShopping Cart<\/p>\n<\/blockquote>\n<p><strong>Now that we know what we are building, let\u2019s start developing.<\/strong><\/p>\n<p>In this workshop, we would be using the following<\/p>\n<blockquote>\n<p>Spring boot for micro services<br \/>\nPostgres for Database<br \/>\nGradle for build<br \/>\nDocker for containers<\/p>\n<\/blockquote>\n<p><strong>First Microservice : Products <\/strong><br \/>\nLets build our first micro-service for products, we will call it product service, this will contain the details of the products.<\/p>\n<p><strong>Step 1: Set up spring boot application using spring initialiser.<\/strong><br \/>\nGo to <code><a href=\"https:\/\/start.spring.io\/\" rel=\"nofollow\">https:\/\/start.spring.io\/<\/a><\/code> and genereate a <code>gradle<\/code> project with <code>Java<\/code> and SpringBoot <code>2.1.0\u00a0<\/code>And provide the following values :<\/p>\n<blockquote>\n<p>group id : com.anirudhbhatnagar<br \/>\nartifact : productService<br \/>\ndependecies : Web, Jpa, postgresSQL<\/p>\n<\/blockquote>\n<p>Click generate project and download the zipped project. Create a new directory called \u201corder_management_system\u201d. Unzip the project in a folder and copy its contents into a this new directory.<\/p>\n<p>Import the project into your favourite IDE and we are good to start. Check if the setup is working fine by running the project in a terminal:<\/p>\n<pre class=\"brush:bash\">.\/gradlew build<\/pre>\n<p>The build would fail with DataSourceBeanCreationException, this happened because we added PostgresSQL dependency in our project but did not configure the data source by giving the DB credentials and its uri. Lets do that in next step.<\/p>\n<p><strong>Step 2: Configure database<\/strong><br \/>\nWe need a database to persist the product details for the product service.<br \/>\nFor this we need 2 things :<br \/>\n\u2013 A running postgres database<br \/>\n\u2013 Configure its details in spring<br \/>\nLets first create a local postgres database. We can use a docker image to have a local postgres DB running. In order to have a postgres database server running as docker image, we need to have docker in our system. Use this <a href=\"https:\/\/docs.docker.com\/docker-for-mac\/install\/\">link<\/a> to install docker in your mac (Similar links can be found for Windows and Linux).<br \/>\nOnce docker is installed in your machine. Pull a latest postgres image and run it in your local. We will also initialise a database with username and password to be used. Run the following command in your terminal :<\/p>\n<pre class=\"brush:bash\">$ docker run --name oms_postgres -p 5432:5432 -e POSTGRES_USER=dbuser -e POSTGRES_DB=products_db -e POSTGRES_PASSWORD=password -d postgres<\/pre>\n<p>This will start a postgres server on port 5432 in your local and initialise an empty DB \u201cpostgres_db\u201d with username \u201cdbuser\u201d and password \u201cpassword\u201d. Once the database is up and running, we will now configure the datasource our spring boot application. One the ways and perhaps the easiest one with spring boot is to define data source URI and database credentials in the application.properties file. Spring boot will auto configure the data source using these credentials.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Open the application.properties file in the project and add below :<\/p>\n<pre class=\"brush:bash\">spring.datasource.url=jdbc:postgresql:\/\/localhost:5432\/products_db\r\nspring.datasource.username=dbuser\r\nspring.datasource.password=password\r\nspring.jpa.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect<\/pre>\n<p>Now, that we have configured the database for our application, lets run the gradle build again. Build :<\/p>\n<pre class=\"brush:bash\">.\/gradlew build<\/pre>\n<p>If everything is fine, then this time the build should pass. Run :<\/p>\n<pre class=\"brush:bash\">.\/gradlew bootRun<\/pre>\n<p>Now we will have an application running at : <a href=\"http:\/\/localhost:8080\/\" rel=\"nofollow\">http:\/\/localhost:8080\/<\/a> But as we have not implemented any service it will give a 404. In order to get it working, lets add some code.<\/p>\n<blockquote>\n<p>NOTE : if you are using postgres version you may get this error :<\/p>\n<pre class=\"brush:java\">java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.<\/pre>\n<p>This exception appears because JPA (Hibernate) supported by Atomikos is trying to verify PostgreSQL CLOB feature. This feature is not implemented by JDBC driver, so driver throws an unimportant exception. to fix this, add following to your application.properties file :<\/p>\n<pre class=\"brush:bash\">spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true<\/pre>\n<p>This will disable driver\u2019s feature detection (we will not be using this feature anyways)<\/p>\n<\/blockquote>\n<p><strong>Step 3: Add the code in product service<\/strong><br \/>\nNow that our service and database is setup, we can start writing some code for our product service. Make a package with the name : \u201cdomain\u201d inside the package \u201ccom.anirudhbhatnagar.productService\u201d and create a new Java class \u201cProduct\u201d with attributes:<\/p>\n<pre class=\"brush:bash\">id\r\nname\r\ndescription\r\nsku<\/pre>\n<p><strong>Lombok<\/strong><br \/>\nWe would use <a href=\"https:\/\/projectlombok.org\/setup\/gradle\">Lombok<\/a> to add constructors, getter, setter, and builder methods for our bean. To use lombok add its dependency to build.gradle file :<\/p>\n<pre class=\"brush:bash\">compileOnly 'org.projectlombok:lombok:1.18.4'<\/pre>\n<p>The add the annotations on the class \u201cProduct\u201d<\/p>\n<pre class=\"brush:bash\">@Entity\r\n@Builder\r\n@AllArgsConstructor\r\n@NoArgsConstructor\r\n@Getter\r\npublic class Product {\r\n\r\n    @Id\r\n    @GeneratedValue(strategy = GenerationType.AUTO)\r\n    private Long id;\r\n    private String name;\r\n    private String description;\r\n    private String sku;\r\n}<\/pre>\n<p>The meaning of annotations:<br \/>\n1. @Entity tell spring boot JPA to treat this class as an entity and persist it the database.<br \/>\n2. @Builder \u2013 this lmobok annotation adds builder method to our class for creating objects using builder pattern.<br \/>\n3. @AllArgsConstructor \u2013 this lmobok annotation adds an all arguments constructor to the class, Builder method needs this method.<br \/>\n4. @NoArgsConstructor \u2013 this lmobok annotation adds a default constructor to the class, JPA needs this constructor to fetch the entities.<br \/>\n5. @Getter \u2013 this lombok annotation adds getters to all the fields in the class, this is required to fetch individual attributes of the product, this is also used by Jackson to serialise\/deserialise the fields.<\/p>\n<p>And in order to create this table in the database, we need to set jpa hibernate auto-ddl as true. To do that add the following line to application.properties file :<\/p>\n<blockquote>\n<p>spring.jpa.hibernate.ddl-auto=create<\/p>\n<\/blockquote>\n<p>We also added : @GeneratedValue and @Id to the field Id, to tell hibernate to auto generate value for the id when creating a new entry in the table.<\/p>\n<p><strong>Add Controller<\/strong><br \/>\nAdd a controller to implement expose web services and serialise\/deserialise the request using Jackson. Make a package with the name : \u201ccontroller\u201d inside the package \u201ccom.anirudhbhatnagar.productService\u201d and create a new Java class \u201cProductController\u201d inside it.<\/p>\n<p>Annotate the class with \u201c@RestController\u201d to extend this class into a Servlet which exposes the webservices. Create the endpoints with the annotation \u201d @GetMapping\u201d<\/p>\n<pre class=\"brush:bash\">@RestController\r\npublic class ProductController {\r\n\r\n    @GetMapping(\"\/products\")\r\n    public List getProducts() {\r\n        return Collections.EMPTY_LIST;\r\n    }\r\n\r\n    @PostMapping(\"\/products\")\r\n    public Product save(@RequestBody Product product) {\r\n        return null;\r\n    }\r\n}<\/pre>\n<p><strong>Add Repository<\/strong><br \/>\nAdd JPA repository to persist products in the database. Make a package with the name : \u201crepository\u201d inside the package \u201ccom.anirudhbhatnagar.productService\u201d and create a new interface \u201cProductRepository\u201d inside it:<\/p>\n<pre class=\"brush:java\">public interface ProductRepository extends JpaRepository {\r\n}<\/pre>\n<p>Inject productRepository into ProductController so that we can use productRepository in ProductController to pass product request object received in controller to repository to fetch and persist.<\/p>\n<pre class=\"brush:java\">@RestController\r\npublic class ProductController {\r\n\r\n    private ProductRepository productRepository;\r\n\r\n    @Autowired\r\n    public ProductController(ProductRepository productRepository) {\r\n        this.productRepository = productRepository;\r\n    }\r\n\r\n    @GetMapping(\"\/products\")\r\n    public List getProducts() {\r\n        return productRepository.findAll();\r\n    }\r\n\r\n    @PostMapping(\"\/products\")\r\n    public Product save(@RequestBody Product product) {\r\n        return productRepository.save(product);\r\n    }\r\n}<\/pre>\n<p>Now we have product service up and running with following endpoints :<\/p>\n<p>GET \/products \u2013 gets all the products<br \/>\nPOST \/products \u2013 creates a new product<\/p>\n<p>See the entire code <a href=\"https:\/\/github.com\/anirudh83\/orderManagementSystem\">here<\/a>.<\/p>\n<p><strong>Dockerise the app<\/strong><br \/>\nCreate a file named \u201cdockerFile\u201d in the root folder of the application and add the following contents into it :<\/p>\n<pre class=\"brush:sql\">FROM openjdk:8-jdk-alpine\r\nVOLUME \/tmp\r\nCOPY build\/libs\/*.jar app.jar\r\nENTRYPOINT [\"java\",\"-Djava.security.egd=file:\/dev\/.\/urandom\",\"-jar\",\"\/app.jar\"]\r\nEXPOSE 8080<\/pre>\n<p>Build :<\/p>\n<pre class=\"brush:bash\">docker build .<\/pre>\n<p>Run :<\/p>\n<pre class=\"brush:bash\">docker run -p 8080:8080 [image-id]<\/pre>\n<p>This should start a service at localhost:8080<\/p>\n<p><strong>Test the application :<\/strong><br \/>\nUsing postman or any other similar tool, submit this request to create a product :<\/p>\n<p>Http POST <a href=\"http:\/\/localhost:8080\/products\" rel=\"nofollow\">http:\/\/localhost:8080\/products.\u00a0<\/a>Header : Content-Type application\/json<\/p>\n<pre class=\"brush:bash\">{\r\n\"name\" : \"Nike shoes\",\r\n\"description\" : \"mens shoes size 10\",\r\n\"sku\" : \"1234asc\"\r\n}<\/pre>\n<p>And the products can be fetched by : GET <a href=\"http:\/\/localhost:8080\/products\" rel=\"nofollow\">http:\/\/localhost:8080\/products<\/a><\/p>\n<p>In the next workshop, we would look into the following :<\/p>\n<blockquote>\n<p>Spring cloud, Ribbon for Service Discovery and client side load balancing<br \/>\nOpenFeign Client<br \/>\nKubernetes for container management<br \/>\nAPI gateways<\/p>\n<\/blockquote>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Anirudh Bhatnagar, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"https:\/\/anirudhbhatnagar.com\/2018\/11\/17\/spring-boot-microservices-docker-and-kubernetes-workshop-part1\/\" target=\"_blank\" rel=\"noopener\">Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this series of workshop we will build few micro services using spring boot, docker and then deploy them into kubernetes. So, Lets get started. First we need to define a problem statement to begin with. Lets say we want to build a order management system. Identifying domains First step would be to understand what &hellip;<\/p>\n","protected":false},"author":503,"featured_media":24013,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[936,1064,960,854],"class_list":["post-83700","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-docker","tag-kubernetes","tag-microservices","tag-spring-boot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1 - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about Kubernetes workshop? Check our article building few micro services using spring boot, docker and deploy them into kubernetes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1 - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about Kubernetes workshop? Check our article building few micro services using spring boot, docker and deploy them into kubernetes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-19T14:00:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Anirudh Bhatnagar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/anirudh_bh\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anirudh Bhatnagar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html\"},\"author\":{\"name\":\"Anirudh Bhatnagar\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/12f4f6d257ae9642dcccf1e58bab8346\"},\"headline\":\"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1\",\"datePublished\":\"2018-11-19T14:00:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html\"},\"wordCount\":1145,\"commentCount\":15,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"keywords\":[\"Docker\",\"Kubernetes\",\"Microservices\",\"Spring Boot\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html\",\"name\":\"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1 - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"datePublished\":\"2018-11-19T14:00:36+00:00\",\"description\":\"Interested to learn about Kubernetes workshop? Check our article building few micro services using spring boot, docker and deploy them into kubernetes.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/spring-microservices-docker-kubernetes.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/12f4f6d257ae9642dcccf1e58bab8346\",\"name\":\"Anirudh Bhatnagar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b90deb868665958c0c6608c42166b0318f8beb8743e356e8073f24723b0f28aa?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b90deb868665958c0c6608c42166b0318f8beb8743e356e8073f24723b0f28aa?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b90deb868665958c0c6608c42166b0318f8beb8743e356e8073f24723b0f28aa?s=96&d=mm&r=g\",\"caption\":\"Anirudh Bhatnagar\"},\"description\":\"Anirudh is a Java programmer with extensive experience in building Java\\\/J2EE applications. He has always been fascinated by the new technologies and emerging trends in software development. He has been involved in propagating these changes and new technologies in his projects. He is an avid blogger and agile enthusiast who believes in writing clean and well tested code.\",\"sameAs\":[\"http:\\\/\\\/anirudhbhatnagar.com\\\/\",\"http:\\\/\\\/www.linkedin.com\\\/in\\\/anirudhbhatnagar\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/anirudh_bh\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/anirudh-bhatnagar\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1 - Java Code Geeks","description":"Interested to learn about Kubernetes workshop? Check our article building few micro services using spring boot, docker and deploy them into kubernetes.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html","og_locale":"en_US","og_type":"article","og_title":"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1 - Java Code Geeks","og_description":"Interested to learn about Kubernetes workshop? Check our article building few micro services using spring boot, docker and deploy them into kubernetes.","og_url":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-11-19T14:00:36+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","type":"image\/jpeg"}],"author":"Anirudh Bhatnagar","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/anirudh_bh","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Anirudh Bhatnagar","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html"},"author":{"name":"Anirudh Bhatnagar","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/12f4f6d257ae9642dcccf1e58bab8346"},"headline":"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1","datePublished":"2018-11-19T14:00:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html"},"wordCount":1145,"commentCount":15,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","keywords":["Docker","Kubernetes","Microservices","Spring Boot"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html","url":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html","name":"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1 - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","datePublished":"2018-11-19T14:00:36+00:00","description":"Interested to learn about Kubernetes workshop? Check our article building few micro services using spring boot, docker and deploy them into kubernetes.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/spring-microservices-docker-kubernetes.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring Boot Microservices , Docker and Kubernetes workshop \u2013 part1"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/12f4f6d257ae9642dcccf1e58bab8346","name":"Anirudh Bhatnagar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b90deb868665958c0c6608c42166b0318f8beb8743e356e8073f24723b0f28aa?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b90deb868665958c0c6608c42166b0318f8beb8743e356e8073f24723b0f28aa?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b90deb868665958c0c6608c42166b0318f8beb8743e356e8073f24723b0f28aa?s=96&d=mm&r=g","caption":"Anirudh Bhatnagar"},"description":"Anirudh is a Java programmer with extensive experience in building Java\/J2EE applications. He has always been fascinated by the new technologies and emerging trends in software development. He has been involved in propagating these changes and new technologies in his projects. He is an avid blogger and agile enthusiast who believes in writing clean and well tested code.","sameAs":["http:\/\/anirudhbhatnagar.com\/","http:\/\/www.linkedin.com\/in\/anirudhbhatnagar\/","https:\/\/x.com\/https:\/\/twitter.com\/anirudh_bh"],"url":"https:\/\/www.javacodegeeks.com\/author\/anirudh-bhatnagar"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/83700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/503"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=83700"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/83700\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/24013"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=83700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=83700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=83700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}