To run or debug an application on a remote Kubernetes cluster, you'll need to define the container image repository for your project. You can use any image repository provider, including Artifact Registry and Container Registry.
Specify where container images are stored
If you're logged into Google Cloud in your IDE and you have a default project defined, Cloud Code automatically uses your default container image repository gcr.io/PROJECT_ID, where PROJECT_ID references your default project.
If you'd like to update the image repository where the project images are pushed, follow these instructions:
- Open the Command Palette (press
Ctrl
/Cmd
+Shift
+P
) and then run the Cloud Code: Run on Kubernetes command. - Confirm whether to use the current Kubernetes context to run the app in (or switch to a preferred one).
- You are prompted to select an image registry.
Enter the image repository you want to store your images in. If you're using Container Registry, you can browse to an existing registry or specify the name of a registry to create.
If your project has Artifact Registry API enabled and at least one Artifact Registry repository, you can browse to and select an existing Artifact Registry repository.
See the common image repository formats section for examples of how to specify where container images are stored for some common registries.
Image name creation
Cloud Code concatenates the image registry with the image name specified in the Kubernetes manifests to generate the final image repository name.
For more information, see the image registry handling guide.
This choice is stored in your cloudcode.kubernetes
launch configuration
(found in .vscode/launch.json).
Cloud Code builds your containers, pushes them to the registry, applies Kubernetes configurations to the cluster, and waits for the rollout.
Common image repository formats
Here are examples of how to specify where container images are stored for some common registries:
Docker Hub | docker.io/ACCOUNT |
Container Registry | gcr.io/PROJECT_ID |
Artifact Registry | REGION-docker.pkg.dev/PROJECT_ID/REPO_PATH |
AWS Elastic Container Registry (ECR) | AWS_ACCOUNT_ID.dkr.ecr.REGION.amazonaws.com/MY_APP |
Azure Container Registry (ACR) | MY_ACR_NAME.azurecr.io/MY_APP |
What's next
- Create and configure a GKE cluster.
- Learn more about Artifact Registry.