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:
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-guestbookdirectory of the project you just cloned, and wait for it to load.
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.
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'.
Here are examples of how to specify the default image repository for some common registries:
- Docker Hub:
- GCP Container Repository (GCR):
- AWS Container Repository (ECR):
- Azure Container Registry (ACR):
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