-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GCP] Support private IPs for GCP (#2819)
* Add internal IPs and proxy command * Fix schemas * Add config * vpc_name refactor * format * remove remnant * fix API * filter by proxy command * fix region field * Fix tpu pod * Fix internal IP fetching for TPU VM * remove k80 from the resources unordered tests * Address comments * add comment * Add comment * format * Update docs/source/cloud-setup/cloud-permissions/gcp.rst Co-authored-by: Zongheng Yang <[email protected]> * Address comments * improve docs * refactor skypilot_config upload * fix merge issue * fix * Adopt test fixes from #2681 * fix test for quota * longer timeout * Address comments * format --------- Co-authored-by: Zongheng Yang <[email protected]>
- Loading branch information
1 parent
6612301
commit a1b0bd3
Showing
22 changed files
with
381 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,3 +267,60 @@ See details in :ref:`config-yaml`. Example use cases include using a private VP | |
VPC with fine-grained constraints, typically created via Terraform or manually. | ||
|
||
The custom VPC should contain the :ref:`required firewall rules <gcp-minimum-firewall-rules>`. | ||
|
||
|
||
.. _gcp-use-internal-ips: | ||
|
||
|
||
Using Internal IPs | ||
----------------------- | ||
For security reason, users may only want to use internal IPs for SkyPilot instances. | ||
To do so, you can use SkyPilot's global config file ``~/.sky/config.yaml`` to specify the ``gcp.use_internal_ips`` and ``gcp.ssh_proxy_command`` fields (to see the detailed syntax, see :ref:`config-yaml`): | ||
|
||
.. code-block:: yaml | ||
gcp: | ||
use_internal_ips: true | ||
# VPC with NAT setup, see below | ||
vpc_name: my-vpc-name | ||
ssh_proxy_command: ssh -W %h:%p -o StrictHostKeyChecking=no [email protected] | ||
The ``gcp.ssh_proxy_command`` field is optional. If SkyPilot is run on a machine that can directly access the internal IPs of the instances, it can be omitted. Otherwise, it should be set to a command that can be used to proxy SSH connections to the internal IPs of the instances. | ||
|
||
|
||
Cloud NAT Setup | ||
~~~~~~~~~~~~~~~~ | ||
|
||
Instances created with internal IPs only on GCP cannot access public internet by default. To make sure SkyPilot can install the dependencies correctly on the instances, | ||
cloud NAT needs to be setup for the VPC (see `GCP's documentation <https://cloud.google.com/nat/docs/overview>`__ for details). | ||
|
||
|
||
Cloud NAT is a regional resource, so it will need to be created in each region that SkyPilot will be used in. | ||
|
||
|
||
.. image:: ../../images/screenshots/gcp/cloud-nat.png | ||
:width: 80% | ||
:align: center | ||
:alt: GCP Cloud NAT | ||
|
||
To limit SkyPilot to use some specific regions only, you can specify the ``gcp.ssh_proxy_command`` to be a dict mapping from region to the SSH proxy command for that region (see :ref:`config-yaml` for details): | ||
|
||
.. code-block:: yaml | ||
gcp: | ||
use_internal_ips: true | ||
vpc_name: my-vpc-name | ||
ssh_proxy_command: | ||
us-west1: ssh -W %h:%p -o StrictHostKeyChecking=no [email protected] | ||
us-east1: ssh -W %h:%p -o StrictHostKeyChecking=no [email protected] | ||
If proxy is not needed, but the regions need to be limited, you can set the ``gcp.ssh_proxy_command`` to be a dict mapping from region to ``null``: | ||
|
||
.. code-block:: yaml | ||
gcp: | ||
use_internal_ips: true | ||
vpc_name: my-vpc-name | ||
ssh_proxy_command: | ||
us-west1: null | ||
us-east1: null |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,31 @@ Available fields and semantics: | |
# will be added. | ||
vpc_name: skypilot-vpc | ||
# Should instances be assigned private IPs only? (optional) | ||
# | ||
# Set to true to use private IPs to communicate between the local client and | ||
# any SkyPilot nodes. This requires the networking stack be properly set up. | ||
# | ||
# This flag is typically set together with 'vpc_name' above and | ||
# 'ssh_proxy_command' below. | ||
# | ||
# Default: false. | ||
use_internal_ips: true | ||
# SSH proxy command (optional). | ||
# | ||
# Please refer to the aws.ssh_proxy_command section above for more details. | ||
### Format 1 ### | ||
# A string; the same proxy command is used for all regions. | ||
ssh_proxy_command: ssh -W %h:%p -i ~/.ssh/sky-key -o StrictHostKeyChecking=no gcpuser@<jump server public ip> | ||
### Format 2 ### | ||
# A dict mapping region names to region-specific proxy commands. | ||
# NOTE: This restricts SkyPilot's search space for this cloud to only use | ||
# the specified regions and not any other regions in this cloud. | ||
ssh_proxy_command: | ||
us-central1: ssh -W %h:%p -p 1234 -o StrictHostKeyChecking=no [email protected] | ||
us-west1: ssh -W %h:%p -i ~/.ssh/sky-key -o StrictHostKeyChecking=no gcpuser@<jump server public ip> | ||
# Reserved capacity (optional). | ||
# | ||
# The specific reservation to be considered when provisioning clusters on GCP. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.