\u003C/figure>\n\u003C!-- /wp:image -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>This is convenient, but you might wanna stop short of actually creating the cluster at the end of the workflow. Go through the wizard, but don’t click that blue “Create” button at the end! Instead, download the configuration you just created as an \u003Ca href=\"https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/\">ARM template\u003C/a> and check it into your source control system. Now you have the best of both worlds—ease of use and \u003Ca href=\"https://stackoverflow.blog/2021/03/08/infrastructure-as-code-create-and-configure-infrastructure-elements-in-seconds/\">infrastructure as code (IaC)\u003C/a>!\u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>Once you’re set up here, there’s little left to do once you start scaling your application except write bigger checks to your cloud provider. Any additional resource allocation is easy. The problems that come with scale—fault tolerance, load balancing, traffic shaping—are already handled. At no point will you hit that moment of being overwhelmed with success; you future-proofed your app without too much extra effort. \u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:heading -->\n\u003Ch2 id=\"h-you-can-stay-somewhat-cloud-agnostic\">You can stay (somewhat) cloud agnostic\u003C/h2>\n\u003C!-- /wp:heading -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>If your project is successful, chances are that technology decisions made in the early stages will still have an impact months or years down the road. Stack Overflow, for instance, was \u003Ca href=\"https://stackoverflow.blog/2008/09/21/what-was-stack-overflow-built-with/\">originally written\u003C/a> in C#. 13 years later, it’s still written in C#, but it used to be, too. Occasionally someone (ahem) suggests that we rewrite it in Node.js. That’s still never happened.\u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>The same can be said about dependencies on cloud services. You might build your new app on top of infrastructure as a service (IaaS) products like Amazon’s EC2. Or maybe you’re starting to take dependencies on platform as a service (PaaS) offerings such as Microsoft’s Azure SQL. But are you willing to make a long-term commitment to the cloud providers behind them at this stage? If you don’t know yet where your journey is going to take you, maybe you’d prefer to stay cloud agnostic for a little longer.\u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>Let’s get back to infrastructure as code: throwing a tool such as \u003Ca href=\"https://www.terraform.io\">Terraform\u003C/a> into the mix is going to help you with staying cloud agnostic to some degree. It provides a unified toolkit and configuration language (\u003Ca href=\"https://github.com/hashicorp/hcl\">HCL\u003C/a>) to manage your resources across different cloud and infrastructure providers. Your app is unlikely to be truly cloud agnostic, however, in the sense that you’ll be able to just switch your cloud provider as easily as your internet or electricity provider at home. \u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>Here’s a good discussion on this topic in HashiCorp’s forum: \u003Ca href=\"https://discuss.hashicorp.com/t/is-terraform-really-cloud-agnostic/5980\">Is Terraform really cloud agnostic?\u003C/a> As one of the commenter points out:\u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>> “A Kubernetes cluster is a good example of an abstraction over compute resources: there are many hosted and self-managed implementations of it on different platforms, all of which offer a common API and common set of capabilities.”\u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>This sums it up nicely! It’s still not a perfect abstraction. For example, each cloud provider is likely to have its own custom way of implementing things like public load balancers and persistent volumes in Kubernetes. It’s still be fair to say if you’re building on Kubernetes, you’re going to stay cloud agnostic to a certain degree. \u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:heading -->\n\u003Ch2 id=\"h-you-can-easily-spin-up-new-environments-as-many-as-you-like\">You can easily spin up new environments—as many as you like!\u003C/h2>\n\u003C!-- /wp:heading -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>Kubernetes is usually seen as a way to manage your production infrastructure. But here at Stack Overflow, we’ve been using it to manage our test environments on the fly. We're using Kubernetes to host what we call \u003Cem>PR Environments\u003C/em>. Every pull request can be run in an isolated test environment at the push of a button:\u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:image -->\n\u003Cfigure class=\"wp-block-image\">\u003Cimg src=\"https://lh5.googleusercontent.com/VMEnAyZjE5zyUkOdwnxAOQ9FEYf5SkP5O7cAlS6887oHqmBEgU7gH5TE2DUDT49XOk2x_77ik-lAnDw705__6zBbVLtVeE2Ja6zmEgXnqbQa1aOzhCu1lRRsLGZoL81OpGyvcYXS\" alt=\"\"/>\u003C/figure>\n\u003C!-- /wp:image -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>And when we say “isolated environment”, we mean \u003Cem>everything\u003C/em>: the app itself (with the code changes in the PR branch) with its own dedicated instances of SQL Server, Redis, Elasticsearch, and additional services pieces. All spun up from scratch within minutes and running in a handful of containers in a dedicated \u003Ca href=\"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/\">namespace\u003C/a>, just for you and anyone who’s interested in your PR. \u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>This isn’t something we invented; other organizations have been using this concept. The idea is that every code change goes into a version control system like Git through a pull request. Other developers will review the code, but the code won’t tell the whole story. You want to see the code in action. Normally, you’d have to download all the code locally, compile, and run it. That could be simple, but if you’re running a large application that draws code from multiple repos or—have mercy—a microservice architecture, then you may run into several hours of debugging.\u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>Even better, let’s say you’ve squashed all of the commits for a new feature into a single one and are committing it as a single PR. Send that PR environment to sales or marketing as a single link so that they can preview the feature in action. If your sales team wants to demo the app with specific features or custom builds, send them a PR environment link. You won’t have to spend time walking your less technical colleagues through the build process. \u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>A lot of groundwork was required to get to this point. First off, running classic .NET Framework in Windows Containers wasn’t really an avenue we wanted to pursue. It’s possible in theory—Windows support has been available in Kubernetes since v1.19—but the Docker/Kubernetes ecosystem is really more centered around Linux. Thankfully, our migration to .NET Core was already underway, so we decided to bet on Linux containers. \u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>This, of course, came with its own set of challenges. When you’re dealing with a 10+ year old codebase, you’re likely going to find assumptions about the infrastructure it’s running on: hardcoded file paths (including our favorite: forward slash vs. backslashes), service URLs, configuration, and so on. But we got there eventually, and now we’re in a place where we can spin up an arbitrary number of test instances of Stack Overflow, the Stack Exchange network, and our Teams product on our auto-scaling Kubernetes cluster. What a time to be alive!\u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>Looking back at the early days of Stack Overflow, having this kind of tooling available back then would have been a game changer. In the early stages of building a product, you typically want to build, measure, and learn as much and as fast as possible. Using containers and Kubernetes will allow you to build the tooling for that \u003Cem>and\u003C/em> future-proof you in case you’re going to scale. \u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>So, should you use Kubernetes from day one? Maybe! It still depends, of course, on your specific project, your requirements, and your priorities. \u003C/p>\n\u003C!-- /wp:paragraph -->\n\n\u003C!-- wp:paragraph -->\n\u003Cp>But have you been saying “we don’t need Kubernetes because we don’t have product market fit yet”? Take a closer look, and maybe you’ll find yourself saying “we need Kubernetes \u003Cem>because\u003C/em> we don’t have product market fit yet.”\u003C/p>\n\u003C!-- /wp:paragraph -->","html","2021-07-21T20:58:17.000Z",{"current":424},"why-you-should-build-on-kubernetes-from-day-one",[426,434,438,443],{"_createdAt":427,"_id":428,"_rev":429,"_type":430,"_updatedAt":427,"slug":431,"title":433},"2023-05-23T16:43:21Z","wp-tagcat-code-for-a-living","9HpbCsT2tq0xwozQfkc4ih","blogTag",{"current":432},"code-for-a-living","Code for a Living",{"_createdAt":427,"_id":435,"_rev":429,"_type":430,"_updatedAt":427,"slug":436,"title":437},"wp-tagcat-kubernetes",{"current":437},"kubernetes",{"_createdAt":427,"_id":439,"_rev":429,"_type":430,"_updatedAt":427,"slug":440,"title":442},"wp-tagcat-software-development",{"current":441},"software-development","software development",{"_createdAt":427,"_id":444,"_rev":429,"_type":430,"_updatedAt":427,"slug":445,"title":446},"wp-tagcat-testing",{"current":446},"testing","Why you should build on Kubernetes from day one",[449,455,460,465],{"_id":450,"publishedAt":451,"slug":452,"sponsored":12,"title":454},"1d082483-6dc6-424b-8b09-9c84b54779da","2025-09-02T17:00:00.000Z",{"_type":10,"current":453},"back-to-school-developers-at-stack-overflow-have-some-advice-for-you","Back to school? Developers at Stack Overflow have some advice for you",{"_id":456,"publishedAt":451,"slug":457,"sponsored":12,"title":459},"5cd91820-9515-4be5-87ae-e919fd443c18",{"_type":10,"current":458},"getting-started-on-stack-overflow-a-step-by-step-guide-for-students","Getting started on Stack Overflow: a step-by-step guide for students",{"_id":461,"publishedAt":451,"slug":462,"sponsored":12,"title":464},"614538a9-c352-4024-adf1-fa44a9f911b6",{"_type":10,"current":463},"stack-overflow-is-helping-you-learn-to-code-with-new-resources","Stack Overflow is helping you learn to code with new resources",{"_id":466,"publishedAt":451,"slug":467,"sponsored":12,"title":469},"763b1d36-83d8-4178-9c2d-32d705ea1d7b",{"_type":10,"current":468},"introducing-your-newest-study-buddy-stackoverflow-ai","Introducing your newest study buddy: stackoverflow.ai",{"count":471,"lastTimestamp":472},33,"2023-05-25T09:47:33Z",["Reactive",474],{"$sarticleModal":475},false,["Set"],["ShallowReactive",478],{"sanity-nH8BXg3_rnsX6zAXuoDAeKw9j789hEoNFmxDWnnPACg":-1,"sanity-comment-wp-post-18472-1756850436374":-1},"/2021/07/21/why-you-should-build-on-kubernetes-from-day-one/?cb=1"]