RubyMine 2025.2 Help

Kubernetes

Kubernetes is a container orchestration engine for the deployment, scaling, and management of containerized applications. Install and enable the Kubernetes plugin for RubyMine to add the following features for managing your Kubernetes cluster:

  • Coding assistance for Kubernetes resource configuration files.

  • Coding assistance for Helm charts and templates. For more details, refer to the dedicated Helm page.

  • Validation of custom resources with custom resource definition (CRD) specifications.

  • Coding assistance for Kustomize files: field and local file path completion, quick documentation, and navigation between Kustomize files and patches. The list of related Kustomize files appears in the editor at the top of the open Kustomize patch.

  • Interaction with the cluster from RubyMine: use the Services tool window to see all resources of the Kubernetes cluster, jump to relevant resource definitions, view logs for containers running on pods, and much more.

The Kubernetes plugin supports Kubernetes versions 1.16 to 1.33 (you can select the applicable version).

Install the Kubernetes plugin

This functionality relies on the Kubernetes plugin, which you need to install and enable.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Marketplace tab, find the Kubernetes plugin, and click Install (restart the IDE if prompted).

Specify a custom path to kubectl

RubyMine uses the default kubectl (and helm if you use it) executables as determined by the PATH environment variable.

If you install kubectl in custom directories, you can manually specify the path to it.

  1. In the Settings dialog (Ctrl+Alt+S) , select Build, Execution, Deployment | Kubernetes.

  2. In the Path to kubectl executable field, specify a path to the kubectl executable file.

  3. Click Test to check the file location. If it's not found, you can either manually check the file location or click Install, and RubyMine will download and install missing software.

Kubernetes settings window

Use custom Kubernetes configuration files

Information about clusters is stored in a kubeconfig file. RubyMine detects the default kubeconfig file, which is usually $HOME/.kube/config (this location can be changed by the KUBECONFIG environment variable). If you want RubyMine to get information about clusters from custom kubeconfig files and not just from the default one, you can specify them in the IDE settings. You can either apply it globally or use a different file for each project.

  1. In the Settings dialog (Ctrl+Alt+S) , select Build, Execution, Deployment | Kubernetes.

  2. Under Configuration, click Add kubeconfig and specify the path to a kubeconfig file.

  3. If you want to use the configuration file in all projects, select Global in the Scope column. To use it only in the current project, keep the Project scope.

When you add a file, RubyMine validates its syntax and reports errors, if any.

Kubeconfig Configuration

Configure the Kubernetes API version

RubyMine provides completion for configuration key values, navigation to relevant selectors and definitions via gutter icons, specialized inspections that check for deprecated values and required keys, and other assistance features. These depend on the version of the API you are using. The Kubernetes plugin supports Kubernetes versions 1.16 to 1.33. By default, RubyMine sets it to the latest version. However, if your resources use an earlier version, you can change it.

  1. In the Settings dialog (Ctrl+Alt+S) , select Languages & Frameworks | Kubernetes.

  2. Change the Kubernetes API version and Kustomize version options as necessary.

Resource configuration files

The Kubernetes plugin provides rich support for resource configuration files in YAML, and only basic support for the JSON format.

Supported features

Feature

YAML

JSON

Auto-completion

Supported

Supported

Quick documentation

Supported

Supported

Inspections and quick fixes

  • Invalid, missing, and duplicated keys

  • Non-editable (read-only) keys and resources

  • Deprecated keys and resources

  • Invalid integer and enum key values

  • Invalid, missing, and duplicated properties

Live templates

Predefined templates for common resource kinds

No predefined live templates

Smart completion

Supported

Not supported

Custom resource definitions

Supported

Not supported

Label definitions and selectors

Navigation using gutter icons, find usages, and renaming

Not supported

Enhancements of the original Kubernetes model

Enums instead of plain strings where applicable

None

RubyMine recognizes Kubernetes resource configuration files using the following mandatory fields:

  • apiVersion: identifies the versioned schema of the object representation

  • kind: identifies the resource type (for example, Service, Pod, Deployment, and so on)

