From f3b6afccb5122f110c6e00b93b51f666289b7bf1 Mon Sep 17 00:00:00 2001 From: hemildesai Date: Thu, 18 Jan 2024 00:01:36 -0800 Subject: [PATCH 1/4] Add docs for opening ports on Kubernetes --- docs/source/reference/config.rst | 28 ++++++- docs/source/reference/kubernetes/index.rst | 2 +- .../reference/kubernetes/kubernetes-ports.rst | 84 +++++++++++++++++++ 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 docs/source/reference/kubernetes/kubernetes-ports.rst diff --git a/docs/source/reference/config.rst b/docs/source/reference/config.rst index de6eb2a0da9..d35eb24f564 100644 --- a/docs/source/reference/config.rst +++ b/docs/source/reference/config.rst @@ -173,6 +173,33 @@ Available fields and semantics: # is used as default if 'networking' is not specified. networking: portforward + # The mode to use for opening ports on Kubernetes + # + # This must be either: 'ingress' or 'loadbalancer'. If not specified, + # defaults to 'loadbalancer'. + # + # ingress: This requires an ingress controller to be configured on the + # Kubernetes cluster. The ingress controller will be used to open ports on + # the cluster. Currently, only the NGINX ingress controller is supported. + # Refer to https://kubernetes.github.io/ingress-nginx/ for details on + # configuring the NGINX ingress controller. This mode creates an ingress and a + # ClusterIP service for each port opened. The port can be accessed externally + # using the Ingress URL plus a path prefix of the form + # /skypilot/{cluster_name_on_cloud}/{port} + # Refer to kubernetes-ingress.yml.j2 for the exact template. + # + # loadbalancer: This mode is supported for all Kubernetes clusters that support + # the LoadBalancer service type. This mode creates a single LoadBalancer service for + # all ports opened. The port can be accessed externally using the service's external IP + # plus the specific port you want to access. The external IP generally takes some time + # to be assigned so there might be a slight delay before the port can be accessed. + # + # You can get the endpoint for any port opened using the following command: + # sky status {cluster_name} --endpoint {port} + # or list the endpoints for all ports opened using: + # sky status {cluster_name} --endpoints + ports: loadbalancer + # Advanced OCI configurations (optional). oci: # A dict mapping region names to region-specific configurations, or @@ -193,4 +220,3 @@ Available fields and semantics: us-ashburn-1: vcn_subnet: ocid1.subnet.oc1.iad.aaaaaaaafbj7i3aqc4ofjaapa5edakde6g4ea2yaslcsay32cthp7qo55pxa - diff --git a/docs/source/reference/kubernetes/index.rst b/docs/source/reference/kubernetes/index.rst index d1214723d46..9621776db27 100644 --- a/docs/source/reference/kubernetes/index.rst +++ b/docs/source/reference/kubernetes/index.rst @@ -151,7 +151,7 @@ Kubernetes support is under active development. Some features are in progress an * Auto-down - ✅ Available * Storage mounting - ✅ Available on x86_64 clusters * Multi-node tasks - ✅ Available -* Opening ports and exposing services - 🚧 In progress +* Opening ports and exposing services - :ref:`✅ Available ` * Custom images - 🚧 In progress * Multiple Kubernetes Clusters - 🚧 In progress diff --git a/docs/source/reference/kubernetes/kubernetes-ports.rst b/docs/source/reference/kubernetes/kubernetes-ports.rst new file mode 100644 index 00000000000..09c4526c83d --- /dev/null +++ b/docs/source/reference/kubernetes/kubernetes-ports.rst @@ -0,0 +1,84 @@ +.. _kubernetes-ports: + +Ports on Kubernetes +======================== + + +.. note:: + This is a guide on how to configure an exisiting Kubernetes cluster (along with the caveats involved) + in order to successfully expose ports and services externally through SkyPilot. + + If you are a SkyPilot user and your cluster has already been set up to expose ports, + :ref:`Opening Ports ` explains how to open ports through SkyPilot. + +SkyPilot's Kubernetes Ports support is designed to be flexible to work with a wide variety of Kubernetes clusters. +Additionally, it uses the established Kubernetes Networking model and APIs internally. +Please refer to the official `Kubernetes Networking documentation `_ for more details. +Currently, SkyPilot supports two modes to expose ports: + +* :ref:`Load Balancer ` +* :ref:`Ingress ` + +.. _loadbalancer: + + +Load Balancer +^^^^^^^^^^^^^ + +This mode exposes ports through a Kubernetes `LoadBalancer `_ Service. +To use this mode, you must have a Kubernetes cluster that supports LoadBalancer Services. +Most of the cloud based Kubernetes providers support this mode out of the box, but do ensure that your cluster supports it before proceeding. +If you have a bare metal cluster, `MetalLB `_ can be used to support LoadBalancer Services. +When using this mode, SkyPilot will create a single LoadBalancer Service for all ports that you expose. +Refer to `kubernetes-loadbalancer.yml.j2` for the exact template that creates Kubernetes resources using this mode. +Each port can be accessed using the LoadBalancer's external IP address and the port number. +:ref:`sky status ` can be used to view the external endpoints for each/all ports. + +This mode in most cloud based Kubernetes clusters creates an external Load Balancer. For instance, +GKE creates a pass-through Load Balancer (see `here `_) +and AWS creates a Network Load Balancer (see `here `_). +This generally incurs an extra cost, so please check with your cloud provider for pricing details. +Currently, the load balancer pricing is not taken into account by SkyPilot. + +.. note:: + This is the default mode used in SkyPilot config for opening ports. + See the kubernetes section in :ref:`SkyPilot Config ` for more details. + +.. note:: + The default LoadBalancer implementation in EKS selects a random port from the list of opened ports for the + LoadBalancer's health check. This can cause issues if the selected port does not have a service running behind it. + For example, a SkyPilot task can expose 5 ports but only 2 of them have services running behind them. + Then, if EKS selects a port that does not have a service running behind it, the LoadBalancer will not pass the healthcheck + and won't be able to assign an external IP address successfully. + +.. note:: + This mode is currently not supported when using a kind cluster created using `sky local up`. + +.. _ingress: + + +Ingress +^^^^^^^ + +This mode exposes ports through a Kubernetes `Ingress `_. +In order to use this mode, manual configuration is needed on the Kubernetes cluster. +This generally involves installing an Ingress Controller. +Currently, SkyPilot only supports the NGINX Ingress Controller. Refer to its `documentation `_ for installation instructions. +When using this mode, SkyPilot creates an ingress resource and a ClusterIP service for each port opened. +The port can be accessed externally by using the Ingress URL plus a path prefix of the form /skypilot/{cluster_name_on_cloud}/{port}. +Refer to `kubernetes-ingress.yml.j2` for the exact template that creates Kubernetes resources using this mode. +Once again, :ref:`sky status ` can be used to view the external endpoints for each/all ports. + +Since this mode exposes a port under a sub path, it runs into issues when the service running behind the port +expects to be accessed at the root path. For example, if the service running behind the port is a Jupyter server, +it expects assets to be present at the root path. Currently, we do not have a solution for this issue. +Please use the :ref:`LoadBalancer ` mode if you run into this issue. + +.. note:: + To use this mode, you need to first install the ingress controller then update the SkyPilot config. + Generally, you will have to set `ports: ingress` in the kubernetes section of the SkyPilot config. + See :ref:`SkyPilot Config ` for more details. + +.. note:: + Currently, SkyPilot does not support opening ports on a Kubernetes cluster using the `Gateway API `. + If you are interested in this feature, please reach out to us. From 7546754c7b1f757aed5db384c3dfbd2a8452c673 Mon Sep 17 00:00:00 2001 From: Romil Bhardwaj Date: Mon, 29 Jan 2024 14:07:23 -0800 Subject: [PATCH 2/4] update config.rst --- docs/source/reference/config.rst | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/docs/source/reference/config.rst b/docs/source/reference/config.rst index d35eb24f564..454e0f3dcc1 100644 --- a/docs/source/reference/config.rst +++ b/docs/source/reference/config.rst @@ -178,26 +178,28 @@ Available fields and semantics: # This must be either: 'ingress' or 'loadbalancer'. If not specified, # defaults to 'loadbalancer'. # - # ingress: This requires an ingress controller to be configured on the - # Kubernetes cluster. The ingress controller will be used to open ports on - # the cluster. Currently, only the NGINX ingress controller is supported. - # Refer to https://kubernetes.github.io/ingress-nginx/ for details on - # configuring the NGINX ingress controller. This mode creates an ingress and a - # ClusterIP service for each port opened. The port can be accessed externally - # using the Ingress URL plus a path prefix of the form - # /skypilot/{cluster_name_on_cloud}/{port} - # Refer to kubernetes-ingress.yml.j2 for the exact template. - # - # loadbalancer: This mode is supported for all Kubernetes clusters that support - # the LoadBalancer service type. This mode creates a single LoadBalancer service for - # all ports opened. The port can be accessed externally using the service's external IP + # loadbalancer: Creates services of type `LoadBalancer` to expose ports. + # See https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer. + # This mode is supported for all Kubernetes clusters that support + # the LoadBalancer service type (e.g., GKE, EKS and other cloud hosted k8s) + # This mode creates a single LoadBalancer service for all ports opened. + # The port can be accessed externally using the service's external IP # plus the specific port you want to access. The external IP generally takes some time # to be assigned so there might be a slight delay before the port can be accessed. # + # ingress: Creates an ingress and a ClusterIP service for each port opened. + # Requires an ingress controller to be configured on the Kubernetes cluster. + # Currently, only the NGINX ingress controller is supported. + # Refer to https://kubernetes.github.io/ingress-nginx/deploy/ for details on + # deploying the NGINX ingress controller. In this mode, the port can be + # accessed externally using the Ingress URL plus a path prefix of the form + # /skypilot/{cluster_pod_name}/{port} + # Refer to kubernetes-ingress.yml.j2 for the exact template. + # # You can get the endpoint for any port opened using the following command: - # sky status {cluster_name} --endpoint {port} + # `sky status {cluster_name} --endpoint {port}` # or list the endpoints for all ports opened using: - # sky status {cluster_name} --endpoints + # `sky status {cluster_name} --endpoints` ports: loadbalancer # Advanced OCI configurations (optional). From bdbe56947168b27f3f6675a4da95f36af1490da0 Mon Sep 17 00:00:00 2001 From: Romil Bhardwaj Date: Tue, 30 Jan 2024 13:50:42 -0800 Subject: [PATCH 3/4] Update docs --- docs/source/reference/kubernetes/index.rst | 43 ++++++++- .../reference/kubernetes/kubernetes-ports.rst | 84 ----------------- .../reference/kubernetes/kubernetes-setup.rst | 93 +++++++++++++++++++ sky/provision/kubernetes/network.py | 6 +- 4 files changed, 138 insertions(+), 88 deletions(-) delete mode 100644 docs/source/reference/kubernetes/kubernetes-ports.rst diff --git a/docs/source/reference/kubernetes/index.rst b/docs/source/reference/kubernetes/index.rst index e73bd6cb4df..3c6f4117da2 100644 --- a/docs/source/reference/kubernetes/index.rst +++ b/docs/source/reference/kubernetes/index.rst @@ -162,6 +162,47 @@ To use images from private repositories (e.g., Private DockerHub, Amazon ECR, Go If you use Amazon ECR, your secret credentials may expire every 12 hours. Consider using `k8s-ecr-login-renew `_ to automatically refresh your secrets. +Opening Ports +------------- + +Opening ports on SkyPilot clusters running on Kubernetes is supported through two modes: + +1. `LoadBalancer services `_ (default) +2. `Nginx IngressController `_ + +One of these modes must be supported and configured on your cluster. Refer to the :ref:`setting up ports on Kubernetes guide ` on how to do this. + +.. tip:: + + On Google GKE, Amazon EKS or other cloud-hosted Kubernetes services, the default LoadBalancer services mode is supported out of the box and no additional configuration is needed. + +Once your cluster is configured, launch a task which exposes services on a port by adding :code:`ports` to the :code:`resources` section of your task YAML. + +.. code-block:: yaml + + # task.yaml + resources: + ports: 8888 + + run: | + python -m http.server 8888 + +After launching the cluster with :code:`sky launch -c myclus task.yaml`, you can get the URL to access the port using :code:`sky status --endpoints myclus`. + +.. code-block:: bash + + # List all ports exposed by the cluster + $ sky status --endpoints myclus + 8888: 34.173.13.241:8888 + + # curl a specific port's endpoint + $ curl $(sky status --endpoint 8888 myclus) + ... + +.. tip:: + + To learn more about opening ports in SkyPilot tasks, see :ref:`Opening Ports `. + FAQs ---- @@ -187,7 +228,7 @@ Kubernetes support is under active development. Some features are in progress an * Storage mounting - ✅ Available on x86_64 clusters * Multi-node tasks - ✅ Available * Custom images - ✅ Available -* Opening ports and exposing services - :ref:`✅ Available ` +* Opening ports and exposing services - ✅ Available * Multiple Kubernetes Clusters - 🚧 In progress diff --git a/docs/source/reference/kubernetes/kubernetes-ports.rst b/docs/source/reference/kubernetes/kubernetes-ports.rst deleted file mode 100644 index 09c4526c83d..00000000000 --- a/docs/source/reference/kubernetes/kubernetes-ports.rst +++ /dev/null @@ -1,84 +0,0 @@ -.. _kubernetes-ports: - -Ports on Kubernetes -======================== - - -.. note:: - This is a guide on how to configure an exisiting Kubernetes cluster (along with the caveats involved) - in order to successfully expose ports and services externally through SkyPilot. - - If you are a SkyPilot user and your cluster has already been set up to expose ports, - :ref:`Opening Ports ` explains how to open ports through SkyPilot. - -SkyPilot's Kubernetes Ports support is designed to be flexible to work with a wide variety of Kubernetes clusters. -Additionally, it uses the established Kubernetes Networking model and APIs internally. -Please refer to the official `Kubernetes Networking documentation `_ for more details. -Currently, SkyPilot supports two modes to expose ports: - -* :ref:`Load Balancer ` -* :ref:`Ingress ` - -.. _loadbalancer: - - -Load Balancer -^^^^^^^^^^^^^ - -This mode exposes ports through a Kubernetes `LoadBalancer `_ Service. -To use this mode, you must have a Kubernetes cluster that supports LoadBalancer Services. -Most of the cloud based Kubernetes providers support this mode out of the box, but do ensure that your cluster supports it before proceeding. -If you have a bare metal cluster, `MetalLB `_ can be used to support LoadBalancer Services. -When using this mode, SkyPilot will create a single LoadBalancer Service for all ports that you expose. -Refer to `kubernetes-loadbalancer.yml.j2` for the exact template that creates Kubernetes resources using this mode. -Each port can be accessed using the LoadBalancer's external IP address and the port number. -:ref:`sky status ` can be used to view the external endpoints for each/all ports. - -This mode in most cloud based Kubernetes clusters creates an external Load Balancer. For instance, -GKE creates a pass-through Load Balancer (see `here `_) -and AWS creates a Network Load Balancer (see `here `_). -This generally incurs an extra cost, so please check with your cloud provider for pricing details. -Currently, the load balancer pricing is not taken into account by SkyPilot. - -.. note:: - This is the default mode used in SkyPilot config for opening ports. - See the kubernetes section in :ref:`SkyPilot Config ` for more details. - -.. note:: - The default LoadBalancer implementation in EKS selects a random port from the list of opened ports for the - LoadBalancer's health check. This can cause issues if the selected port does not have a service running behind it. - For example, a SkyPilot task can expose 5 ports but only 2 of them have services running behind them. - Then, if EKS selects a port that does not have a service running behind it, the LoadBalancer will not pass the healthcheck - and won't be able to assign an external IP address successfully. - -.. note:: - This mode is currently not supported when using a kind cluster created using `sky local up`. - -.. _ingress: - - -Ingress -^^^^^^^ - -This mode exposes ports through a Kubernetes `Ingress `_. -In order to use this mode, manual configuration is needed on the Kubernetes cluster. -This generally involves installing an Ingress Controller. -Currently, SkyPilot only supports the NGINX Ingress Controller. Refer to its `documentation `_ for installation instructions. -When using this mode, SkyPilot creates an ingress resource and a ClusterIP service for each port opened. -The port can be accessed externally by using the Ingress URL plus a path prefix of the form /skypilot/{cluster_name_on_cloud}/{port}. -Refer to `kubernetes-ingress.yml.j2` for the exact template that creates Kubernetes resources using this mode. -Once again, :ref:`sky status ` can be used to view the external endpoints for each/all ports. - -Since this mode exposes a port under a sub path, it runs into issues when the service running behind the port -expects to be accessed at the root path. For example, if the service running behind the port is a Jupyter server, -it expects assets to be present at the root path. Currently, we do not have a solution for this issue. -Please use the :ref:`LoadBalancer ` mode if you run into this issue. - -.. note:: - To use this mode, you need to first install the ingress controller then update the SkyPilot config. - Generally, you will have to set `ports: ingress` in the kubernetes section of the SkyPilot config. - See :ref:`SkyPilot Config ` for more details. - -.. note:: - Currently, SkyPilot does not support opening ports on a Kubernetes cluster using the `Gateway API `. - If you are interested in this feature, please reach out to us. diff --git a/docs/source/reference/kubernetes/kubernetes-setup.rst b/docs/source/reference/kubernetes/kubernetes-setup.rst index dfbc233781b..e0ef13f7f98 100644 --- a/docs/source/reference/kubernetes/kubernetes-setup.rst +++ b/docs/source/reference/kubernetes/kubernetes-setup.rst @@ -215,6 +215,99 @@ Once the cluster is deployed and you have placed your kubeconfig at ``~/.kube/co $ sky check +.. _kubernetes-ports: + +Setting up Ports on Kubernetes +------------------------------- + + +.. note:: + This is a guide on how to configure an existing Kubernetes cluster (along with the caveats involved) to successfully expose ports and services externally through SkyPilot. + + If you are a SkyPilot user and your cluster has already been set up to expose ports, + :ref:`Opening Ports ` explains how to expose services in your task through SkyPilot. + +SkyPilot clusters can :ref:`open ports ` to expose services. For SkyPilot +clusters running on Kubernetes, we support either of two modes to expose ports: + +* :ref:`LoadBalancer Service ` (default) +* :ref:`Nginx Ingress ` + + +By default, SkyPilot creates a `LoadBalancer Service `__ on your Kubernetes cluster to expose the port. + +If your cluster does not support LoadBalancer services, SkyPilot can also use `an existing Nginx IngressController `_ to create an `Ingress `_ to expose your service. + +.. _kubernetes-loadbalancer: + +LoadBalancer Service +^^^^^^^^^^^^^^^^^^^^ + +This mode exposes ports through a Kubernetes `LoadBalancer Service `__. This is the default mode used by SkyPilot. + + +To use this mode, you must have a Kubernetes cluster that supports LoadBalancer Services: + +* On Google GKE, Amazon EKS or other cloud-hosted Kubernetes services, this mode is supported out of the box and no additional configuration is needed. +* On bare metal and self-managed Kubernetes clusters, `MetalLB `_ can be used to support LoadBalancer Services. + +When using this mode, SkyPilot will create a single LoadBalancer Service for all ports that you expose on a cluster. +Each port can be accessed using the LoadBalancer's external IP address and the port number. Use :code:`sky status --endpoints ` to view the external endpoints for all ports. + +.. note:: + In cloud based Kubernetes clusters, this will automatically create an external Load Balancer. GKE creates a pass-through Load Balancer (see `here `__) + and AWS creates a Network Load Balancer (see `here `__). These load balancers will be automatically terminated when the cluster is deleted. + +.. note:: + The default LoadBalancer implementation in EKS selects a random port from the list of opened ports for the + `LoadBalancer's health check `_. This can cause issues if the selected port does not have a service running behind it. + + + For example, if a SkyPilot task exposes 5 ports but only 2 of them have services running behind them, EKS may select a port that does not have a service running behind it and the LoadBalancer will not pass the healthcheck. As a result, the service will not be assigned an external IP address. + + To work around this issue, make sure all your ports have services running behind them. + +.. note:: + LoadBalancer services are not supported on kind clusters created using :code:`sky local up`. + + +.. _kubernetes-ingress: + +Nginx Ingress +^^^^^^^^^^^^^ + +This mode exposes ports by creating a Kubernetes `Ingress `_ backed by an existing `Nginx Ingress Controller `_. + +To use this mode: + +1. Install the Nginx Ingress Controller on your Kubernetes cluster. Refer to the `documentation `_ for installation instructions specific to your environment. +2. Update the :ref:`SkyPilot config ` at :code:`~/.sky/config` to use the ingress mode. + +.. code-block:: yaml + + kubernetes: + ports: ingress + +When using this mode, SkyPilot creates an ingress resource and a ClusterIP service for each port opened. The port can be accessed externally by using the Ingress URL plus a path prefix of the form :code:`/skypilot/{pod_name}/{port}`. + +Use :code:`sky status --endpoints ` to view the full endpoint URLs for all ports. + +.. code-block:: + + $ sky status --endpoints mycluster + 8888: http://34.173.152.251/skypilot/test-2ea4/8888 + +.. note:: + + When exposing a port under a sub-path such as an ingress, services expecting root path access, (e.g., Jupyter notebooks) may face issues. To resolve this, configure the service to operate under a different base URL. For Jupyter, use `--NotebookApp.base_url `_ flag during launch. Alternatively, consider using :ref:`LoadBalancer ` mode. + + +.. note:: + + Currently, SkyPilot does not support opening ports on a Kubernetes cluster using the `Gateway API `. + If you are interested in this feature, please `reach out `_. + + .. _kubernetes-observability: Observability for Administrators diff --git a/sky/provision/kubernetes/network.py b/sky/provision/kubernetes/network.py index 23d71e7bbc1..dcc93145f71 100644 --- a/sky/provision/kubernetes/network.py +++ b/sky/provision/kubernetes/network.py @@ -59,9 +59,9 @@ def _open_ports_using_ingress( ) -> None: if not network_utils.ingress_controller_exists(): raise Exception( - 'Ingress controller not found.' - 'Please install ingress controller first.' - 'See https://github.com/kubernetes/ingress-nginx/blob/main/docs/deploy/index.md for more details.' # pylint: disable=line-too-long + 'Ingress controller not found. ' + 'Install Nginx ingress controller first: ' + 'https://github.com/kubernetes/ingress-nginx/blob/main/docs/deploy/index.md.' # pylint: disable=line-too-long ) for port in ports: From add96004ff2b07a997b6b0feef2c3a75c7a33345 Mon Sep 17 00:00:00 2001 From: Romil Bhardwaj Date: Sat, 3 Feb 2024 09:02:22 -0800 Subject: [PATCH 4/4] comments and clean up --- docs/source/reference/config.rst | 25 +++++-------------- .../reference/kubernetes/kubernetes-setup.rst | 6 ++--- sky/cli.py | 2 +- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/docs/source/reference/config.rst b/docs/source/reference/config.rst index 2ae9796e898..7c3f860bc4b 100644 --- a/docs/source/reference/config.rst +++ b/docs/source/reference/config.rst @@ -179,27 +179,14 @@ Available fields and semantics: # defaults to 'loadbalancer'. # # loadbalancer: Creates services of type `LoadBalancer` to expose ports. - # See https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer. - # This mode is supported for all Kubernetes clusters that support - # the LoadBalancer service type (e.g., GKE, EKS and other cloud hosted k8s) - # This mode creates a single LoadBalancer service for all ports opened. - # The port can be accessed externally using the service's external IP - # plus the specific port you want to access. The external IP generally takes some time - # to be assigned so there might be a slight delay before the port can be accessed. + # See https://skypilot.readthedocs.io/en/latest/reference/kubernetes/kubernetes-setup.html#loadbalancer-service. + # This mode is supported out of the box on most cloud managed Kubernetes + # environments (e.g., GKE, EKS). # # ingress: Creates an ingress and a ClusterIP service for each port opened. - # Requires an ingress controller to be configured on the Kubernetes cluster. - # Currently, only the NGINX ingress controller is supported. - # Refer to https://kubernetes.github.io/ingress-nginx/deploy/ for details on - # deploying the NGINX ingress controller. In this mode, the port can be - # accessed externally using the Ingress URL plus a path prefix of the form - # /skypilot/{cluster_pod_name}/{port} - # Refer to kubernetes-ingress.yml.j2 for the exact template. - # - # You can get the endpoint for any port opened using the following command: - # `sky status {cluster_name} --endpoint {port}` - # or list the endpoints for all ports opened using: - # `sky status {cluster_name} --endpoints` + # Requires an Nginx ingress controller to be configured on the Kubernetes cluster. + # Refer to https://skypilot.readthedocs.io/en/latest/reference/kubernetes/kubernetes-setup.html#nginx-ingress + # for details on deploying the NGINX ingress controller. ports: loadbalancer # Additional fields to override the pod fields used by SkyPilot (optional) diff --git a/docs/source/reference/kubernetes/kubernetes-setup.rst b/docs/source/reference/kubernetes/kubernetes-setup.rst index e0ef13f7f98..ec40afd473e 100644 --- a/docs/source/reference/kubernetes/kubernetes-setup.rst +++ b/docs/source/reference/kubernetes/kubernetes-setup.rst @@ -255,8 +255,8 @@ When using this mode, SkyPilot will create a single LoadBalancer Service for all Each port can be accessed using the LoadBalancer's external IP address and the port number. Use :code:`sky status --endpoints ` to view the external endpoints for all ports. .. note:: - In cloud based Kubernetes clusters, this will automatically create an external Load Balancer. GKE creates a pass-through Load Balancer (see `here `__) - and AWS creates a Network Load Balancer (see `here `__). These load balancers will be automatically terminated when the cluster is deleted. + In cloud based Kubernetes clusters, this will automatically create an external Load Balancer. GKE creates a (`pass-through load balancer `__) + and AWS creates a `Network Load Balancer `__). These load balancers will be automatically terminated when the cluster is deleted. .. note:: The default LoadBalancer implementation in EKS selects a random port from the list of opened ports for the @@ -304,7 +304,7 @@ Use :code:`sky status --endpoints ` to view the full endpoint URLs for .. note:: - Currently, SkyPilot does not support opening ports on a Kubernetes cluster using the `Gateway API `. + Currently, SkyPilot does not support opening ports on a Kubernetes cluster using the `Gateway API `_. If you are interested in this feature, please `reach out `_. diff --git a/sky/cli.py b/sky/cli.py index 2999aeb3408..cc85f1c8b0f 100644 --- a/sky/cli.py +++ b/sky/cli.py @@ -1803,7 +1803,7 @@ def _get_services(service_names: Optional[List[str]], required=False, default=None, type=int, - help=('Get the endpoint URL for the specified port number on the' + help=('Get the endpoint URL for the specified port number on the ' 'cluster. This option will override all other options.')) @click.option('--show-spot-jobs/--no-show-spot-jobs', default=True,