{"id":2602,"date":"2019-12-20T18:03:28","date_gmt":"2019-12-20T12:33:28","guid":{"rendered":"http:\/\/navveenbalani.dev\/?p=2602"},"modified":"2019-12-21T17:57:56","modified_gmt":"2019-12-21T12:27:56","slug":"setting-up-production-topology-on-google-cloud","status":"publish","type":"post","link":"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/","title":{"rendered":"Setting up production topology on Google Cloud"},"content":{"rendered":"\n<p>In this article, we would be deploying a set of microservices (as containers) on Google Kubernetes Cluster. We would use Google Endpoints for API management and deploy the google endpoint container along with our microservices container. <\/p>\n\n\n\n<p>Containers are\nbecoming a standard way to run and scale microservices across multiple cloud\nproviders. With Kubernetes, the job of deployment, scaling, and management of\ncontainerized applications on cloud or on promises is now mainstream and\nextremely streamlined.<\/p>\n\n\n\n<p>To build a production\ngrade environment, however, you need a host of other components like Virtual\nPrivate Network (VPN), endpoint management for microservices, load balancer to\nbalance request over various protocols (HTTP, HTTP(s), Web socket), Configuring\nSSL, Health monitoring of services, Network configuration like Whitelisting of\nIPs, Network address translation (NAT) for Outbound connections, and ensuring\nlogging at various entry points in your application.<\/p>\n\n\n\n<p>In this blog, I will go through the high-level steps to create a production ready environment on Google cloud for deploying microservices. The steps outlined are generic and can be applied to build your production topology on similar lines. <\/p>\n\n\n\n<p>We would further create an Ingress Controller (of type Load Balancer) and expose our application microservices over HTTPS. All incoming HTTPS requests would go to a Load balancer, which would direct them to one of the nodes in the Kubernetes Cluster. In the nodes, the requests would first go to Google endpoint (which would validate the endpoint key and logs all endpoint request) and then to the respective microservice endpoints.<\/p>\n\n\n\n<h2><a>Environment and Solution Overview<\/a><\/h2>\n\n\n\n<p>We would be\ndeploying a set of microservices (as containers) on Google Kubernetes Cluster.\nWe would use Google Endpoints for API management and deploy the google endpoint\ncontainer along with our microservices container. <\/p>\n\n\n\n<p>We would further\ncreate an Ingress Controller (of type Load Balancer) and expose our application\nmicroservices over HTTPS. All incoming HTTPS requests would go to a Load balancer,\nwhich would direct them to one of the nodes in the Kubernetes Cluster. In the\nnodes, the requests would first go to Google endpoint (which would validate the\nendpoint key and logs all endpoint request) and then to the respective\nmicroservice endpoints.<\/p>\n\n\n\n<p>There are\nadditional requirements on ensuring only authorized IPs access our microservices.\nWe will learn how to whitelist the IPs using two approaches &#8211; Google Cloud\nArmor and Nginx Ingress Controller (instead of the default Google Ingress\nController).<\/p>\n\n\n\n<p>Similarly, for\noutbound connections, we would be connecting to third-party services. The\nthird-party services employ similar IP whitelisting requirements, and we\u2019ll\nneed to provide our set of outbound IPs that would connect to these third-party\nservices.&nbsp; For this requirement, we would\nbe use Google Cloud NAT to provide our private Google Kubernetes Engine (GKE)\nclusters the ability to connect to the Internet, as well as Static outbound IPs\nthat we can configure and provide to third-party services to whitelist on their\nservers.<\/p>\n\n\n\n<p>There are\nadditional requirements on ensuring only authorized IPs access our microservices.\nWe will learn how to whitelist the IPs using two approaches &#8211; Google Cloud\nArmor and Nginx Ingress Controller (instead of the default Google Ingress\nController).<\/p>\n\n\n\n<p>Similarly, for outbound connections, we would be connecting to third-party services. The third-party services employ similar IP whitelisting requirements, and we\u2019ll need to provide our set of outbound IPs that would connect to these third-party services.&nbsp; For this requirement, we would be use Google Cloud NAT to provide our private Google Kubernetes Engine (GKE) clusters the ability to connect to the Internet, as well as Static outbound IPs that we can configure and provide to third-party services to whitelist on their servers.<\/p>\n\n\n\n<h2><a>High-Level Steps<\/a><\/h2>\n\n\n\n<p>The following are\nthe high-level steps that we would carry out to build and deploy our\nmicroservices configuration. It is assumed that the Google project is already\ncreated.<\/p>\n\n\n\n<h3>Solution 1 &#8211; Using Google\nIngress Controller <\/h3>\n\n\n\n<ol><li>Create a VPN<\/li><li>Create a\n     private instance of Google Kubernetes Cluster.<\/li><li>Create Cloud\n     NAT configuration.<\/li><li>Download the\n     microservice application and deployment scripts from GitHub.<\/li><li>Build the\n     microservice container.<\/li><li>Push the\n     microservice container to the google container registry.<\/li><li>Deploy endpoint for the project.<\/li><li>Create\n     Workload, Service, and Ingress (GCE ingress).<\/li><li>Invoke the\n     microservice.<\/li><li>Configure\n     Cloud Armor. <\/li><li>Test the\n     microservices with Cloud Armor.<\/li><\/ol>\n\n\n\n<h3>Solution 2 &#8211; Using Nginx\nIngress Controller<\/h3>\n\n\n\n<p>The Solution 1\nabove uses default Google Ingress Controller. We can also use Nginx Ingress Controller\nas it provides a lot of add-on features like IP whitelisting, rule\nconfiguration, HTTP(s) redirect etc. The deployment process is the same as\ndescribed in Solution 1, except for Point 7 and Point 8. For Point 7, we would\ninstall Nginx ingress first on our Kubernetes Cluster and then deploy the Nginx\nIngress configuration for our application (instead of GCE ingress). We don\u2019t\nneed Cloud Armor as the whitelisting of IPs is supported through Nginx Ingress\ndirectly. <\/p>\n\n\n\n<p><a href=\"https:\/\/navveenbalani.dev\/index.php\/articles\/building-production-topology-with-google-cloud-part-1\/\">Click here for the next article<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we would be deploying a set of microservices (as containers) on Google Kubernetes Cluster. We would use Google Endpoints for API management and deploy the google endpoint container along with our microservices container. Containers are becoming a standard way to run and scale microservices across multiple cloud providers. With Kubernetes, the job [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2128,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,79],"tags":[285],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.0.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Setting up production topology on Google Cloud - Current and Future Technology Trends by Navveen Balani<\/title>\n<meta name=\"description\" content=\"Setting up production topology on Google Cloud - Articles\" \/>\n<link rel=\"canonical\" href=\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setting up production topology on Google Cloud - Current and Future Technology Trends by Navveen Balani\" \/>\n<meta property=\"og:description\" content=\"Setting up production topology on Google Cloud - Articles\" \/>\n<meta property=\"og:url\" content=\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/\" \/>\n<meta property=\"og:site_name\" content=\"Current and Future Technology Trends by Navveen Balani\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-20T12:33:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-12-21T12:27:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2016\/09\/bk6.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"450\" \/>\n\t<meta property=\"og:image:height\" content=\"374\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"4 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/navveenbalani.dev\/#website\",\"url\":\"https:\/\/navveenbalani.dev\/\",\"name\":\"Current and Future Technology Trends by Navveen Balani\",\"description\":\"Current and Future Technology Trends by Navveen Balani\",\"publisher\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/navveenbalani.dev\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2016\/09\/bk6.jpg\",\"width\":450,\"height\":374},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/#webpage\",\"url\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/\",\"name\":\"Setting up production topology on Google Cloud - Current and Future Technology Trends by Navveen Balani\",\"isPartOf\":{\"@id\":\"https:\/\/navveenbalani.dev\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/#primaryimage\"},\"datePublished\":\"2019-12-20T12:33:28+00:00\",\"dateModified\":\"2019-12-21T12:27:56+00:00\",\"description\":\"Setting up production topology on Google Cloud - Articles\",\"breadcrumb\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/\",\"url\":\"https:\/\/navveenbalani.dev\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/\",\"url\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/\",\"name\":\"Setting up production topology on Google Cloud\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/#webpage\"},\"author\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"headline\":\"Setting up production topology on Google Cloud\",\"datePublished\":\"2019-12-20T12:33:28+00:00\",\"dateModified\":\"2019-12-21T12:27:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/#webpage\"},\"publisher\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"image\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/setting-up-production-topology-on-google-cloud\/#primaryimage\"},\"keywords\":\"google-cloud\",\"articleSection\":\"Articles,Cloud Computing\",\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\",\"name\":\"Navveen\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/navveenbalani.dev\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2019\/07\/navveen_balani.jpeg\",\"width\":200,\"height\":200,\"caption\":\"Navveen\"},\"logo\":{\"@id\":\"https:\/\/navveenbalani.dev\/#personlogo\"},\"sameAs\":[\"http:\/\/naveenbalani.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/2602"}],"collection":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/comments?post=2602"}],"version-history":[{"count":4,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/2602\/revisions"}],"predecessor-version":[{"id":3077,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/2602\/revisions\/3077"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/media\/2128"}],"wp:attachment":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/media?parent=2602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/categories?post=2602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/tags?post=2602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}