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
On the KubeSphere console, click Platform > Cluster Management.
On the navigation pane on the left, click Application Workloads > Workloads.
On the Deployments tab, click Create.
In the Create Deployment dialog box, enter a name of the deployment, for example,
nginx
, and choose a project, for example,default
.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
.On the Storage Settings tab, you can mount a volume, configmap or secret. Also, you can skip this step. Click Next.
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
isrunning
, the deployment has been successfully created.
Create a service
On the navigation pane on the left, click Application Workloads > Workloads.
On the Services page on the right, click Create.
On the Create Service dialog box, enter a service name, for example,
nginx
, choose projectdefalut
, and then click Next.common:NOTE
Ensure that the selected projects are the same when you create a workload and service.
In the Workload Selector area of Service Settings, enter the recorded key and value (key:
app
, value:nginx
).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
isNone
is not supported.
In Advanced Settings, click Create, and then you can view the created service on the Sevices page.
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
On the KubeSphere Cloud console, click Lite Cluster.
On the Cluster Details page, click Network.
In External Service, click Create.
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 creatednginx
service, and then click OK.In Network, click the access address to access
nginx
.