Setting Up the OCI Provider

Set up a system to create a Kubernetes cluster on OCI using the oci provider.

To create a Kubernetes cluster on OCI, you need to set up the OCI CLI and create an Object Storage bucket. You must also provide the location of a kubeconfig file for an existing Kubernetes cluster, or prepare the localhost to create an ephemeral cluster using the libvirt provider. The ephemeral cluster starts the Kubernetes Cluster API services used to create a cluster on OCI.

  1. Set up the OCI CLI.

    Install and configure the OCI CLI. Ensure you set up the key pair and configuration file. For information on setting up the CLI, see the OCI documentation.

  2. Create an Object Storage bucket.

    Create an Object Storage bucket in OCI named ocne-images.

    Tip:

    You can also specify the name of a bucket with another name in a configuration file.

    For information on creating an Object Storage bucket, see the Oracle Cloud Infrastructure documentation.

  3. Set the required OCI configuration.

    Some information about the OCI environment is required before you can create a cluster. You need to set:

    • The compartment in which to deploy resources. This can be a path to a compartment, or the OCID.

    • (Optional) The Virtual Cloud Network (VCN) to use when provisioning the control plane load balancer.

    • (Optional) The subnets to use when provisioning the control plane load balancer.

    The VCN and subnet information is used by the OCI Cloud Controller Manager during deployment to configure the control plane load balancer. This configuration isn't used in the cluster itself, and doesn't impact the OCI resources deployed by the Kubernetes Cluster API controller and templates.

    If you don't set the control plane load balancer networking options, they're automatically set. You can set these options in a configuration file, or in a Kubernetes Cluster API template. If you set this information in the default configuration file ($HOME/.ocne/defaults.yaml), you might need to create the configuration file as it isn't created by default. You can also include these options in a cluster configuration file, and not in the default configuration file, however, you must include the cluster configuration file as a option when creating a cluster using the ocne cluster start command.

    The format to use is:

    providers:
      oci:
        compartment: OCID
        vcn: OCID
        loadBalancer:
          subnet1: OCID
          subnet2: OCID

    For example:

    providers:
      oci:
        compartment: ocid1.compartment.oc1..uniqueID

    Or to include the networking configuration for the control plane node load balancer:

    providers:
      oci:
        compartment: ocid1.compartment.oc1..uniqueID
        vcn: ocid1.vcn.oc1.uniqueID
        loadBalancer:
          subnet1: ocid1.subnet.oc1.uniqueID
          subnet2: ocid1.subnet.oc1.uniqueID

    For more information on the default configuration file, see Oracle Cloud Native Environment: CLI.

  4. (Optional) Set the location of the kubeconfig file for an existing cluster.

    A Kubernetes cluster is required to perform some steps. You can use an existing cluster for this purpose by setting the location of the kubeconfig file.

    You can set this using the KUBECONFIG environment variable, or using the --kubeconfig option with ocne commands. You could also set this in a configuration file.

    If you don't set the location of the kubeconfig file, an ephemeral cluster is created using the libvirt provider when required.

  5. (Optional) Set up the libvirt provider.

    If you don't set the location of an existing Kubernetes cluster, set up the localhost to provision ephemeral clusters using the libvirt provider. For information on setting up the libvirt provider, see Setting Up the libvirt Provider.

  6. (Optional) Create an Oracle Container Host for Kubernetes (OCK) image.

    If you're using customized Kubernetes Cluster API template files, first create an OCK image for the compute instance architecture, and upload it to OCI. For information on creating an OCK image, see Creating an OCK Image for the OCI Provider.