Using an existing application

If you have an existing project already configured with Kubernetes manifests, a Dockerfile, or Jib to build your images, you can open and use it with the plugin. The only additional configuration necessary is a Skaffold YAML file which either can be generated for you automatically or created using the provided template.

After you're done with configuring your Skaffold YAML, be sure to specify where your container images are stored where the project image is about to be pushed.

Automatic project bootstrapping

If your project has a Dockerfile or is configured for Jib, and has Kubernetes resources, Cloud Code will prompt you with a notification to automatically create this configuration. Once created, your project is ready to use the Cloud Code Kubernetes run and development features.

Alternatively, Tools > Cloud Code > Kubernetes > Add Kubernetes Support can be used to analyze the project Kubernetes resources and generate Skaffold configuration. This includes adding two run configurations: one to run your project on Kubernetes and one for development on a Kubernetes cluster. After support is added, you can immediately start running and debugging your project on Kubernetes using the newly added run configurations.

Manually creating Cloud Code Skaffold configuration

To create a Skaffold YAML manually, follow these instructions to take advantage of the live templating support:

  • Create new file named skaffold.yaml in the root directory of your project (right-click > New > File).
  • Type 'skaffold' and accept the proposed Skaffold live template. Using the Skaffold YAML template
  • Populate the image field with your project image name and the manifests field with a list of the Kubernetes resources you'd like to be deployed from the IDE.

    Example for Dockerfile based builds:

    build:
      artifacts:
        - image: image_name
    deploy:
      kubectl:
        manifests:
          - k8s/web.yaml
          - k8s/backend.yaml
    

    Example build section for Java Maven/Gradle projects with the Jib plugin (deploy section stays the same):

    build:
    artifacts:
    - image: image_name
      jib: {}
    
  • Once your skaffold.yaml is valid, the plugin will prompt you to create Kubernetes run targets automatically.

    Create Kubernetes run target notification

Specifying where container images are stored

Before you deploy your application, you'll need to define a default image repository to use with your project.

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 > Where are the container images stored?.

Default image repository in run configuration being set with the 'gcr.io/' format and being presented autocomplete options based on current project and active cluster

For more on specifying your container image storage preferences, refer to the Configuring container image storage guide.

Getting Support

To send feedback, report issues on GitHub, or ask a question on Stack Overflow.