If both of the previous fields are present in a YAML or JSON file, RubyMine will mark the file with the corresponding Kubernetes icon and enable all available features.

Create a resource file

With RubyMine, you can quickly create configuration files for some of the most popular resources in Kubernetes.

  1. In the Project tool window Alt+1, right-click a folder, select New or press Alt+Insert, and then select Kubernetes Resource.

  2. In the Name field, type your resource name and select the file template from the list.

    New Kubernetes Resource Window

    This will create a new file with its contents based on the selected file template.

  3. Click Apply icon to create the resource in a cluster. To change the target cluster, click select context.

Alternatively, in YAML files, you can use predefined live templates, for example:

  • kconfigmap: Kubernetes ConfigMap

  • kcronjob: Kubernetes CronJob

  • kdeployment: Kubernetes Deployment

  • kingress: Kubernetes Ingress

  • kpod: Kubernetes Pod

  • kresource: Kubernetes Resource from Scratch

  • kservice: Kubernetes Service

Kubernetes live templates

Disable Kubernetes schema validation

RubyMine validates your Kubernetes files against the Kubernetes API schema. This includes checking it for required keys or possible types of resource.

If your file contains apiVersion and kind, but it is not a Kubernetes file, you can disable such validation. You can suppress inspections and change their scope and severity in Settings | Editor | Inspections | Kubernetes. Or you can mark a file with a special directive to disable validation in it:

  • At the beginning of the file, add # nonk8s.

  • Alternatively, if you already have a warning about an unknown resource, right-click it in the Problems tool window and select Show Quick-Fixes | Mark this file as non-Kubernetes.

Manage your cluster

Use the Services tool window to view your cluster, switch between namespaces, and modify the cluster resources.

Add clusters

To interact with Kubernetes clusters, add clusters in the Services tool window.

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Right-click a Kubernetes node in the Services tool window and select Add Clusters. Alternatively, click the Add button and select Kubernetes | Add Clusters.

    Next, select the source for Kubernetes clusters to be added:

    • From Default Directory: get clusters from the default location (usually $HOME/.kube/config).

    • From Custom kubeconfigs: select any kubeconfig file from your computer.

    • Paste kubeconfig Content: paste the kubeconfig content into the textarea that opens.

    Select Kubernetes context source
  3. In the Add Clusters window that opens, select a cluster that you want to add and click Add Clusters.

    Add Clusters window

Added Kubernetes clusters will be available in the Services tool window. You can open each of them in a separate tab by right-clicking a cluster and selecting Open in New Tab.

To monitor the cluster resources in real-time, you can connect to the cluster.

Connect to the cluster

Connect to the cluster to interact with it in the IDE: follow logs, preview resources, view their configuration files, and get live updates when they are modified. Without connecting to the cluster, you can modify its resources in the editor.

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. If you do not have clusters in the Services tool window, add a cluster.

  3. Right-click a cluster and select Connect Cluster.

Connect cluster

Edit kubeconfig

The kubeconfig file contains information about clusters, users, namespaces, and authentication.

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Select a cluster and click Open kubeconfig File in Editor (Open kubeconfig File in Editor) on the toolbar. The action is also available when you right-click any Kubernetes object in the Services tool window.

    This will open the kubeconfig file in a new tab of the editor. To change the default file opened by this action, you can specify a path to another file in Path to kubeconfig file.

When you change your kubeconfig file, the configuration is automatically reloaded. You can also reload it manually or disable automatic reload by right-clicking a cluster or any Kubernetes object and selecting More | Reload Configuration Automatically.

Reload Configuration

Switch between namespaces

Kubernetes namespaces let you logically isolate resources within your cluster. With RubyMine, you can quickly switch between namespaces.

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Right-click your cluster or any resource, select Namespaces (or click The Namespace icon on the toolbar), and select the required namespace.

    To view resources of all namespaces, select All Namespaces.

    Namespaces context menu

