Microservices on Kubernetes Part 1 - IDE and Tools
Join the DZone community and get the full member experience.
Join For FreeAn important step before you begin an implementation of microservices is to configure your development IDE and install set of tools that simplifies integration with Kubernetes. In this article, I'm going to describe the most popular of those tools.
You can find a video version of every part of this tutorial on my YouTube channel. The first part is available here: https://www.youtube.com/watch?v=88u31ouE6m8
In this section of this guide, I'll be showing you tools, frameworks, and platforms that speed up development of JVM microservices on Kubernetes. We are going implement sample microservices-based architectures using Kotlin and then deploy and run them on different Kubernetes clusters.
1. Cloud Code Intellij Plugin
If you use Intellij as a development IDE and you prefer "clicking" over command line tools, Cloud Code is something for you. There is also the Cloud Code plugin for Microsoft Visual Studio Code. Cloud Code comes with a set of tools to help you write, run, and debug cloud-native applications quickly and easily. It is integrated with popular tools like Skaffold, Jib, kubectl or kustomize.
With Google's Cloud Code you can easily run and debug your application on Kubernetes the same as you would do it during normal, local development. You just need to click Run or Debug button on the configuration built using Cloud Code: Kubernetes template as shown below.
With Cloud Code, you can easily explore all your Kubernetes clusters that are configured inside local kube context. You can verify a list of workloads, services, ingresses, config maps, secrets, and others. You can easily stream logs, view detailed descriptions, and open terminal for selected pods. All information is exposed as a drop-down list box in tree structure as you see on the picture below.
Finally, you can take an advantage of editing support for Kubernetes manifests. You can use predefined templates for creating the most popular Kubernetes and Anthos manifests. You can use content assist for those manifests.
Of course, Cloud Code is not the only one Intellij plugin that supports integration with Kubernetes. You can use the official Jet Brains Kubernetes Plugin. The only problem is that it is available only in Ultimate edition of Intellij.
2. K9S
K9s is a mid-way solution between GUI and command-line tool. It is a terminal based UI to interact with your Kubernetes clusters. The aim of this project is to make it easier to navigate, observe, and manage your deployed applications. K9s continually watches Kubernetes for changes and offers subsequent commands to interact with your observed resources.
Here's the default screen from K9s after startup. It prints the list of available pods. You can easily print the logs of pod, delete it, edit its YAML manifest, and much else.
You can also easily switch between different resources just by typing ":", and then providing the name of the required Kubernetes object. Let's say you would like to see the list of Kubernetes Services — you just need to type :svc. We can also easily switch to all namespaces view just by typing "0".
3. CLI
Of course, you can still use just a simple kubectl command to manage your cluster. A knowledge about kubectl commands is a useful skill. When using this simple CLI, you may still install some useful command-line plugins. One of them is kubectx. It allows you to easily switch between different kube contexts. To view a list of configured contexts you just need to execute command kubectx ls.
4. Octant
The last tool discussed in this article is Octant. Octant is a typical web-based UI tool. It is runs locally on your machine and connects with the currently set Kubernetes context. After installation, you can run it just by using command octant. If you would like to select context on startup, just set parameter --context.
Octant provides much more features than a standard Kubernetes Dashboard, which is deployed directly on your cluster. By default it is available on http://localhost:7777. You can easily view all the most important Kubernetes components, filter them by labes or switch between namespaces.
You can also go to the details of selected object like pod or deployment. Then you may for example stream the logs, edit YAML, open terminal or just delete the current object.
You may also display additional resources like Istio components using Custom Resources view.
Conclusion
Before starting development it is worth to spend some time on discovering useful tools for managing Kubernetes cluster. As you see there is a wide selection of such tools, starting from simple command-line solutions to more advanced GUI or web-based interfaces. Once we have selected such tools we may proceed to the second phase - a setup of local or remote Kubernetes cluster for development.
Opinions expressed by DZone contributors are their own.
Trending
-
What to Pay Attention to as Automation Upends the Developer Experience
-
4 Expert Tips for High Availability and Disaster Recovery of Your Cloud Deployment
-
How Agile Works at Tesla [Video]
-
Knowing and Valuing Apache Kafka’s ISR (In-Sync Replicas)
Comments