Creating user clusters

This page is for platform administrators.

You can create user clusters with Anthos private mode Management Center Console or with kubectl.

Before you begin

Ensure that the required machine and VIP resources are registered by the infrastructure operator before you create a cluster.

Management Center

  1. In Management Center Console, open the Clusters menu.

  2. In the Clusters section, click Create to create a new Anthos user cluster.

    Empty Clusters Page

  3. Configure the new user cluster using the Cluster configuration page:

    Add a Cluster

Once the cluster is created, it is automatically registered in Management Center and shows up in the cluster dashboard immediately.

kubectl

Create the Cluster and NodePool resources to be registered to the admin cluster with the following command:

kubectl apply -f USER_CLUSTER_YAML --kubeconfig=ADMIN_KUBECONFIG

Replace the following:

  • USER_CLUSTER_YAML: The YAML manifest for the user cluster and node pools. See the User Cluster and NodePool sample configuration files.
  • ADMIN_KUBECONFIG: The admin cluster kubeconfig file.

If you are using the admin cluster configuration files as the basis for your user cluster configuration, modify the following fields in the user cluster configuration fie:

  • Remove the top sshPrivateKeyPath, privateRegistry, privateRegistryConfigPath, privateRegistryTLSCertPath fields.
  • Ensure the <cluster-name> are consistent across the configurations.
  • Cluster.spec.type should be user, this is different from the cluster type for an admin cluster.
  • Cluster.metadata.namespace should be cluster-<cluster-name>, where <cluster-name> is the name of the user cluster being created.
  • Ensure the Cluster.spec.loadBalancer.vips.controlPlaneVIP and Cluster.spec.loadBalancer.addressPools do not overlap with other clusters' config.
  • Cluster.spec.loadBalancer.addressPools contains the range of IP addresses that are assigned to services of type LoadBalancer. It can accept more than one address pool. By creating multiple address pools with different names, you can later create services and assign specific address pools to each service. You need to add metallb.universe.tf/address-pool: <address-pool-name> to the annotation of the service when you create it. If at a later stage you need to extend the range used by services, you can achieve this by adding additional address pools by editing the user cluster: kubectl edit cluster user-cluster-name --kubeconfig admin_kubeconfig -n user-cluster-name. You cannot change existing addressPools. The following is an example.
  • Nodepool.metadata.name should be of the format: <cluster-name>-worker-node-pool.
  • Nodepool.metadata.namespace should be cluster-<cluster-name> and metadata.name matches the cluster name in Cluster.
  loadBalancer:
    addressPools:
    - addresses:
      - 10.200.0.112-10.200.0.119
      name: pool1
    - addresses:
      - 10.200.0.120-10.200.0.121
      name: pool2

Verify the cluster status

It might take up to 15 minutes for the cluster to bootstrap and become ready. While you wait, you can check the status of the user cluster with the following command:

kubectl get Cluster -n cluster-USER_CLUSTER_NAME --kubeconfig=ADMIN_KUBECONFIG

Replace USER_CLUSTER_NAME with the name of the cluster you created.

When the cluster's status is ready, the user cluster is successfully created and registered to the admin cluster.

Download the kubeconfig file

After the user cluster is created, you can download the kubeconfig file from Management Center.

  1. In Management Center Console, open the Clusters menu.
  2. In the Clusters page, click the cluster name.
  3. In the Cluster configuration page, download the kubeconfig file:
    • Infrastructure operators and platform admins can click Download root kubeconfig.
    • Read-only users can click Download read-only kubeconfig.

The kubeconfig file downloads to your system.