Select the current cluster

A current cluster refers to the cluster that is set as the default for interactions with resources in the editor and in the Project tool window.

When you modify or create a resource file locally, you can select the cluster to which to apply the resource by clicking select context. You can also choose it in advance.

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Right-click a cluster and select Set Cluster as Current.

    Set Current Cluster

    Alternatively, select a cluster and click on the toolbar.

This setting is also available in the IDE settings, under Languages & Frameworks | Kubernetes.

Modify cluster resources

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Right-click a resource and select View YAML.

    This will open the configuration file of the selected resource in a new tab of the editor. When you change a field, modified lines are highlighted in the gutter. You can click the highlighted area in the gutter to quickly preview or rollback changes.

    View Diff
  3. Click Apply icon to apply changes to the current cluster and namespace.

When you modify a resource configuration file, a toolbar appears at the top right. It lets you apply the changes, delete the resource, preview the diff, and roll back the changes.

View resource details

RubyMine allows you to quickly view the details of your Kubernetes resources without running any commands manually.

  • In the Services tool window, select a resource to view its details.

Delete resources

You can delete a resource in any of the following ways:

  • In the Services tool window, right-click a resource and select Delete (Current Cluster Not Configured).

  • In the Services tool window, select a resource and click Delete resource (Delete Resource) on the toolbar.

  • If the resource YAML file is opened in the editor, hover over it and click Delete resource. You can also click Select context here to change the cluster where you want to delete the resource.

Forward ports

With port forwarding in Kubernetes, you can redirect traffic from a local port on your computer to a port on a Kubernetes pod. RubyMine lets you manage port forwarding: you can forward one or more local ports to remote ports, view all active forwarding sessions in your cluster (established in RubyMine), stop and restart forwarding sessions.

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8. Right-click a target pod and select Forward Ports.

  2. In the Forward Ports dialog:

    • In the Addresses field, list addresses to listen on. Use commas to separate multiple values.

    • In the Ports field, specify ports in the <local port>:<remote port> format. For example, 8888:5000 to listen on local port 8888 and forward data to/from remote port 5000.

      RubyMine automatically suggests port mappings based on the values defined in a corresponding Kubernetes manifest. If the manifest specifies a port already in use on your local machine, RubyMine incrementally increases the suggested value until it finds an available port.

      If the specified value is less than 1024, 8000 is added to the suggested local port value.

      If you manually specify a local port that is currently busy, RubyMine will notify you about it before you start forwarding.

  3. Click Forward.

Forward Ports

Manage port-forwarding sessions

  • To view all active port-forwarding sessions, in the Services tool window, expand Network | Port Forwarding under your Kubernetes cluster.

    List of port-forwarding sessions
  • To terminate a port-forwarding session, right-click it and select Stop Port Forwarding or click Stop port forwarding on the toolbar.

  • To restart a port-forwarding session, right-click it and select Restart Port Forwarding or click Stop port forwarding on the toolbar.

Create secrets

With RubyMine, you can quickly create Kubernetes Secrets.

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Select a cluster and expand Configuration.

  3. Right-click the Secret node and select Create New Secret. Alternatively, select the Secret node and click Add to Bookmarks on the toolbar.

  4. In the Create New Secret window that opens, specify the secret name, type, and namespace. To speed up secret creation, RubyMine adds required data or annotation keys depending on the selected secret type.

  5. In the Data and Annotations section, click Value and enter values for existing keys, or you can click Add icon and choose the way to provide values:

    • Add Manually to manually enter the value.

    • Use File Data to select a file (for example, an SSH key file or a Docker config.json) to use the file contents as the value.

    Create New Secret Window

You can view all your Secrets in the Services tool window, under Configuration. To edit a secret, right-click it and select Edit Secret or click on the toolbar.

Once a Secret is created, you can start typing its name in secretName fields of your Pod configuration file. This will invoke completion for Secret names available in the cluster or in your project.

Keep your cluster information up to date

