Containers simplify deploying, scaling and running applications. Kubernetes is the platform of choice for orchestrating and managing containers that package the components for applications to run increasingly in hybrid environments. The almost insatiable appetite for this modern approach to app development has created a forcing function in the open source communities building container and Kubernetes technologies.
The Kubernetes ecosystem is still coming up with key pieces of technology for effectively running complex containerized apps in production. But for mainstream developers who are coming to containers now, the question is not whether they should run their apps on Kubernetes but how to do that productively.
With a strong Kubernetes core, now comes the next stage in the evolution of containers and Kubernetes. The plumbing is ready. Now the developer experience will be what matters. That’s a core belief for the architects who are developing Azure Kubernetes Service (AKS). AKS makes the developer experience simpler for developers — from building and testing container images to debugging and deployment to production.
Microsoft‘s new developer tools for AKS reflect this emphasis on the developer experience. Based on Visual Studio, the Dev Spaces tools simplify the developer workflow on Kubernetes. The tools allow for an easier development environment setup, pre-production testing, iterative development and faster debugging for complex microservices-based applications running on Kubernetes.
“It’s hard to be a developer in the age of distributed systems. In terms of getting mainstream developers empowered to use containers and container orchestration and build distributed applications, we still have a long way to go,” said Gabe Monroy, the lead program manager on Microsoft’s Azure container team. “The industry has been focused on APIs and principled, layered architectures — which is great, we need all that — but there hasn’t been as much focus on the experience for app developers. How do we make the process of developing software in this new world feel like what they were doing before?”
Kubernetes Challenges Developers from Build to Deploy
Developers who are new to Kubernetes face a high bar to entry. Taking advantage of containers likely means many hours of research. They start with learning how to write a Dockerfile, a manifest and a Helm chart and maybe using Draft for local development. Then they progress to working out how to get code tested, built into an image, linked into a continuous integration workflow with Brigade and safely deployed onto a cluster, which needs to create an audit log and without any accidental deployments.
But developers also need to set up their development environment to work with containers, making it look, feel and behave like the production environment. It must also integrate with all the other microservices, containers and external dependencies that power the rest of the app, which means stubbing or mocking out services locally to match that. On a large project, every developer has to take the time to do that, even though they might only be working on a small portion of it.
Plus, they want to use their familiar, rich developer tools in their environment, with logging so they can debug against live services, and breakpoints and fast deployment directly from their IDE so they can try out code changes.
“You’ll have heard the memes going round the industry right now that Kubernetes is still too hard to use for developers,” Monroy said. “It’s all great that we’ve agreed that this is the next layer of infrastructure — and no one can use it!” It’s a joke that has a serious point, he says.
Microsoft’s Developer Tools for Kubernetes
Time and time again, Microsoft has transformed the developer experience across different domains, from Excel and Access to Logic Apps and now the new Azure Dev Spaces service for rapid development against AKS.
The company is aiming to support the mainstream developers who are now beginning to pick up containers. To do this, the company is drawing on its history in developer tooling and on what it’s learned from creating open source tools like Helm, Brigade and Draft. Microsoft is also a top contributor to the upstream Kubernetes project — Kubernetes co-founder Brendan Burns leads the Microsoft container team — and Microsoft is a member of the Cloud Native Computing Foundation (CNCF), the home of Kubernetes.
“Microsoft’s DNA as a developer-oriented company has been brought to bear and you’re about to see the full weight of the Microsoft developer division be unleashed on the world of CNCF,” Monroy said.
Microsoft’s first steps toward a more developer friendly Kubernetes are new tools for Visual Studio, Visual Studio Code (and the CLI for developers who prefer that). The Kubernetes tools automatically create the ‘configuration as code’ scaffolding needed for a Kubernetes deployment, like Dockerfiles and Helm charts, for a new or existing project (to help with containerizing existing apps). The tools also integrate with the new Azure Dev Spaces service, so that scaffolding isn’t just for getting started on a first Hello World containers application; it gives developers assets and artifacts they can take all the way into production, with organizational templates to help teams stick to coding standards.
Debugging Microservices in 5 Minutes with Dev Spaces on AKS
Dev Spaces creates an individual, sandboxed “space” within a Kubernetes cluster running on AKS for every developer on a project. They can use the space directly from familiar IDEs like Visual Studio and Visual Studio Code (on Windows, Mac or Linux), or from the command line. They’re working against the live Kubernetes cluster in the cloud and getting a development environment that looks and feels exactly like a production environment, with all the dependencies and microservices and connected services that make up the app. Developers who don’t have the permissions (or the skills) to set up any of those services can still test against them running in the cloud. But they go straight to the containers their code lives in and they can debug and test and iterate independently; the code they’re working on doesn’t affect other developers on the team.
Setting up segregation for a Kubernetes cluster with namespace isolation and multitenant control is usually very complicated; with Dev Spaces it just comes with the Azure access model. But because AKS is full Kubernetes underneath and Dev Spaces is an add-on to an existing AKS cluster implemented using native Kubernetes concepts, you can use other Azure services or third-party tools with it. If you want to use Azure Key Vault or Hashicorp Vault for injecting secrets so you’re not storing them in code, that just works.
But the beauty of the integration with Visual Studio is that in addition to all the power of containers and cloud services, developers get the productivity of their familiar tools and workflow. They can go from creating a new project to setting breakpoints and hitting F5 to debug their code the way they do when that code is running on their own system. They get IntelliSense and the new IntelliCode AI-powered assistance for writing their code and even collaborative editing with Visual Studio Live Share, the way they would when writing any other kind of application. But because they’re working against AKS, they can also see the health of running containers and search through rich logs to see exactly where a bug is happening in production. And once they’ve found a bug, they can make a fix and hit F5 to send those changes straight to AKS and see them run.
“As the world has embraced these complex microservice environments it’s become so difficult now for a developer to walk up to an environment and be productive,” Monroy points out.
When an application can consist of hundreds of microservices, each with its own permutations of data stores, fixing a bug in one service is like finding a needle in a haystack. Setting up a hundred services or mocking them, with all their backing stores, on a laptop is prohibitively time-consuming for developers. Just setting up their environment so they can find and fix in a monolith application used to take a day. Now, getting ready to work on complex distributed applications can take weeks, if a developer can even get it set up correctly.
“Dev Spaces offers the ability to walk up with your Azure account and you can be fixing a bug in five minutes,” Monroy said.
Behind the scenes, Dev Spaces syncs the changes in the code the developer is working on locally directly into the container. For most changes, that updates without the container image needing to be rebuilt and redeployed. And that means the developer doesn’t lose their coding flow while they wait to see if the change fixed the bug. For a Node.js developer used to having nodemon automatically restart the node service for them every time it detects a file change, and only needing to refresh the browser to see their new code, that will feel familiar — and productive.
Dev Spaces uses service mesh routing to allow developers to debug very complex, distributed applications, Monroy explains. “By appending a prefix to a URL you’re able to instruct the service mesh to route your traffic to the container that’s under active development.”
“Nothing in the existing open source ecosystem is doing intelligent code synchronization or traffic routing,” Monroy points out. “If you have an application on GKE and you’re using Draft on GKE, you can take the same app to Azure and get a better experience with Dev Spaces with the faster iteration loop, the integrated spaces and the traffic routing.”
That tight integration between Visual Studio, Dev Spaces and AKS means developers using Kubernetes on Azure won’t lose the productivity they’re used to with local development as they start working with cloud-native tools.
Feature image via Pixabay.