Creating a Virtual Deployment

Create a virtual deployment in Service Mesh.

    1. Open the navigation menu and click Developer Services. Under Containers & Artifacts, click Service Mesh.
    2. Click Service Meshes.
    3. On the Service Mesh page, from the list of compartments on the left side, select a compartment.
    4. From the list of meshes, click the mesh that contains the virtual service for which you want to create a virtual deployment.
    5. On the details page of the mesh, click the virtual service.
    6. On the details page of the virtual service, in the Virtual Deployment table, click Create virtual deployment.
    7. In the Create Virtual Deployment panel, provide the following details:
      • Name: Enter a name for the virtual deployment. The name must start with a letter or underscore, followed by letters, numbers, hyphens, or underscores. The length can be 1–255 characters. Avoid entering confidential information.
      • Description: (Optional) Add a description for the new virtual deployment. Avoid entering confidential information.
      • Compartment: Select the compartment in which you want to create the virtual deployment. The default compartment is the one you selected before, but you can select any compartment that you have permission to work in.
      • Select Enable access logs to enable the access logs and set their location.
    8. (Optional) To add tags to the virtual deployment, click show advanced options. For more information about tagging, see Resource Tags.
    9. Click Create virtual deployment.
  • 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 fields

      • type with available options DNS.
      • 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, and TLS_PASSTHROUGH.
      • 'port' value for the listener with a range of [1, 65535]
    • <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 the file://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.