Managing Virtual Deployment Bindings with kubectl

With the kubectl command you can create, update, move, list, view, and delete a virtual deployment binding. The following topics detail how to manage these operations with kubectl.

View Kubernetes Configuration Options for Virtual Deployment Bindings

You can view the Kubernetes CLI virtual deployment binding YAML configuration options by displaying the Custom Resource Definition (CRD). Use the following command:

kubectl describe crd virtualdeploymentbindings.servicemesh.oci.oracle.com

In the CRD, you see the fields used in a YAML configuration file under spec:schema:openAPIV3Schema:properties:spec. CRD output also includes information about field types, ranges, and limits. The following section provides an example of a YAML configuration file.

Create, Update, or Move a Virtual Deployment Binding

To create a virtual deployment binding, use the kubectl apply command.

Create the virtual deployment binding using one of the following commands.

  • Create your virtual deployment binding using the virtual deployment name.

    kubectl apply -f - <<EOF
    apiVersion: servicemesh.oci.oracle.com/v1beta1
    kind: VirtualDeploymentBinding
    metadata:
      name: <binding-name>
      namespace: <binding-namespace>
    spec:
      virtualDeployment:
        ref:
          name: <vs-name>-version1 # Virtual Deployment Name
      target:
        service:
          ref:
            name: <kubernetes-service-name> # Name of Kubernetes Service
            namespace: <kubernetes-service-namespace> # Name of Kubernetes Service namespace
          matchLabels: # Labels for the Kubernetes service
            version: v1
    EOF
  • Create your virtual deployment binding using the virtual deployment OCID.

    kubectl apply -f - <<EOF
    apiVersion: servicemesh.oci.oracle.com/v1beta1
    kind: VirtualDeploymentBinding
    metadata:
      name: <binding-name>
      namespace: <binding-namespace>
    spec:
      virtualDeployment:
        id: <ocid-of-referencing-virtual-deployment-created-from-cli>
      target:
        service:
          ref:
            name: <kubernetes-service-name> # Name of Kubernetes Service
            namespace: <kubernetes-service-namespace> # Name of Kubernetes Service namespace
          matchLabels: # Labels for the Kubernetes service
            version: v1
    EOF
To update a virtual deployment binding with kubectl:
  1. Change the configuration text as needed.
  2. Run the apply command again.

To move a virtual deployment binding to a different compartment. Move the linked virtual deployment to a different compartment.

Get a List of Virtual Deployment Bindings

To get a list of virtual deployment bindings in your namespace, use the following command:

kubectl get virtualdeployments -n <namespace>

View a Virtual Deployment Binding

To view the details of a specific virtual deployment binding in your namespace, use the following command:

kubectl describe virtualdeployment <name> -n <namespace>

Delete a Virtual Deployment Binding

To delete of a specific virtual deployment binding in your namespace, use the following command:

kubectl delete virtualdeployment <name> -n <namespace>