To keep RubyMine synchronized with your clusters, use the following actions:

  • Reload Configuration to get the latest changes in your kubeconfig file.

  • Refresh Resources to get the latest changes in your Kubernetes resources. This is usually done automatically, provided you have the necessary permissions.

Reload configuration

By default, the configuration is automatically reloaded when you change your kubeconfig file. You can still reload it manually.

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Right-click a cluster and select More | Reload Configuration.

If you want to disable automatic reload, clear the Reload Configuration Automatically option.

You can also check this setting in the IDE settings (Ctrl+Alt+S), in Build, Execution, Deployment | Kubernetes | Reload configuration automatically.

Refresh cluster resources manually

If you have connected to a cluster, any changes you make to its resources will be automatically reflected in the IDE. If your resources are not automatically updated (due to missing rights of your cluster role), there is a message about automatic refresh being forbidden in the Services tool window. In this case, you can refresh resources manually.

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Right-click a group of resources and select Refresh or click Ctrl+F5.

View logs

With RubyMine, you can view cluster logs and logs from selected resources. You can filter them by date, source, and specific values in log messages.

Open resource logs in the editor

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Select the log source in one of the following ways:

    • To view logs for all resources, select your Kubernetes cluster and click Follow Log icon (Follow Log) on the toolbar of the Services tool window.

      View logs
    • To view logs for a particular resource, select the resource and click Follow Log icon (Follow Log) on the toolbar of the Services tool window. Alternatively, right-click a resource and select Follow Log.

      If multiple containers exist in the pod, select the one you want to follow logs for from the displayed list of containers.

      View logs

This will live tail logs of the selected resource with the --follow=true flag and open them in a new editor tag.

Manage logs

When viewing cluster logs or logs from selected resources, you can use the main toolbar (1) or the floating toolbar (2) to work with the log output. The floating toolbar provides quick access to frequently used actions.

Viewing Kubernetes logs
  • Scroll to End icon (Scroll to End): jump to the end of the log output.

  • Soft-Wrap icon (Soft-Wrap): enable soft-wrapping for log entries when the editor is resized.

  • Download Log icon (Download Filtered Logs): download the logs currently opened in the editor, taking into account any filters applied.

  • Clear Logs icon (Clear Displayed Logs): clear the log entries displayed in the editor. This action affects only the current view. When you reopen logs for the same resource, the entries will reappear.

Filter logs

Once you've opened logs, you can refine the log list using the following filters at the top of the editor:

  • (Open Pattern Matching): enter or select values or patterns that you want your log data to match. For example, if level information is present in your logs, you can select warn, error, or other level values to show only logs corresponding to these levels.

  • (Select Log Sources): select your cluster resources for which you want to show logs.

  • (Filter by Date and Time): select a time range for which you want to show logs.

  • (Select Log Fields): select whether you want to show log timestamps, source, and messages.

  • In the input field on top of the editor tab, enter values from log messages. Click to use regular expressions and to make the search case-sensitive.

  • Filter logs
  • (Clear All Log Filters): discard all the applied filters (except sources) and show all logs.

Download logs for a single container

  1. Open the Services tool window: select View | Tool Windows | Services or press Alt+8.

  2. Select a resource and click Download Log icon (Download Log) on the right-side toolbar to save the log file.

Configure log-saving options

