Setting Up the Oracle Cloud Infrastructure Provider

Set up a system to create a Kubernetes cluster on Oracle Cloud Infrastructure using the oci provider.

To create a Kubernetes cluster on Oracle Cloud Infrastructure, you need to set up the Oracle Cloud Infrastructure 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 Oracle Cloud Infrastructure.

  1. Set up the Oracle Cloud Infrastructure CLI.

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

  2. Create an Object Storage bucket.

    Create an Object Storage bucket in Oracle Cloud Infrastructure 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 Oracle Cloud Infrastructure configuration.

    Some information about the Oracle Cloud Infrastructure 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.

    • The Virtual Cloud Network to use when provisioning a load balancer.

    • The subnets to use when provisioning a load balancer.

    This default configuration is used by the Oracle Cloud Infrastructure Cloud Controller Manager during deployment. This configuration isn't used in the cluster itself, and doesn't impact the Oracle Cloud Infrastructure resources deployed by the Kubernetes Cluster API controller and templates.

    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.

    Tip:

    You can override these options in a cluster configuration file, if required. 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 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 Oracle Cloud Infrastructure. For information on creating an OCK image, see Creating an OCK Image for the Oracle Cloud Infrastructure Provider.