Monokle VS Code Extension: Simplifying K8s Resource Validations

Aug 22, 2023
4 mins
Cortney Nickerson
Developer Advocate

We're thrilled to introduce the Monokle Visual Studio Code extension, your go-to tool for seamless validation of Kubernetes resources directly within your main coding environment.

Share on Twitter
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

No items found.

Try Monokle Desktop Today

Whether you're an avid user of Monokle Cloud, Desktop, CLI, or haven’t dipped your toes into the Monokle ecosystem yet, this extension serves as the perfect complement to enhance your YAML pre-commit validation workflow, ultimately bettering the overall quality of your Kubernetes deployments.

Why Monokle VS Code Extension?

Monokle is committed to empowering all members of Platform and DevOps teams as they work to achieve quality Kubernetes deployments. Across our suite of tools, the focus on pre-commit validation and troubleshooting help teams define, implement, and validate the necessary policies and best practices in the pre-commit phase followed by in-cluster insights and additional validation capacities facilitating more fluid and optimized workflows.

Monokle’s VS Code extension is the most recent integration to our tool suite. It focuses on helping Developers and DevOps engineers fine-tune their Kubernetes YAML configurations within the familiar confines of their favorite code editor before committing these configurations to source-control, while its integration with Monokle Cloud allows Platform Engineers to centrally define configuration policies to be shared and enforced across their teams and organization

Key Features of Monokle VS Code Extension

1. Real-time, Pre-commit Validation, No Expertise Required

By instantly identifying misconfigurations and providing actionable troubleshooting suggestions, our extension allows you to fix K8s configuration issues quickly and easily to enhance the overall quality of your Kubernetes deployments. 

The Monokle validation panel included in the extension provides a consolidated view of all validation errors, grouped by resource or rule ID. Dive into each rule's details and navigate directly to the exact line in your resource files where violations are detected for easy editing.

Monokle validation panel allows you to easily see all validation errors grouped by resource or rule id, see each rule details and navigate to exact line in each resource where violation was detected.

A comprehensive summary of misconfigurations can also be accessed within the extension’s problem pane or via the SARIF viewer, offering additional insights and filtering options as you work.

The extension effortlessly identifies misconfigurations within your source code and offers recommended solutions, eliminating the need for advanced Kubernetes expertise while supercharging your pre-commit workflows so your applications go from code to cluster quickly and easily. Misconfigurations are also neatly summarized in VS Code's problem pane or the SARIF viewer, complete with filtering options for added convenience and faster troubleshooting.

Get instant feedback on fixes. Validation runs in the background every time a file is modified and saved.

Additionally, for teams already leveraging Monokle Cloud as their policy control plane, our VS Code extension integrates seamlessly into your workflows allowing you to see if you’ve met and complied with the policies and best practices established by your team ensuring you get your pull request accepted the first time around. 

2. Customization at Your Fingertips

By default, the Monokle VS Code extension employs sensible policies for validation best practices to enhance your experience from the get-go. If you prefer to customize or add to these, simply integrate a valid configuration file into your workspace to tailor the validation process according to your specific project requirements or connect with remote policy via Monokle Cloud.

With dedicated Monokle: Bootstrap configuration command, you can customize validation configuration in seconds to adjust to your specific needs.

The default configurations used for resource validation enable the following validation policy plugins:

  • Pod Security Standard validation, based on the corresponding standard from the Kubernetes project.
  • Kubernetes Schema validation for checking schema and Kubernetes version compliance
  • Resource Links validation to ensure that all references between resources are valid
  • YAML syntax validation

Our Core Plugins documentation provides extensive details about each of the above-mentioned plugins.

3. Monokle Cloud Integration for Centralized Policies

Your team can achieve centralized policy management by defining and managing policies in Monokle Cloud and applying these policies to all project contributors using our Visual Studio Code extension.

Leverage Monokle Cloud’s capabilities via seamless extension integration in a few simple steps:

  1. Create a project and configure policies in Monokle Cloud, following the Getting Started Guide.
  2. Add your repository to the project via the “Repositories” tab. Be sure the selected repo includes K8s resources.
  3. Set up and fine-tune your policy through the “Policy” tab.
  4. Optionally invite team members that are working with the provided repositories via the “Members” tab
To use remote policy with Monokle extension you will need to create a project and configure policy for it in Monokle Cloud. Start by signing in to Monokle Cloud.

Once the setup is complete, follow these steps to apply your centrally defined policy in your local VS-Code project:

  1. Run “Monokle: Login” command to authenticate with your Monokle Cloud account from within VS-Code.
  2. Run the `Monokle: Synchronize` command to expedite initial policy retrieval and kickstart the validation process.

The Monokle VS-Code extension will automatically retrieve and apply policy changes from Monokle Cloud - ensuring that everyone connected to their Monokle Cloud account and the project is using the same centrally defined policies.

The extension also integrates with Visual Studio Code's command palette, offering a range of commands including validation runs, synchronization with Monokle Cloud, login/logout functions, and more.

Getting Started with Monokle VS Code Extension

To get started, go to the VS Code Marketplace and install the Monokle extension or explore more details in the extension GitHub repository.

Furthermore, we encourage you to integrate this extension with Monokle Cloud to discover the true potential of Kubernetes and cloud-native development with our first-of-its-kind K8s configuration control plane. Get started with Monokle Cloud at or book a demo to learn about everything Monokle has to offer. 

Want to discover more?

Monokle is a project deeply rooted in open source. What started as a simple project looking to empower Developers on their Kubernetes journey by simplifying the creation, validation, and successful deployment of YAML manifests has now turned into a tool suite composed of Monokle Cloud, Monokle Desktop, and Monokle CLI. At Monokle, we love YAML so you don’t have to and validation and best practices are at the heart of everything we do.

Visit today or check out our GitHub repository to download Monokle Desktop or get involved. You can also stay up to date regarding new feature releases, events, and other news by joining the Monokle Community on Discord, connecting with our team on LinkedIn, following us on Twitter, or subscribing to our newsletter.

Related Content