You can configure log-saving options in the IDE settings (Ctrl+Alt+S) under Build, Execution, Deployment | Kubernetes | Logs:

  • If you want to save logs in a location other than Scratches, specify a directory in Path to download logs to. Or select Ask where to save log before downloading to prompt you for the location every time you save logs.

  • If you want to include the log timestamp in the filename, select Append timestamp to log file name.

    Custom resource definitions support

    If you extend the Kubernetes cluster with custom resources, RubyMine can validate them with custom resource definition (CRD) specifications.

    Specify the path to CRD specifications

    1. Press Ctrl+Alt+S to open settings and then select Languages & Frameworks | Kubernetes.

    2. Click the Add button and either select a local CRD file or specify a URL. Then click OK.

    Use the Up button and the Down button to rearrange the list of CRD files. This defines the priority for conflicting definitions: RubyMine will use the lowest one if it is defined in more than one file.

    By default, CRDs are applied to the current project only. Change the Scope: option to IDE if you want a certain CRD to be available for any project that you open with this IDE instance.

    To load the CRD from the running Kubernetes cluster, enable Use API schema from the active cluster if available.

    You can view CRDs for the current cluster, including all their applied resources, under the Kubernetes node of the Services tool window.

    The Kubernetes plugin supports CRD files of the following types:

    CustomResourceDefinition files in YAML

    The following example shows a simple CustomResourceDefinition specification for a custom resource stable.example.com/v1 of the kind CronTab. Obligatory fields to identify the resource are metadata.name, spec.group, spec.versions, and spec.names.

    apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: crontabs.stable.example.com # Obligatory field to identify the resource spec: group: stable.example.com # Obligatory field to identify the resource versions: # Obligatory field to identify the resource - name: v1 served: true storage: true scope: Namespaced names: # Obligatory field to identify the resource plural: crontabs singular: crontab kind: CronTab shortNames: - ct validation: openAPIV3Schema: # Schema for validating custom objects properties: spec: properties: cronSpec: type: string pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$' # not supported for validation replicas: type: integer minimum: 1 # not supported for validation maximum: 10 # not supported for validation

    OpenAPI v2.0 schema in JSON

    The following example shows a simple OpenAPI v2.0 schema with a CRD specification for a custom resource sample/v1 of the kind Config. The root definition of the custom resource must contain the x-kubernetes-group-version-kind field with the specified group, version, and kind. In the example, the root.Definition object uses a build property to reference the some.Definition object.

    { "swagger": "2.0", "info": { "title": "Sample Schema", "version": "sample/v1" }, "paths": {}, "definitions": { "some.Definition": { "description": "Example of a definition.", "properties": { "someProperty": { "type": "string" } } }, "root.Definition": { "description": "This is the root definition for the resource", "properties": { "build": { "$ref": "#/definitions/some.Definition" } }, "x-kubernetes-group-version-kind": [ { "group": "sample", "kind": "Config", "version": "v1" } ] } } }

    CRD validation restrictions

    RubyMine does not support the following OpenAPI v3 schema features:

    • multipleOf

    • maximum

    • exclusiveMaximum

    • minimum

    • exclusiveMinimum

    • maxLength

    • minLength

    • pattern

    • maxItems

    • minItems

    • uniqueItems

    • maxProperties

    • minProperties

    • allOf

    • oneOf

    • anyOf

    • not

    • format

    • default

    • nullable

    • readOnly

    • writeOnly

    • xml

    • externalDocs

    • example

    • deprecated

    Productivity tips

    If you use the features described here frequently, the following tips may be helpful:

    Assign shortcuts

    You can assign a keyboard shortcut for Kubernetes actions.

    1. In the Settings dialog (Ctrl+Alt+S) , select Keymap.

    2. Type kubernetes in the search field, then double-click an action to set a shortcut for it.

    Alternatively, you can use the Find Action dialog Ctrl+Shift+A, type the necessary action and, and press Alt+Enter.

    For example, you can assign a shortcut to Interact with Cluster to quickly open the context menu while modifying a resource configuration file.

    Configure code folding

    By default, RubyMine uses code folding to render value references in Helm templates and definitions in Kubernetes configuration files as the actual values. You can click the value to expand it or press Ctrl+NumPad + and Ctrl+NumPad - to toggle folding. If you want to see the references and definitions expanded by default, do the following:

    1. In the Settings dialog (Ctrl+Alt+S) , select Editor | General | Code Folding.

    2. On the Code Folding page, clear the necessary checkboxes:

      • Kubernetes: value references in Helm templates

      • Kubernetes: EnvVar definitions in YAML files

      • Kubernetes: ExecAction definitions in YAML files

    02 September 2025