Creating an application

Creating an application using a template

  • Ensure that the plugin is installed and the required dependencies are available on your machine.
  • Begin by cloning a copy of the repository containing the sample application to your local machine:

    git clone https://github.com/GoogleCloudPlatform/cloud-code-samples.git
    
  • Switch to the directory containing the Java Guestbook application:

    cd cloud-code-samples/java/java-guestbook/
    

    This project is a two microservice Kubernetes application that saves logs of names and messages.

  • Open the 'java-guestbook' example project in your IDE, located in the cloud-code-samples/java/java-guestbook directory of the project you just cloned, and wait for it to load.

    Java guestbook directory structure

  • Once the project has loaded, the plugin will detect the Skaffold configuration automatically.

    You'll be prompted to automatically create Kubernetes deployment and continuous development IDE run targets for the project with a notification (also recorded in the Event Log at the bottom right of the IDE). Click 'Create run configurations for Kubernetes with Skaffold' link.

    Create Kubernetes targets notification

  • Now, the new run targets can be used to build the project and deploy (or continuously deploy) it to Kubernetes.

Specifying an image repository

Lastly, you'll need to enable access to the image repository where the project image is about to be pushed.

By default, the project is configured to use Google Container Registry. Once you have your repository set up (Google Container Registry, DockerHub, private repository, etc.), edit the run targets and specify it as a default image repository in run target settings. These are accessible from the Run/Debug configurations dialog on the top taskbar under 'Edit Configurations...' > 'Develop on Kubernetes' > 'Image options' > 'Default image repository'.

Specifying the default image repository in run target settings

Here are examples of how to specify the default image repository for some common registries:

  • Docker Hub: docker.io/{account}
  • GCP Container Repository (GCR): gcr.io/{project_id}
  • AWS Container Repository (ECR): {aws_account_id}.dkr.ecr.{region}.amazonaws.com/{my-app}
  • Azure Container Registry (ACR): {my_acr_name}.azurecr.io/{my-app}

The resulting image name is concatenated from the specified default image repository and the image name from the project's Kubernetes resources. For the 'java-guestbook' example, and GCR image repository as the default one, the resulting full image name would be gcr.io/{project_id}/gcr.io/gcp-dev-tools/java-guestbook.

Getting Support

To send feedback, report issues on GitHub, or ask a question on Stack Overflow.
Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Code for IntelliJ