Creating a Virtual Deployment
Create a virtual deployment in Service Mesh.
To see what operations are available for
virtual-deployment create
use:oci service-mesh virtual-deployment create -h
To create a virtual deployment using the CLI, run
oci service-mesh virtual-deployment create
to create the virtual deployment:oci service-mesh virtual-deployment create --name <virtual-deployment-name> --description <description> --compartment-id <compartment-ocid> --virtual-service-id <virtual-service-ocid> --service-discovery --listeners <listeners-list> --access-logging <access-logging-config>
Where:
- <virtual-deployment-name> (immutable) is the name of the new virtual deployment. The name has to be unique under the virtual service.
- <description> (optional) is the description of the virtual deployment. Avoid entering confidential information.
- <compartment-ocid> is the OCID of the compartment to which the new virtual deployment belongs.
- <virtual-service-ocid> (immutable) is the OCID of the virtual service that contains the virtual deployment.
-
<service-discovery-config> is the service discovery configuration for the virtual deployment to use. This is a complex type where the value must be valid JSON. Provide the value as a string on the command line or passed in as a file using the
file://path/to/file
syntax. It has following fieldstype
with available optionsDNS
.hostname
for the virtual deployment.
-
<listeners-list> is the list of listener objects for the virtual deployment. This is a complex type where the value must be valid JSON. Provide the value as a string on the command line or pass as a file using the
file://path/to/file
syntax. Each listener object contains the following fields- 'protocol' with available options
HTTP
,HTTP2
,GRPC
,TCP
, andTLS_PASSTHROUGH
. - 'port' value for the listener with a range of [1, 65535]
- 'protocol' with available options
- <listeners-list> (optional) is the configuration for
access log setting on the virtual deployment. This setting has a boolean field
of
is-enabled
. This setting is a complex type where the value must be valid JSON. Provide the value can as a string on the command line or pass in as a file using thefile://path/to/file
syntax.
For example:
oci service-mesh virtual-deployment create --name my-virtual-deployment --description "This is a virtual deployment" --compartment-id ocid1.compartment.oc1.id --virtual-service-id ocid1.meshvirtualservice.oc1.id --service-discovery '{"type": "DNS", "hostname":"deployment-1.com"}' --listeners '[{"port": 8080, "protocol": "HTTP"}]' --access-logging '{"is-enabled": "TRUE"}'
The response to the command includes:
- The virtual deployment's OCID.
- The lifecycle state (for example
CREATING
,ACTIVE
,FAILED
). - The ID of the work request to create the virtual deployment (details of work requests are available for seven days after completion, cancellation, or failure).
If you want the command to wait to return control until the virtual deployment is active (or the request has failed), include either or both the following parameters:
--wait-for-state SUCCEEDED
--wait-for-state FAILED
For example:
oci service-mesh virtual-deployment create --name my-virtual-deployment --description "This is a virtual deployment" --compartment-id ocid1.compartment.oc1.id --virtual-service-id ocid1.meshvirtualservice.oc1.id --service-discovery '{"type": "DNS", "hostname":"deployment-1.com"}' --listeners '[{"port": 8080, "protocol": "HTTP"}]' --access-logging '{"is-enabled": "TRUE"}' --wait-for-state SUCCEEDED
Important
You can't use the virtual deployment until the virtual deployment is active.Checking Virtual Deployment Status
(Optional) To see the status of the virtual deployment, enter:
oci service-mesh virtual-deployment get --virtual-deployment-id <virtual-deployment-ocid>
(Optional) To view the status of the work request that is creating the virtual deployment, refer to Service Mesh Work Requests.
Creating a Virtual Deployment using JSON File
Alternatively, create a virtual deployment by supplying a JSON file to the create command. Generate a sample JSON file for a
virtual-deployment
:oci service-mesh virtual-deployment create --generate-full-command-json-input
Create a JSON file with the sample-generated output from previous step and update the fields with appropriate values. Supply the JSON file to the virtual deployment create command:
oci service-mesh virtual-deployment create --from-json file:///<filename>
For more information about using the CLI, see: Command Line Interface (CLI) />.
Use the CreateVirtualDeployment operation to create a virtual deployment.