Resizing a user cluster

This page describes how to resize an Google Distributed Cloud user cluster. Resizing a user cluster means adding or removing nodes. Adding nodes requires that IP addresses are available for the new nodes.

You resize a user cluster by changing the replicas fields in the nodePools section of your cluster configuration file and then running gkectl update cluster.

For information on maximum and minimum limits for user clusters, see Quotas and limits.

For information on managing node pools with gkectl update cluster, see creating and managing node pools.

Verify that enough IP addresses are available

If you intend to have N nodes after the resizing, then you must have N + 1 IP addresses available.

Verify that you have enough IP addresses. How you do the verification depends on whether the cluster uses a DHCP server or static IP addresses.

DHCP

If the cluster uses DHCP, check that the DHCP server can provide enough IP addresses. It must be able to provide at least one more IP address than the number of nodes that will be in the cluster after the resizing.

Static IPs

If the cluster uses static IPs, running gkectl update cluster first verifies whether you've allocated enough IP addresses in the cluster. If not, you can find the number of extra IP addresses needed in the error message.

If you need to add more IP addresses to the user cluster, perform the following steps:

  1. Open the user cluster's IP block file for editing.

  2. Verify that all of the IP addresses you intend to use for the user cluster are included in the IP block file. The IP block file should have at least one more IP address than the number of nodes that will be in the cluster after the resizing.

  3. To view the addresses reserved for a user cluster:

    kubectl get cluster --kubeconfig ADMIN_CLUSTER_KUBECONFIG \
      --namespace USER_CLUSTER_NAME USER_CLUSTER_NAME --output yaml
    

    Replace the following:

    • ADMIN_CLUSTER_KUBECONFIG: the path of the admin cluster kubeconfig file
    • USER_CLUSTER_NAME: the name of the user cluster
  4. Add as many additional static IP addresses to the corresponding block as required, and then run gkectl update cluster.

Here is an example of an IP block file that has four IP addresses and the corresponding hostnames:

hostconfig:
dns: 172.16.255.1
tod: 216.239.35.0
blocks:
- netmask: 255.255.248.0
  gateway: 21.0.135.254
  ips:
  - ip: 21.0.133.41
    hostname: user-node-1
  - ip: 21.0.133.50
    hostname: user-node-2
  - ip: 21.0.133.56
    hostname: user-node-3
  - ip: 21.0.133.47
    hostname: user-node-4

Resize the cluster

In the user cluster configuration file, update the value of the replicas field in one or more of the nodePools elements.

Resize the custer:

gkectl update cluster --kubeconfig ADMIN_CLUSTER_KUBECONFIG --config USER_CLUSTER_CONFIG

Replace the following:

  • ADMIN_CLUSTER_KUBECONFIG: the path of the admin cluster kubeconfig file

  • USER_CLUSTER_CONFIG: the path of the user cluster configuration file

Verify that the resizing succeeded:

kubectl --kubeconfig USER_CLUSTER_KUBECONFIG get nodes

kubectl --kubeconfig USER_CLUSTER_KUBECONFIG describe machinedeployments NODE_POOL_NAME | grep Replicas

Replace the following:

  • USER_CLUSTER_KUBECONFIG: the path of the user cluster kubeconfig file

  • NODE_POOL_NAME: the name of the node pool that you resized.

Troubleshooting

See Troubleshooting cluster creation and upgrade.