# Kubernetes

[Kubernetes](https://kubernetes.io/) is a container orchestration engine for the deployment, scaling, and management of containerized applications. Install and enable the Kubernetes plugin for IntelliJ IDEA to add the following features for managing your Kubernetes cluster:

* Coding assistance for [Kubernetes resource configuration files](https://kubernetes.io/docs/concepts/configuration/overview/).

* Coding assistance for [Helm](https://helm.sh/) charts and templates. For more details, refer to the [dedicated Helm page](helm.html).

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

* Coding assistance for [Kustomize](https://kustomize.io/) 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 IntelliJ IDEA: use the [Services](services-tool-window.html#kubernetes) 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.26 to 1.34 (you can [select the applicable version](#api-version-setting)).

> **Note:**
> The kubectl tool is required for communicating with a Kubernetes cluster. If you use Kubernetes features in IntelliJ IDEA (for example, [add a cluster](#add-cluster) to the Services tool window) but kubectl is not installed on your computer, a notification will appear, providing you with the option to download and install the latest stable version of it.
>
>
>
> The kubectl executable will be installed in `/usr/local/bin` (on macOS and Linux) or `<home>\.jetbrains` (on Windows).

Procedure: Enable the Kubernetes plugin

This functionality relies on the [Kubernetes](https://plugins.jetbrains.com/plugin/10485-kubernetes)  plugin, which  is bundled and enabled in IntelliJ IDEA   by default. If the relevant features are not available, make sure that you did not disable the plugin.

> **Note:**
> The Kubernetes plugin is not available in IntelliJ IDEA without the Ultimate subscription.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Plugins`.

2. Open the Installed tab, find the Kubernetes plugin, and select the checkbox next to the plugin name.

Procedure: Specify a custom path to kubectl

IntelliJ IDEA uses the default kubectl (and [helm if you use it](helm.html)) 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` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), 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 IntelliJ IDEA will download and install missing software.

Procedure: Use custom Kubernetes configuration files

Information about clusters is stored in a kubeconfig file. IntelliJ IDEA detects the default kubeconfig file, which is usually `$HOME/.kube/config` (this location can be changed by the `KUBECONFIG` environment variable). If you want IntelliJ IDEA 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` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), select `Build, Execution, Deployment | Kubernetes` .

2. Under Additional Kubeconfig Paths, click ![Add kubeconfig](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) 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, IntelliJ IDEA validates its syntax and reports errors, if any.

![Kubeconfig Configuration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_kubeconfig_validate.png)

> **Tip:**
> Besides kubeconfig files specified in the IDE settings, you can also [add clusters from other custom kubeconfig files](#add-cluster) and from the clipboard.

Procedure: Configure the Kubernetes API version

IntelliJ IDEA provides [completion](auto-completing-code.html) 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.26 to 1.34. By default, IntelliJ IDEA 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` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), select `Build, Execution, Deployment | Kubernetes`.

2. Update the Kubernetes API version option 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](auto-completing-code.html) | Supported | Supported |
|    [Quick documentation](viewing-reference-information.html#inline-quick-documentation)  | Supported | Supported |
|  [Inspections and quick                             fixes](code-inspection.html)   |      * 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](using-live-templates.html) |    Predefined templates for common resource kinds    | No predefined live templates |
|  [Smart completion](advanced-code-completion.html#invoke_smart_completion)   | Supported | Not supported |
| [Custom resource definitions](#crd) | 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 |

IntelliJ IDEA 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 fields are present in a YAML or JSON file, IntelliJ IDEA will mark the file with the corresponding Kubernetes icon and enable all available features.

Procedure: Create a resource file

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

1. In the   Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))) , right-click a folder, select New or press `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Ctrl+N` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Ctrl+N` (Visual Studio), `⌘ N` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS)), 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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_new_resource.png)

This will create a new file with its contents based on the selected [file template](using-file-and-code-templates.html) Learn more in [file template](using-file-and-code-templates.html).

Alternatively, in YAML files, you can use predefined [live templates](using-live-templates.html), 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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_live_templates.png)

> **Tip:**
> To view the list of all live templates for Kubernetes resources, edit them or create new ones, open the Settings dialog `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)), select `Editor | Live Templates`, and expand the Kubernetes group in the list.

When you open a Kubernetes resource file in the editor, IntelliJ IDEA displays [inlay hints](inlay-hints.html) and a toolbar with the most popular actions, including:

1. The floating toolbar where you can:

* Select the current cluster and namespace

* ![Apply icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.actions.deploy.svg) Apply the changes and deliver them to the current cluster

* ![Delete icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.actions.undeploy.svg) Delete the resource

* ![Compare icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.vcs.diff.svg) Compare the changes with the cluster version

* ![Reload icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.refresh.svg) Reload content from the cluster

![Floating toolbar](https://resources.jetbrains.com.cn/help/img/idea/2026.2/k8s-floating-toolbar.png)

2. Inlay hints to check the [statuses of deployed resources](#view-resource-info)

3. Inlay hints to [reveal and copy values of referenced secrets](#inlay-hints-secrets)

4. Inlay hints to [forward ports](#forward-ports)

![Hints in Kubernetes manifests](https://resources.jetbrains.com.cn/help/img/idea/2026.2/k8s-yaml-editor-hints.png)

> **Tip:**
> You can change the appearance of inlay hints to display only icons. Right-click an inlay hint and select the Icons only option from the context menu. Deselect the option to bring back the default appearance with captions.

Procedure: Configure the floating toolbar appearance

You can configure when to display the floating toolbar in the editor.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Build, Execution, Deployment | Kubernetes`.

2. Use the Show floating toolbar in editor option to choose when the floating toolbar appears:

* Always

* When mouse moves

* Don't show

Alternatively, you can right-click the floating toolbar and select the required option.

Procedure: Disable Kubernetes schema validation

IntelliJ IDEA 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](services-tool-window.html) tool window to view your cluster, switch between namespaces, and modify the cluster resources.

Procedure: Add clusters

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

1. Open the [Services](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

2. Right-click the Kubernetes node in the Services tool window and select Add Clusters. Alternatively, click ![the Add button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.add.svg) 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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_select_context_source.png)

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

![Add Clusters window](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_add_context_from_clipboard.png)

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

Procedure: 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](#cluster_resources) in the editor.

1. Open the [Services](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

2. If you do not have clusters in the Services tool window, [add a cluster](#add-cluster).

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

![Connect cluster](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_connect_cluster.png)

Procedure: Edit kubeconfig

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

1. Open the [Services](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

2. Select a cluster and click ![Open kubeconfig File in Editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/clouds-kubernetes.icons.kubernetes_Y.svg) (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](#multiple-kubeconfig).

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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_reload_configuration.png)

> **Tip:**
> By default, the maximum kubeconfig file size is limited to 10 MB. You can change this limit in `Settings | Advanced Settings | Kubernetes | Maximum size of kubeconfig file to load in megabytes`.

Procedure: Switch between namespaces

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

1. Open the [Services](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

2. Right-click your cluster or any resource, select Namespaces (or click ![The Namespace icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/clouds-kubernetes.icons.newui.namespace.svg) on the toolbar), and select the required namespace.

To view resources of all namespaces, select All Namespaces.

![Namespaces context menu](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_switch_namespaces.png)

> **Tip:**
> If you want some of the namespaces to be displayed on top of the list, you can mark them as favorite by clicking ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.nodes.notFavoriteOnHover.svg).

> **Note:**
> If you don't have access to namespace resources due to the role-based access control, you can set up your custom namespace in `Build, Execution, Deployment | Kubernetes | Cluster Interaction | Additional namespaces`. You can also quickly open this setting via the Customize Namespaces action, which is available if namespaces cannot be loaded from the cluster.

Procedure: 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](#create_resource_file), you can select the cluster to which to apply the resource by clicking ![select context](https://resources.jetbrains.com.cn/help/img/idea/2026.2/clouds-kubernetes.icons.newui.configuration.svg) or using the [floating toolbar](#floating-toolbar). You can also choose it in advance.

1. Open the [Services](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

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

![Set Current Cluster](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_set_current_cluster_in_services.png)

Alternatively, select a cluster and click ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.locate.svg) on the toolbar.

Procedure: Create a resource in the cluster

After [creating a resource file](#create_resource_file), you can create a corresponding resource in the cluster.

1. Open the required resource file in the editor. If the current cluster is not set, select it using the [floating toolbar](#floating-toolbar).

![Set Current Cluster](https://resources.jetbrains.com.cn/help/img/idea/2026.2/set_current_cluster_toolbar.png)

If necessary, you can also select a namespace from the list.

2. Click ![Apply icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.actions.deploy.svg) to apply changes to the current cluster and namespace.

Procedure: Modify cluster resources

1. Open the [Services](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

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

This will open the manifest of a 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.

3. Make sure the current cluster is selected on the [floating toolbar](#floating-toolbar) and click ![Apply icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.actions.deploy.svg) to apply the changes.

> **Note:**
> Changing some of the Kubernetes object fields may result in the creation of new objects. For example, if you change the resource name, applying this change will create a new resource. Or, if you change the namespace, applying this change will create a new resource in the specified namespace.

Procedure: View resource details

IntelliJ IDEA 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.

* IntelliJ IDEA displays the live status of a deployed Kubernetes resource directly in the editor. For example, when you open a Deployment manifest, status indicators appear next to the `replicas` field, displaying how many pods are currently running, pending, or failed.

![Pod statuses in a Kubernetes deployment file](https://resources.jetbrains.com.cn/help/img/idea/2026.2/replicas-inlay-hints.png)

You can check the statuses of individual pods and jobs next to the name field in respective manifests.

If an error occurs and a resource fails, IntelliJ IDEA displays the Open logs link that lets you quickly navigate to the relevant log entry describing the problem.

![Open logs link](https://resources.jetbrains.com.cn/help/img/idea/2026.2/k8s-error-open-logs.png)

Procedure: 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.

* In the Services tool window, select a resource and click ![Delete resource](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.delete.svg) (Delete Resource) on the toolbar.

* If the resource YAML file is opened in the editor, select the current cluster on the floating toolbar it and click ![Delete resource](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.actions.undeploy.svg).

* If the resource YAML file is opened, right-click anywhere in the editor and select Delete (Current Cluster Not Configured) if no cluster is selected on the floating toolbar, or Delete from Cluster "cluster_name" and Namespace "namespace_name" if one is selected.

### 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. IntelliJ IDEA 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 IntelliJ IDEA), stop and restart forwarding sessions.

Procedure:

1. You can configure port forwarding using one of the following ways:

* Open the [Services](services-tool-window.html) tool window: select `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)). Right-click a target pod and select Forward Ports.

* Click the Forward Ports inlay hint in a Kubernetes manifest. IntelliJ IDEA displays the inlay hint if a destination port is specified (for example, as a value of `containerPort`). ![Forward Ports inlay hint](https://resources.jetbrains.com.cn/help/img/idea/2026.2/forward_port_inlay_hint.png)

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`. IntelliJ IDEA 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, IntelliJ IDEA 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, IntelliJ IDEA will notify you about it before you start forwarding.

3. Click Forward.

![Forward Ports](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_forward_ports_dialog.png)

Procedure: 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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_forward_ports_services_tool_window.png)

> **Tip:**
> Next to each port-forwarding session, IntelliJ IDEA displays a badge representing its current state.

* To terminate a port-forwarding session, right-click it and select Stop Port Forwarding or click ![Stop port forwarding](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.stop.svg) on the toolbar.

* To restart a port-forwarding session, right-click it and select Restart Port Forwarding or click ![Stop port forwarding](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.resume.svg) on the toolbar.

### Create secrets

With IntelliJ IDEA, you can quickly create Kubernetes [Secrets](https://kubernetes.io/docs/concepts/configuration/secret/).

Procedure:

1. Open the [Services](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

2. Select a cluster and expand Additional Kubeconfig Paths.

3. Right-click the Secret node and select Create New Secret. Alternatively, select the Secret node and click ![Add to Bookmarks](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.bookmarks.addBookmarksList.svg) on the toolbar.

4. In the Create New Secret window that opens, specify the secret name, type, and namespace. To speed up secret creation, IntelliJ IDEA adds required data or annotation keys depending on the selected [secret type](https://kubernetes.io/docs/concepts/configuration/secret/#secret-types).

5. In the Data and Annotations section, click Value and enter values for existing keys, or you can click ![Add icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) 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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_create_secret_window.png)

You can view all your Secrets in the Services tool window, under Additional Kubeconfig Paths. To edit a secret, right-click it and select Edit Secret or click ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.edit.svg) 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.

When working with YAML files that reference secrets, IntelliJ IDEA provides [inlay hints](inlay-hints.html) with the actions that help you quickly inspect or reuse secret values.

* Show: Reveals the decoded value of the referenced secret in a popup.

* Copy: Copies the decoded secret value to your clipboard for temporary use.

![Inlay hints to reveal and copy Kubernetes secrets](https://resources.jetbrains.com.cn/help/img/idea/2026.2/reveal-copy-k8s-secret.png)

Both actions access and display the real value defined in the secret, rather than the encoded or placeholder text in YAML.

If your account lacks sufficient permissions, clicking the button displays a corresponding tooltip. This prevents accidental exposure of restricted data.

### Keep your cluster information up to date

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

* [Reload Configuration](#reload-configuration) to get the latest changes in your kubeconfig file.

* [Refresh Resources](#refresh-cluster) to get the latest changes in your Kubernetes resources. This is usually done automatically, provided you have the necessary permissions.

Procedure: 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](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

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` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), in `Build, Execution, Deployment | Kubernetes | Cluster Interaction | Reload configuration automatically` .

Procedure: Refresh cluster resources manually

If you have [connected to a cluster](#connect-to-the-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](https://kubernetes.io/docs/reference/access-authn-authz/rbac/)), 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](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

2. Right-click a group of resources and select Refresh or click `Ctrl+F5` (Windows), `⌘ R` (macOS), `⌃ F5` (IntelliJ IDEA Classic (macOS)), `⌘ R` (macOS System Shortcuts), `Ctrl+F5` (XWin), `Ctrl+F5` (GNOME), `Ctrl+5` (KDE), `Ctrl+F5` (Emacs), `Ctrl+F5` (Sublime Text), `⌘ R` (Sublime Text (macOS)), `Ctrl+F5` (NetBeans), `Ctrl+Alt+R` (Visual Studio), `⌘ ⌥ R` (Visual Studio (macOS)), `Ctrl+F5` (Eclipse), `Ctrl+F5` (Eclipse (macOS)).

> **Tip:**
> Use the [kubectl auth can-i](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/kubectl_auth_can-i/) command to check your access rights. For example, to check if you are allowed to manually get information about pods (required for the Refresh action), run:
>
>
>
>
> ```SHELL
> kubectl auth can-i get pods
> ```
>
>
>
> To check if you are allowed to get automatic updates on pods, run:
>
>
>
>
> ```SHELL
> kubectl auth can-i watch pods
> ```

## View logs

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

Procedure: Open resource logs in the editor

1. Open the [Services](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/clouds-kubernetes.icons.newui.showLogs.svg) (Follow Log) on the toolbar of the Services tool window. ![View logs](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_view_all_cluster_logs.png)

* To view logs for a particular resource, select the resource and click ![Follow Log icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/clouds-kubernetes.icons.newui.showLogs.svg) (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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/kubernetes_follow_logs_new.png)

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

Procedure: 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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/view_k8s_logs.png)

* ![Scroll to End icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.scrollDown.svg) (Scroll to End): jump to the end of the log output.

* ![Soft-Wrap icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.softWrap.svg) (Soft-Wrap): enable soft-wrapping for log entries when the editor is resized.

* ![Download Log icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.download.svg) (Download Filtered Logs): download the logs currently opened in the editor, taking into account any [filters applied](#filter-logs).

* ![Clear Logs icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.delete.svg) (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.

Procedure: Filter logs

Once you've [opened logs](#open-logs), you can refine the log list using the following filters at the top of the editor:

* ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.toolwindows.changes.svg) (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.

* ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.filter.svg) (Select Log Sources): select your cluster resources for which you want to show logs.

* ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.history.svg) (Filter by Date and Time): select a time range for which you want to show logs.

* ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.show.svg) (Select Log Fields): select whether you want to show log timestamps, source, and messages.

> **Tip:**
> You can configure the visibility of log fields globally in the IDE settings (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))) under `Build, Execution, Deployment | Kubernetes | Logs | Default log fields`.

* In the input field on top of the editor tab, enter values from log messages. Click ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.inline.regex.svg) to use regular expressions and ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.inline.matchCase.svg) to make the search case-sensitive.

* ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.actions.clearCash.svg) (Clear All Log Filters): discard all the applied filters (except sources) and show all logs.

* You can define regular-expression-based highlighting rules for log entries to identify and distinguish important messages, such as errors, warnings, and informational events. In the IDE settings (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))) under `Build, Execution, Deployment | Kubernetes | Logs`, use the Filters table to create and manage rules. For each filter, you can specify a regex pattern and customize its appearance by enabling Bold, Italic, and selecting a color.

Procedure: Download logs for a single container

1. Open the [Services](services-tool-window.html) tool window: go to `View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS)).

2. Select a resource and click ![Download Log icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.download.svg) (Download Log) on the right-side toolbar to save the log file.

Procedure: Configure log options

You can configure log options in the IDE settings (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))) under `Build, Execution, Deployment | Kubernetes | Logs` :

* If you want to save logs automatically in a location other than [Scratches](scratches.html), specify a directory in Save logs to. Or select Ask where to save log before downloading to prompt you to the location every time you save logs. To include the log timestamp in the filename, select Append timestamp to log file name.

* If you want to remove ANSI color and formatting codes from Kubernetes logs and display them as plain text, select Strip ANSI codes from logs.

* Using the Show cluster events in option, you can choose where to display the log output: in the editor or in the Services tool window.

* The default log cache size is 300 MB. The IDE notifies you when you exceed this limit. If you want to change the threshold for these notifications, enter the desired value in Warn when log cache exceeds.

* To adjust the frequency of log updates in the editor, specify the delay in milliseconds in Log editor update delay in milliseconds.

## Custom resource definitions support

If you extend the Kubernetes cluster with [custom resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/), IntelliJ IDEA can validate them with custom resource definition (CRD) specifications.

Procedure: Specify the path to CRD specifications

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Build, Execution, Deployment | Kubernetes | Schemas`.

