Cloud Code automatically installs and manages minikube. If
you opted out of dependency management, add the minikube binary to your PATH
.
Before you begin
- Install Git so that Cloud Code can perform Git operations, like cloning a sample.
- 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:
- Open File > New Project.
- Select Cloud Code: Kubernetes.
- Select a template from the list of starter applications.
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.
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:- Select the Run Configuration drop down, and click Edit Configurations.
- Click + Add New Configuration to add a new run configuration.
- Navigate to Cloud Code: Kubernetes
- Enter a name for your new configuration (default is "Unnamed").
- 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
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.
In the Run/Debug configurations dialog for Run > Deployment, select Deploy locally to a minikube cluster.
Click OK to save your configuration.
Run on minikube
- Select Develop on Kubernetes from the configuration dropdown and click the Run icon.
- Cloud Code runs your app in a local minikube cluster.
View the build process in the output window.
When the deployment is successful, you're notified that new service URLs are available
Click the Service URLs tab to view the URLs, then click the URL link to open your browser with your running application
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
- Use file sync and hot reloading to speed up development.
- Debug your application in Cloud Code