Creating a Service
Containers can be grouped together as logical collections called Services ...
Vinothini Raju avatar
Written by Vinothini Raju
Updated over a week ago

Containers can be grouped together as logical collections called Services. To learn more about Services, check the article  What are Services ?

Creating a fully functional Service is a two step process :  

  1. Creating a Service

  2. Adding a Container to a Service

In this article, we will explore the steps to create a Service.

Prerequisites

  1. One or more Containers

  2. Deployment Policy (Optional)

  3. Scaling Policy for Stateless Services (Optional)

  4. Network Policy (Optional)

  5. Volume Claim Policy for Stateful Services (Optional)

  6. Allocation Policy for Containers (Optional)

For requirements 2-6, if no new Policy is created, you can use the default Policies.

Steps to create a Service

1. In the left navigation panel, select Services and choose the Create Service option

2. In step 1 - General section. select the service Type as Stateless or Stateful

2.1 Custom Ingress

If the Service is a Custom Ingress, then choose Custom Ingress Controller Option ?. This ensures that the Custom Ingress Controller is used for routing instead of the default Ingress Controller managed by gopaddle.

2.2 Security Context

To set security context for the Service, you can deploy the service as a non-root user by choosing Run as non-root user ? Provide the User ID and the Group ID to be used for deploying the Service.

You can also set the User ID to be used for mounting volumes and Configurations in the service.

3. In Step 2 - Volume Labels, to create a Shared Folder, Choose the Label Type as Shared Folder,  provide a Volume Label and Click Add. Note that the Shared Folder option is available for both Stateful and Stateless Services. 

To use Shared Volumes across services, choose a Volume Claim Policy with Shared Volume option enabled. For more information, check the documentation on 'Creating Shared Volumes across Services'

The Shared Folder label will be available as a target Storage at the time of adding a Container to the Service. One or more containers can mount their data directory to the same Shared Folder.

4. In case you choose Stateful Service type, in step 2 - Volume Labels, to add a persistent volume,  Choose the Label Type as Persistent Volume, select one of the available Volume Policies and provide a Volume Label and Click Add.

The Persistent Volume label will be available as a target Storage at the time of adding a Container to the Service. One or more containers can mount their data directory to the same Persistent Volume.

5. In step 3 - Deployment Policy, choose the deployment policy according to the type of the Service - stateful or stateless.

6. In Step 4 - Scaling Policy, choose the Scaling policy. This step is applicable only for a Stateless Service

7.  In step 5 - Network policy, choose the Network policy that defines the firewall restrictions for Inbound and Outbound requests to/from the Service.

8. In step 6 - Metadata, add optional metadata information either for the Service or for the Service proxy as a Key/Value Pair. Confirm all the Changes and click on Create to create a new Service.

9. In step 7 - Pod Affinity/Anti-Affinity, add the placement rules for the service based on the peer service labels. For more information on Pod Affinity and Anti-Affinity configuration, check the documentation here.

Did this answer your question?