Creating a libvirt Cluster

Create a Kubernetes cluster using the libvirt provider.

  1. Set up the host to provision clusters using the libvirt provider.
  2. (Optional) Set up a cluster configuration file.

    A cluster configuration contains the cluster specific information to use when creating the cluster. Use a cluster configuration file to override cluster defaults, or you can use ocne cluster start command options to configure a cluster. A cluster configuration file might include:

    provider: libvirt
    name: mycluster
    workerNodes: 2
    controlPlaneNodes: 1
    providers:
      libvirt:
        controlPlaneNode:
          cpu: 2
          memory: 8Gi
          storage: 20Gi
        workerNode:
          cpu: 2
          memory: 8Gi
          storage: 20Gi

    For information about cluster configuration files, see Cluster Configuration Files.

  3. Create a libvirt cluster.

    Use the ocne cluster start command to create a cluster. The syntax is:

    ocne cluster start 
    [{-u|--auto-start-ui} {true|false}]
    [{-o|--boot-volume-container-image} URI]
    [{-C|--cluster-name} name]
    [{-c|--config} path] 
    [{-n|--control-plane-nodes} integer] 
    [{-i|--key} path]
    [--load-balancer address]
    [{-P|--provider} provider]
    [{-s|--session} URI]
    [{-v|--version} version]
    [--virtual-ip IP]
    [{-w|--worker-nodes} integer]

    For more information on the syntax options, see Oracle Cloud Native Environment: CLI.

    When you create a cluster on a remote system, include the session information in the format qemu+ssh://user@host/system where host is the name or IP address of the remote system. For example:

    --session qemu+ssh://myuser@myhost.example.com/system

Example 6-1 Create a default cluster using the libvirt provider

To create a libvirt cluster, using all default settings:

ocne cluster start

Example 6-2 Create a libvirt cluster using a configuration file

To create a libvirt cluster using a configuration file:

ocne cluster start --config myconfig.yaml

Example 6-3 Create a libvirt cluster with specified nodes and virtual IP

To create a cluster with a specified number of worker and control plane nodes, and a virtual IP address:

ocne cluster start --control-plane-nodes 3 --worker-nodes 5 --virtual-ip 192.168.0.100

Example 6-4 Create a remote libvirt cluster using a configuration file

To create a cluster on a remote host using a configuration file:

ocne cluster start --session qemu+ssh://myuser@myhost.example.com/system --config myconfig.yaml