Export Services
This topic describes how to export internal services from onboarded applications and externally managed service gateways from clusters on a slice.
Prerequisites
- Ensure that your slice contains applications onboarded on to it.
- Ensure that clusters have an externally managed service that can be exported on to the slice, whose network type is single network or multi-network.
View the Exported Services
-
Go to Export Services on the left sidebar.
-
On the Export Services page, under Slices, the number of services exported for each slice in your account are tabulated.
-
Click the slice to see its exported services.
Export an Internal Service
When you onboard applications on to the slice, the services on the namespace must be exported for other clusters to discover and use them.
-
Go to Export Services on the left sidebar.
-
On the Export Services page, under Slices, click the slice whose services you want to export.
-
Under Internal Services, click Export Services that is towards the top-right corner of the page.
infoIf a namespace contains multiple services pointing to the same resource, and if you export one of the services, then the other services also get exported along with the service that you intentionally exported.
-
On the Service Export pane, select the service that you want to export. Alias is optional.
noteYou can also use this pane to edit alias after a service is exported.
For a multi-network slice, the Service Export pane also lists Protocol that you can set.
-
Click Export Services/Edit Alias.
-
You are notified that the service export is initiated. Click Ok.
-
The internal services that are exported are added to the list.
Verify the Exported Internal Services
Ensure that the service and its associated service export are linked. If they are successfully linked, then the status shows exported. If they are not linked correctly, then the status is shown as not exported.
If the status of the service export is not exported, then verify the following conditions are met:
-
Name of the service should match with the service export name.
Verify service export names using the following command:
kubectl get serviceexport -n <namespace>
Example
kubectl get serviceexport -n boutique
Example output
NAME SLICE INGRESS SERVICEPORT(S) PORT(S) ENDPOINTS STATUS ALIAS
ad-service boutique-slice 18080/TCP READY
redis boutique-slice 18081/TCP 1 READY ["redis"]Verify services using the following command:
kubectl get svc -n <namespace>
Example
kubectl get svc -n boutique
Example Output
ad-service ClusterIP 10.7.40.11 <none> 9555/TCP 160m
redis ClusterIP 10.7.41.6 <none> 18081/TCP 21hIn the above example, both
ad-service
andredis
services match with the corresponding service export names. -
ServiceExport
spec.selector.matchLabels
should match with the servicespec.selector
.A correct match is illustrated in the following example:
kind: ServiceExport
spec:
selector:
matchLabels:
app: ad-service
name: kubeslice-demokind: Service
spec:
selector:
app: ad-service
name: kubeslice-demo -
The ServiceExport object should have a annotation of the service name. For example:
kind: ServiceExport
metadata:
annotations:
service: ad-service # service name of the service
Remove Service Exports
-
On the Export Services page, under Slices, select the slice you want to remove service exports from.
-
On that slice page, under Internal Services, click Remove Service Exports that is towards the top-right corner of the page.
-
In the Service Export pane, select services that you want to recall and click Remove Service Exports.
-
You are notified that the service export removal is initiated. Click Ok.
-
The selected service exports are removed.
Export an External Service
The VPC egress gateway feature enables users to import a privately managed service running outside a Kubernetes cluster onto a slice. This allows the application pods running in remote clusters to access the managed service through the slice network. To know more, see managed services gateway.
Add a managed service gateway onto the slice to make it accessible to all application pods of other connected clusters.
Exporting an external service is not supported for a multi-network slice.
Ensure that the slice network type is single-network before exporting an external service from it.
-
Go to Export Services tab on the left sidebar.
-
On the Export Services page, under Slices, select the slice you want to export an external service from.
-
On that slice page, go to External Services.
-
On the External Services tab, click Add External Service.
cautionThe Add External Service button is disabled if the slice network type is no network.
You can only export an external service from a single-network or a multi-network slice.
-
On the Add External Service tab, add the following:
- Add a name in the Service Name text box.
- Select the cluster that is attached to the service under Clusters.
- Add FQDN in the text box.
- (Optional) Add the IP address.
- Select a protocol from the supported list.
- Add a port value in the Port text box.
- Click Import External Service to advertise it for other clusters.
- The external service is added to the list on the External Service tab.
Delete an External Service
-
Go to Export Services tab on the left sidebar.
-
On the Export Services page, under Slices, select the slice you want to delete an external service from.
-
On that slice page, go to External Services.
-
Click the delete icon against the external service you want to remove.
-
In the confirmation dialog, enter DELETE and click Delete External Service.