• Cloud-Native Container ProductsCloud-Native Container Products
    • KubeSphere Enterprisehot
    • KubeSphere Virtualizationhot
    • KubeSphere Enterprise HCI
  • Cloud-Native ServiceCloud-Native Service
    • KubeSphere Backuphot
    • KubeSphere Litenew
    • KubeSphere Inspectornew
  • Public Cloud Container ServicePublic Cloud Container Service
    • KubeSphere on AWS
    • KubeSphere on DigitalOcean

Use a lite cluster

Describe how to use the lite cluster to expose HTTP or HTTPS services.

This topic describes how to create a lite cluster (managed Kubernetes cluster) on KubeSphere Cloud to expose HTTP or HTTPS services.

Prerequisites

You have created a lite cluster.

Procedure

To expose your service, you need to create an external service first. Here, nginx is used to exemplify how to quickly create an external service.

Create a workload

  1. On the KubeSphere console, click Platform > Cluster Management.

  2. On the navigation pane on the left, click Application Workloads > Workloads.

  3. On the Deployments tab, click Create.

  4. In the Create Deployment dialog box, enter a name of the deployment, for example, nginx, and choose a project, for example, default.

  5. On the Pod Settings tab, click Add Container, enter nginx in the search box and press Enter. In the pop-up area, click Use Default Ports, and click Next.

    common:NOTE

    Record the default port. In this example, the default port is 80.

  6. On the Storage Settings tab, you can mount a volume, configmap or secret. Also, you can skip this step. Click Next.

  7. On the Advanced Settings tab, click Add Metadata and record the key and value in the Labels area (key: app, value: nginx, and then click Create.

    When the status of nginx is running, the deployment has been successfully created.

Create a service

  1. On the navigation pane on the left, click Application Workloads > Workloads.

  2. On the Services page on the right, click Create.

  3. On the Create Service dialog box, enter a service name, for example, nginx, choose project defalut, and then click Next.

    common:NOTE

    Ensure that the selected projects are the same when you create a workload and service.

  4. In the Workload Selector area of Service Settings, enter the recorded key and value (key: app, value: nginx).

  5. In Ports, select a protocol, enter a protocol name, container port, and service port. Here, enter container port 80 recorded when the deployment was created, and then click Next.

    common:NOTE

    • Currently, only HTTP and HTTPS services can be exposed.
    • Exposing internal services whose ClusterIP is None is not supported.
  6. In Advanced Settings, click Create, and then you can view the created service on the Sevices page.

  7. Click the service to go to its details page. On the left pane, select More > Edit External Access, set the access mode to NodePort, and click OK.

Expose the internal service

  1. On the KubeSphere Cloud console, click Lite Cluster.

  2. On the Cluster Details page, click Network.

  3. In External Service, click Create.

  4. On the Create External Service page on the right, set a name of the external service, for example, nginx, choose an Internal protocol, select the created nginx service, and then click OK.

  5. In Network, click the access address to access nginx.

KubeSphere ®️ © QingCloud Technologies 2022