Use minikube for local development in Cloud Code for IntelliJ

Cloud Code automatically installs and manages minikube. If you opted out of dependency management, add the minikube binary to your PATH.

Before you begin

  1. Install Git so that Cloud Code can perform Git operations, like cloning a sample.
  2. Install the Cloud Code plugin if you haven't already.

Create an application from a template

Cloud Code comes with a collection of code sample templates to get you started quickly. To create a Kubernetes application using an existing sample, follow these steps:

  1. Open File > New Project.
  2. Select Cloud Code: Kubernetes.
  3. Select a template from the list of starter applications.
  4. Pick a name for your project.

    Once you click Finish, Cloud Code will clone your chosen template and open your newly created project for use.

    For Java templates, you'll be prompted to import Maven projects to sync your pom.xml. Click Add as Maven project. Additionally, import necessary Maven projects by clicking Import Changes.

  5. Kubernetes run and development IDE run targets for the project are automatically created and ready to run.

    Optional: Alternatively, you can manually create run targets:

    1. Select the Run Configuration drop down, and click Edit Configurations.
    2. Click + Add New Configuration to add a new run configuration.
    3. Navigate to Cloud Code: Kubernetes
    4. Enter a name for your new configuration (default is "Unnamed").
    5. Click OK to create your run target.

Use your own application

For steps to use an existing project, see use Cloud Code with an existing Kubernetes application.

Set your Kubernetes context

Before running your application, ensure you're set up to deploy your app to your preferred Kubernetes context. You can specify this in your configuration.

If you'd like to switch your current context, you can do so with the Kubernetes Explorer, accessible either from its sidebar panel on the right or using Tools > Cloud Code > Kubernetes > View Cluster Explorer.

To optimize your development loop by quickly picking up file changes of a certain type without having to perform an image rebuild, you can enable file syncing and hot reloading.

Configuration

When using the Cloud Code: Develop on Kubernetes run configuration, you can customize your deployment by configuring available settings.

To add or edit configurations, go to Run > Edit Configurations.

Create and deploy to a minikube cluster

Edit run configuration

  1. Click the configuration drop down in the top taskbar and then click Edit Configurations.

    The Develop on Kubernetes configuration watches for changes, then uses Skaffold to rebuild and rerun your app. You can customize your deployment by making changes to this run configuration or by creating a new Cloud Code: Kubernetes run configuration.

  2. In the Run/Debug configurations dialog for Run > Deployment, select Deploy locally to a minikube cluster.

  3. Click OK to save your configuration.

Run on minikube

  1. Select Develop on Kubernetes from the configuration dropdown and click the Run icon.
  2. Cloud Code runs your app in a local minikube cluster.
  3. View the build process in the output window.

    When the deployment is successful, you're notified that new service URLs are available

  4. Click the Service URLs tab to view the URLs, then click the URL link to open your browser with your running application

  5. To stop the application, click the stop icon next to the configuration dropdown.

Create and add a cluster from another cloud provider

If you're using an on-premises cluster or a cluster from another provider such as Azure or AWS, use the provider's tools to create the cluster and add it to your KubeConfig.

Work with other local clusters

In addition to minikube, you can work with Cloud Code if you're using Docker Desktop (for Mac or Windows).

To get Cloud Code working with a local cluster, make sure that your default configuration (for example, ~/.kube/config) contains your local cluster. This cluster must be set as the current context.

For example, if you were using a local cluster, docker-for-desktop, with Docker Desktop, set your preferred cluster by running the following command:

kubectl config use-context docker-for-desktop

What's next

Get support

To submit feedback or report an issue in your IntelliJ IDE, go to Tools > Cloud Code > Help / About > Submit feedback or report an issue to report an issue on GitHub, or ask a question on Stack Overflow.