2. In the CRD and OpenAPI Specifications table, click ![the Add button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) and either select a local CRD file or specify a URL. Then click OK.

Use ![the Up button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.moveUp.svg) and ![the Down button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.moveDown.svg) to rearrange the list of CRD files. This defines the priority for conflicting definitions: IntelliJ IDEA 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.

> **Note:**
> When you apply changes, IntelliJ IDEA automatically downloads newly added CRDs from the specified URLs. It will download other modified CRDs only as the model reloads, which happens whenever you open the project or change other Kubernetes settings (for example, the order of CRDs), and it has been more than three hours since the last model reload. If it has been less than three hours since the last model reload, you can force a reload on the current model using the Reset Schema Cache button.

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

> **Tip:**
> By default, the maximum size of a CRD file is limited to 50 MB. You can change this limit in `Settings | Advanced Settings | Kubernetes | Maximum size of CRD YAML file to load`.

You can view CRDs for the current cluster, including all their applied resources, under the Kubernetes node of the [Services](services-tool-window.html#kubernetes) tool window.

The Kubernetes plugin supports CRD files of the following types:

### CustomResourceDefinition files in YAML

The following example shows a simple [CustomResourceDefinition](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/) 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`.

> **Note:**
> Currently, not all fields from the OpenAPI schema can be used for validation (see `pattern`, `minimum`, and `maximum` fields under `validation.openAPIV3Schema` in the example). For more information, refer to [CRD validation restrictions](#restrictions).

```YAML
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](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) 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.

