client.compute also hands out the configuration needed to reach it: public ingresses, SSH and VNC endpoints, a kubeconfig, and the workspace network configuration.
The examples on this page use a Compute client:
compute.createIngress()
Expose a backend inside the instance to the public internet, usually to serve HTTPS-terminated traffic from a container running in the instance. See Ingress for how Namespace routes and secures this traffic.
Example
API reference
Arguments and options
string
required
The instance that serves the backend.
IngressRequest[]
required
The ingresses to create.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aCreateIngressResponse with allocatedIngresses. Each AllocatedIngress carries the name you requested, the allocated fqdn, and a description.
If the instance does not exist, the call fails with NotFound.
compute.listIngresses()
List the backends exposed from an instance to the public internet. The response includes ingresses created with createIngress() and those exposed declaratively through the Kubernetes ingress manager feature.
Example
API reference
Arguments and options
string
required
The instance to list ingresses for.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aListIngressesResponse with allocatedIngresses.
If the instance does not exist, the call fails with NotFound. If it is already terminated, the call fails with FailedPrecondition.
compute.getSSHConfig()
Return the configuration needed to open an SSH session to the instance. See SSH and remote display for what the session supports.
Example
API reference
Arguments and options
string
required
The instance to provide an SSH configuration for.
string
A container name to connect to. The connection endpoint then targets that container.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aGetSSHConfigResponse.
string
The SSH endpoint to connect to. Use it together with
username.string
The username for the session, as in
ssh <username>@<endpoint>.Uint8Array
When set, a private key that establishes the session. Any key returned here has limited access rights, restricted to a single instance.
NotFound.
compute.getVNCConfig()
Return the configuration needed to reach the instance’s remote display over VNC.
Example
API reference
Arguments and options
string
required
The instance to provide a VNC configuration for.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aGetVNCConfigResponse with the endpoint exposed by the instance ingress, and the username and password to use when the VNC server requires authentication.
If the instance does not exist, the call fails with NotFound. If it exposes no VNC service, the call fails with FailedPrecondition.
The token used to connect to the returned endpoint must also grant access to the instance ingress.
compute.getKubernetesConfig()
Return a kubeconfig for the Kubernetes cluster running inside the instance.
Example
API reference
Arguments and options
string
required
The instance to read the Kubernetes configuration from.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aGetKubernetesConfigResponse with kubeconfig, the configuration kubectl uses to reach Kubernetes inside the instance.
If the instance does not exist, the call fails with NotFound. If it is not running Kubernetes, the call fails with FailedPrecondition.
compute.getNetworkConfiguration()
Return the network configuration of the workspace. Unlike the other methods on this page, it describes the workspace rather than one instance. See Networking for the wider picture.
Example
API reference
Arguments and options
The request has no fields. Pass an empty object.CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aGetNetworkConfigurationResponse whose egress carries egressCidrs. Each entry has a kind, the cidr itself, and the segment it belongs to. Use these ranges when you need to allow Namespace traffic through a firewall.
Related documentation
Create and manage instances
Create instances and start containers to expose.
Ingress
How Namespace routes and secures public traffic.
SSH and remote display
Interactive access to an instance.