Richard Li

@rdli

5 open source tools for microservices developers on Kubernetes

Kubernetes has become the de facto standard for running multi-container applications (aka microservices). Kubernetes has powerful features for container scheduling, service discovery, load balancing, and more. But what about developers who are developing software on Kubernetes? Here’s a list of five handy tools for developers building applications with Kubernetes, with a couple tips on using them.

kubectl

kubectl is the standard command line interface to Kubernetes. You’re going to need kubectl to deploy a container, figure out why it’s not running, and more. Some of the handy kubectl commands include:

  • kubectl explain provides a full list of every type of Kubernetes resource, from pods to secrets to statefulsets.
  • kubectl describe <resourcetype> <resource> gives a wealth of status information about a given resource.

And since resource names tend to have very long names (e.g., kubernetes-node-emt8.c.myproject.internal), spend a few minutes setting up tab completion in your shell to save yourself a bunch of typing.

the Kubernetes cheat sheet

So it’s not exactly a tool, but the Kubernetes cheat sheet has a comprehensive list of useful commands for using Kubernetes. Bookmark it, print it out, and save it somewhere handy.

Telepresence

Tired of waiting for your container deploy just to test a two line code change? While there are a few different ways to set up your development environment for microservices, Telepresence lets you embrace a hybrid model. In this model, you code your service locally on your laptop, while connecting to other services in your Kubernetes cluster via a two-way proxy.

With Telepresence, your locally running service:

  • has full access to Kubernetes environment variables, ConfigMap, secrets, and so forth
  • can communicate to services running on the cluster
  • services running on the cluster can communicate with your locally running instance

Needless to say, this isn’t recommended for production use. But in development, you can:

  • Edit your code, and immediately (without a deploy!) test the change with all of the services
  • Run a shell (just type telepresence) that has full access to your local filesystem, so you can use any tool or script on your laptop
  • Run a debugger or profiler on your service

Minikube

On an airplane without WiFi but still need to code? No problem. Minikube lets you run a Kubernetes instance on your laptop.

Also, a less known fact for Linux users: you can run minikube without a VM — handy if you’re setting up a continuous integration environment.

Curl

Virtually any service is going to have an API. curl lets you send and receive HTTP requests from your command line. If you’re testing a service, curl -v gives you a bevy of information on the HTTP interaction. If you're using gRPC for your APIs, curl also supports HTTP/2 with the --http2 flag, although you'll need to recompile it on Mac OS X.

Incidentally, the Kubernetes cheat sheet gives you a command to get an interactive shell on your cluster (kubectl run -i --tty busybox --image=busybox -- sh)). However, the command uses the busybox image which doesn't come with curl! You can get around this issue with either Telepresence (assuming you have curl installed on your local machine) or by using a different Linux image that contains curl (e.g., kubectl run -i tty archlinux --image=base/archlinux -- sh).

Conclusion

Developing multi-container applications on Kubernetes requires new tools, in addition to old ones. These are some of the tools that we’ve found useful while building our cloud applications on Kubernetes. If there any other tools that you’ve used and found useful, feel free to drop me an email at richard.li@datawire.io.

More by Richard Li

Topics of interest

More Related Stories