Visual Studio Code extensions for Docker and Kubernetes

Going cloud native? These VS Code extensions help smooth the way to building and running container-based apps locally or in the cloud

Visual Studio Code extensions for Docker and Kubernetes
Getty Images

Cloud-native” has become the overarching term for the newest generation of software development technologies and methods. It’s about writing software to run in elastic, distributed environments, using Docker containers, Kubernetes and other orchestration systems, and microservices.

New methods demand new tools, too. Visual Studio Code, Microsoft’s modular, open source code editor and development environment, offers many extensions for working with code in cloud-native environments and for managing those environments as well.

Following is a rundown of some of the most immediately useful extensions for cloud-native work. If you already work with one of the environments or tools in question, and have been wondering how to integrate Visual Studio Code into your workflow, start with one of these.

Docker Extension Pack

If you’re using Visual Studio Code to work with Docker, whether to create Dockerfiles or Docker Compose YAML, or to write code that eventually goes into Docker containers, or all of the above, it makes sense to have extensions for Docker on hand. The Docker Extension Pack provides two common Docker extensions in one install: Docker Explorer and the Docker extension by Microsoft. If you’re using Docker Compose, also snag the Docker Compose extension to make life easier.

Kubernetes Tools

If you’re developing applications for Kubernetes, the most direct way to make Visual Studio Code part of the workflow is with Microsoft’s Kubernetes Tools extension. Kubernetes Tools works with Kubernetes in all its incarnations: locally in both full-blown Kubernetes clusters and projects like Minikube, on the Microsoft Azure cloud, and on third-party clouds including Amazon Web Services and Google Cloud Platform.

Most everything you’d do with a Kubernetes cluster is supported here. You can create and configure a cluster, browse your cluster setup, create new Helm charts or apply Helm charts from repos, edit manifests, perform container builds, inspect logs from pods, manage port forwards, debug Java or Node.js apps, and lots more. And all can be done from the command palette menu with a couple of keystrokes. (Type kub and a space to quick-start the suggestion list.)

A companion extension (not by Microsoft), kube-scope-weave, extends the Kubernetes extension with support for Weaveworks’s Weave Scope application inspection and visibility service.

Cloud Code 

Google, the original creator of Kubernetes, has its own Kubernetes development extension for Visual Studio Code, Cloud Code, which allows you to create Kubernetes clusters with Google Kubernetes Engine, Amazon Elastic Kubernetes Service, Azure Kubernetes Service, and Minikube. Cloud Code is available in beta versions for both Visual Studio Code and IntelliJ IDE (or other JetBrains IDEs).

Like Microsoft’s Kubernetes Tools, Cloud Code supports the full gamut of Kubernetes actions, from cluster creation and app deployment to resource inspection and log viewing. In addition, Cloud Code has slightly broader language support for debugging (Python, Node.js, Go, Java, .NET Core), as well as more Google Cloud developer options, such as Cloud Build support for deployments.

Kubeless

Bitnami’s Kubeless is a Kubernetes framework for building serverless applications—a way to get AWS Lambda-like functionality on your own Kubernetes infrastructure. Install Bitnami’s Kubeless extension for Visual Studio Code, and you can deploy functions, call them, read their logs, or delete them directly from the Visual Studio Code command palette.

Squash

Kubernetes comes with its share of difficulties; debugging applications is a big one. Squash aids debugging for Python, Node.js, Java, and Go apps running in Kubernetes. The Squash extension for Visual Studio Code integrates Squash’s debugging tools into your environment, so you don’t have to switch away to edit the apps you’re also managing with Kubernetes tools in Visual Studio Code.

Deploy

One common scenario any developer faces is deploying code or files they’re working on locally to a cloud environment—whether it’s a code repository, an Amazon S3 bucket, a Dropbox folder, a local or network folder, or what have you. Different files in a project might even be deployed to different destinations.

The Deploy extension lets you deploy files in a project that match a wildcard to one of many possible destination types, either on demand or whenever there’s a change. You can also sync on demand in both directions from a remote source, although only for certain types of sources.

CloudFormation

AWS CloudFormation lets you manage Amazon cloud resources by way of JSON or YAML templates instead of custom scripting or manually fiddling with AWS settings. The CloudFormation extension expedites the creation of these templates by auto-completing sections of the file with boilerplate definitions, whether you’re working with a newly created CloudFormation definition or editing an existing one.

Note that you might need to install the YAML Language Server and tweak its settings slightly to use YAML, but those tweaks shouldn’t affect the behavior of most other YAML documents, and you can always disable the extension when you’re not editing CloudFormation files.

Terraform

HashiCorp’s Terraform lets you describe your cloud infrastructure requirements as code. The Terraform extension for Visual Studio Code provides syntax highlighting, linting, formatting, and validation for Terraform manifests. You can create manifests that are not only easy to read, but are verified to be stylistically correct and free of errors before you deploy them.

Microsoft offers its own extension for using Terraform with Azure. Azure Terraform for Visual Studio Code lets you execute Terraform commands in the Visual Studio Code shell or the palette menu. You can also create a graphical visualization of the module, which can be saved as a .png file. Note that this last feature requires GraphViz, which must be installed separately.

OpenShift Extension Pack

From late 2014 to mid 2015, Red Hat’s OpenShift underwent a grand reinvention that turned it into a Docker and Kubernetes powered platform (Red Hat has called OpenShift “Kubernetes++”). Since then, OpenShift has also become the home for another container-oriented acquisition, CoreOS. Small wonder Red Hat offers a collection of Visual Studio Code extensions for working with OpenShift, called the OpenShift Extension Pack (currently in preview).

The OpenShift Extension Pack includes the following extensions:

  • The OpenShift Connector for deploying code to clusters (although only Java and Node.js are supported as project languages).
  • The Server Connector for interacting with Red Hat’s line of server products.
  • The Project Initializer for quick creation of new OpenShift projects in a Visual Studio Code session.
  • The Kubernetes Tools extension provided by Microsoft (as described above).

Heroku

Plenty of cloud apps still live in Heroku, one of the original container-based platform-as-a-service clouds. (And why not?) Two Heroku extensions for Visual Studio Code cover the essentials. The Heroku extension is a simple tool to check the deployment status of a Heroku app. Heroku-cli is an interface to the Heroku CLI from within Visual Studio Code.

Copyright © 2019 IDG Communications, Inc.