odo service
odo can deploy services with the help of operators.
The list of available operators and services available for installation can be found with the odo catalog
command.
Services are created in the context of a component, so you should have run odo create
before you deploy services.
The deployment of a service is done in two steps:
- Define the service and store its definition in the devfile,
- Deploy the defined service to the cluster, using
odo push
.
#
Creating a new serviceYou can create a new service with the command:
For example, to create an instance of a Redis service named my-redis-service
, you can run:
This command creates a Kubernetes manifest in the kubernetes/
directory, containing the definition of the service, and this file is referenced from the devfile.yaml
file.
Note that the name of the created instance is optional. If you do not provide a name, it will be the lowercased name of the service. For example, the following command will create an instance of a Redis service named redis
:
#
Inlining the manifestBy default, a new manifest is created in the kubernetes/
directory, referenced from the devfile.yaml
file. It is possible to inline the manifest inside the devfile.yaml
file using the --inlined
flag:
#
Configuring the serviceWithout specific indication, the service will be created with a default configuration. You can use either command-line arguments or a file to specify your own configuration.
#
Using command-line argumentsYou can use the --parameters
(or -p
) flag to specify your own configuration.
In the following example, we will configure the Redis service with three parameters:
You can obtain the possible parameters for a specific service from the odo catalog describe service
command.
#
Using a fileYou can use a YAML manifest to specify your own specification.
In the following example, we will configure the Redis service with three parameters. For this, first create a manifest:
Then create the service from the manifest:
#
Deleting a serviceYou can delete a service with the command:
For example:
You can use the --force
(or -f
) flag to force the deletion of the service without confirmation.
#
Listing servicesYou can get the list of services created for your component with the command:
For example:
For each service, STATE
indicates if the service has been pushed to the cluster using odo push
, or if the service is still running on the cluster but removed from the devfile locally using odo service delete
.
#
Getting information about a serviceYou can get the details about a service such as its kind, version, name and list of configured parameters with the command:
For example: