Skip to main content
New to Monokle? Streamline your Kubernetes deployments with Monokle. Get Started >

Visual Studio Code Extension

Monokle Visual Studio Code (VSC) extensions let's you validate your Kubernetes resources directly in Visual Studio Code. It is a great complement to Monokle Cloud, Desktop or CLI.

Monokle aims to help you write better Kubernetes deployments no matter your preferred way of working. You can now install our extension to fix your configuration directly while you are coding from the comfort of your Visual Studio Code.

As usual, misconfigurations are highlighted directly within your source code with a recommended remediation to fix them without being a Kubernetes expert. All misconfigurations are also listed as a summary in VSCode's problem pane, or within the SARIF viewer for additional information and filters.

By default, a sensible policy is used, or you can simply add a Monokle validation configuration file to your workspace to customize the rules.

Features

Easily Navigate Through All Errors and Resources

The 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.

Navigation

See Violations in the Problems Tab for Opened Resources

When navigating through resource files, you can see all violations in the VSC build-in Problems tab.

Problems Tab

Get Instant Feedback on Fixes

Validation runs in a background every time a file is modified and saved. This way you get instant feedback when applying fixes.

Realtime Validation

Tailored to Your Needs

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

Configuration

Centralize Policy Management with Monokle Cloud

Quickly define and manage polices in Monokle Cloud which will be used for anyone working with the project in VSC.

Configure Policies Easily with Monokle Cloud

Remote Policy Config

Synchronize automatically with a single command.

Remote Policy Sync

See Monokle Cloud integration setup section below on how to configure it.

Run with Commands

Use the command palette to interact with extensions, run validations, see current configurations and more.

  • Monokle: Validate - runs validation of Kubernetes resources on demand.
  • Monokle: Synchronize - synchronizes remote policy from Monokle Cloud.
  • Monokle: Login - logins to Monokle Cloud.
  • Monokle: Logout - logouts from Monokle Cloud.
  • Monokle: Show validation panel - opens validation panel (this can be also done be clicking on Monokle status bar icon).
  • Monokle: Show configuration - opens validation configuration file which is used as validation configuration for given project.
  • Monokle: Bootstrap configuration - creates monokle.validation.yaml configuration file. It is a quick way to adjust validation config.

Default Validation Policy

The default configuration used for resource validation enables the following validation 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.

Read about these plugins and their individual validation rules in the Core Plugins documentation.

To customize default configuration you can run the Monokle: Bootstrap validation command to generate the local monokle.validation.yaml configuration file in your project folder or connect with remote policy with Monokle Cloud.

Monokle Cloud Integration Setup

To use a remote policy with a Monokle extension you will need to create a project and configure a policy for it in Monokle Cloud. Start by signing in to Monokle Cloud.

For more information, refer to the Getting Started Guide or contact us directly on Discord.

Project Setup

After signing up, start by creating a project on the Projects Page:

Setup Create Project

Add a Repository to Your Project

After project is created, add a repository (the one you will be working locally with) to a project. This can be done by going to Repositories tab in project view and using Add repository button:

Add Repo

Policy Setup

The last step is policy setup. You can use policy wizard by going to Policy tab in project view:

Policy Setup

Synchronize

After the setup is done, you can run Monokle: Synchronize command to speed-up initial policy fetching and get the validation going.

Extension Settings

This extension contributes the following settings:

  • monokle.enable - Enable/disable this extension.
  • monokle.configurationPath - Set path to validation configuration file.
  • monokle.verbose - Log runtime info to VSC Developer Console.
  • monokle.overwriteRemotePolicyUrl - Overwrite default Monokle Cloud URL to fetch policies from.
  • monokle.telemetryEnabled - Enable/disable anonymous telemetry.

Dependencies

A core component of Monokle extension and dependency is @monokle/validation library.

Monokle extension also uses SARIF Viewer extension as dependency. It should be installed automatically when installing Monokle extension.