# service

The create service command deploys a new Kubernetes Service to expose applications within or outside the cluster. This command allows defining service type, exposed ports, selector labels, and session affinity settings.

## Usage

```
cldkctl create service [flags]
```

## Steps

Follow the steps below to run and view the result of this command:

1. You can create a Service either by opening the built-in editor or by using a YAML configuration file.
2. To open the editor, run:

```
cldkctl create service
```

3. The Service manifest will open in your default text editor (default: vim). Edit the configuration as needed, then save and close the file to apply the changes.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2F3cpeVtkmUfrrgGBDPKHY%2Funknown.png?alt=media&#x26;token=7712eb09-9b7e-44db-a14f-4f59d176bec6" alt=""><figcaption></figcaption></figure>

4. Alternatively, you can prepare a YAML file that defines the Service configuration, then save this file in the same directory where you will run the cldkctl command.
5. Use the --file flag to point to the YAML file.
6. (Optional) To specify a namespace or project, add the --default-namespace or --project flag.
7. Run the following command in your terminal:

```
cldkctl create service --file [service file name]
```

8. Replace \[service file name] with the path to your YAML configuration file.
9. Once completed successfully, a message “✓ Service created” will appear in your terminal.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2F7v5gGG9TqGIQ6QmPEBnr%2Funknown.png?alt=media&#x26;token=7c56521d-235b-4634-ac49-6262d5d6ad49" alt=""><figcaption></figcaption></figure>

## Flags

{% hint style="info" %}
This command supports [global flags](https://docs.cloudeka.ai/cloudeka-api-list/global-flags). Refer to the Global Flags section for details.
{% endhint %}

| Flag       | Description                      |
| ---------- | -------------------------------- |
| -h, --help | Help for create service command. |