```JSON
{
    "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

IntelliJ IDEA 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:

Procedure: Assign shortcuts

You can assign a keyboard shortcut for Kubernetes actions.

1. In the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), 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` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)), type the necessary action and, and press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)).

For example, you can assign a shortcut to Interact with Cluster to quickly open the context menu while [modifying](#cluster_resources) a resource configuration file.

Procedure: Configure code folding

By default, IntelliJ IDEA uses [code
folding](working-with-source-code.html#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 +` (Windows), `⌘ NumPad +` (macOS), `⌘ NumPad +` (IntelliJ IDEA Classic (macOS)), `⌘ NumPad +` (macOS System Shortcuts), `Ctrl+NumPad +` (XWin), `Ctrl+NumPad +` (GNOME), `Ctrl+NumPad +` (KDE), `Ctrl+NumPad +` (Emacs), `Ctrl+Shift+]` (Sublime Text), `⌘ ⌥ ]` (Sublime Text (macOS)), `Ctrl+NumPad +` (NetBeans), `Ctrl+M, E` (Visual Studio), `⌃ M, E` (Visual Studio (macOS)), `Ctrl+NumPad +` (Eclipse), `⌘ NumPad +` (Eclipse (macOS)) and `Ctrl+NumPad -` (Windows), `⌘ NumPad -` (macOS), `⌘ NumPad -` (IntelliJ IDEA Classic (macOS)), `⌘ NumPad -` (macOS System Shortcuts), `Ctrl+NumPad -` (XWin), `Ctrl+NumPad -` (GNOME), `Ctrl+NumPad -` (KDE), `Ctrl+NumPad -` (Emacs), `Ctrl+Shift+[` (Sublime Text), `⌘ ⌥ [` (Sublime Text (macOS)), `Ctrl+NumPad -` (NetBeans), `Ctrl+M, S` (Visual Studio), `⌃ M, S` (Visual Studio (macOS)), `Ctrl+NumPad -` (Eclipse), `⌘ NumPad -` (Eclipse (macOS)) 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` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), 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

