With Cloud Code, you can create a Kubernetes cluster with Google Kubernetes Engine (GKE).
Create a GKE cluster and add it to your KubeConfig
To create a cluster:
- Click Cloud Code and then expand the Kubernetes explorer.
- Click add Add a Cluster to the KubeConfig.
- Select Google Kubernetes Engine and then select Yes to enable the Google Kubernetes Engine API in your project.
- Choose Standard or Autopilot. For more information, see Comparing Autopilot and Standard modes.
- If prompted, click Open to permit Cloud Code to open the Google Cloud console.
- In Google Cloud console, choose any configuration options that you want to customize and then click Create.
- After the cluster is created, in Cloud Code, click the Refresh icon.
- After the name of your new cluster appears in the list, click the cluster name. Your new cluster is added to your kubeconfig and set as the default context.
Tip: To create a Kubernetes cluster using the command palette, launch the
command palette (press Ctrl
/Cmd
+Shift
+P
or click View >
Command Palette) and then run the Cloud Code: Create GKE cluster
command.
Work with an existing GKE cluster
If you have an existing Standard or Autopilot GKE cluster, you can set it as your active cluster and work with it using Cloud Code.
- Click Cloud Code and then expand the Kubernetes explorer.
- Click add Add a Cluster to the KubeConfig.
- Click Google Kubernetes Engine.
- Click your cluster name. Your cluster is added to the KubeConfig.
Set a cluster as the default context
The active cluster is the cluster that your application is deployed to by default.
- Click Cloud Code and then expand the Kubernetes explorer.
- Right-click a cluster and then click Set as Active Cluster.
Run an application on GKE
To run or debug an application on GKE, you'll need to define the container image repository for your project.
When attempting to debug, you may be prompted to authenticate your credentials to run and debug an application locally.
To learn more, see get started with Cloud Code for Kubernetes
Remove a cluster from your KubeConfig
After you remove a cluster from your KubeConfig, the cluster is not available to deploy to.
- Click Cloud Code and then expand the Kubernetes explorer.
- Right-click a cluster and then click Remove Context Under Cluster.
Open an interactive terminal to a container
- Click Cloud Code and then expand the Kubernetes explorer.
- Expand your minikube cluster, expand Pods, and then expand Containers.
- Right-click a container and then click Get Terminal.
Open an external IP address
- Click Cloud Code and then expand the Kubernetes explorer.
- Expand your minikube cluster and then expand Services.
- Expand External IPs, right-click an IP address, and then click Open Address.
- Click Open.
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.
What's next
- Organize your cluster access using kubeconfig files.
- Learn how to add, delete or switch between your kubeconfig files in Cloud Code.
- Develop and debug parts of a microservice application using Skaffold.
- Use file sync and hot reloading to speed up development.
- Debug your application in Cloud Code.