Skip to main content

Creating a cluster via the CLI

In this guide, we will create an HA Kubernetes cluster in GCP with 1 worker node. We will assume an existing Cloud Storage bucket, and some familiarity with Google Cloud. If you need more information on Google Cloud specifics, please see the official Google documentation. jq and talosctl also needs to be installed

Manual setup

Environment setup

We’ll make use of the following environment variables throughout the setup. Edit the variables below with your correct information.

Create the image

First, download the Google Cloud image from Image Factory. These images are called gcp-$ARCH.tar.gz.

Upload the image

Once you have downloaded the image, you can upload it to your storage bucket with:

Register the image

Now that the image is present in our bucket, we’ll register it.

Network infrastructure

Load balancers and firewalls

Once the image is prepared, we’ll want to work through setting up the network. Issue the following to create a firewall, load balancer, and their required components. 130.211.0.0/22 and 35.191.0.0/16 are the GCP Load Balancer IP ranges

Cluster configuration

With our networking bits setup, we’ll fetch the IP for our load balancer and create our configuration files.
Additionally, you can specify machine configuration patches which will be applied during the config generation.

Compute creation

We are now ready to create our GCP nodes.

Bootstrap etcd

You should now be able to interact with your cluster with talosctl. We will need to discover the public IP for our first control plane node first.
Set the endpoints and nodes:
Bootstrap etcd:

Retrieve the kubeconfig

At this point we can retrieve the admin kubeconfig by running:

Cleanup

Using GCP deployment manager

Using GCP deployment manager automatically creates a Google Storage bucket and uploads the Talos image to it. Once the deployment is complete the generated talosconfig and kubeconfig files are uploaded to the bucket. By default this setup creates a three node control plane and a single worker in us-west1-b First we need to create a folder to store our deployment manifests and perform all subsequent operations from that folder.

Getting the deployment manifests

We need to download two deployment manifests for the deployment from the Talos github repository.

Updating the config

Now we need to update the local config.yaml file with any required changes such as changing the default zone, Talos version, machine sizes, nodes count etc. An example config.yaml file is shown below:

Enabling external cloud provider

Note: The externalCloudProvider property is set to false by default. The manifest used for deploying the ccm (cloud controller manager) is currently using the GCP ccm provided by openshift since there are no public images for the ccm yet.
Since the routes controller is disabled while deploying the CCM, the CNI pods needs to be restarted after the CCM deployment is complete to remove the node.kubernetes.io/network-unavailable taint. See Nodes network-unavailable taint not removed after installing ccm for more information
Use a custom built image for the ccm deployment if required.

Creating the deployment

Now we are ready to create the deployment. Confirm with y for any prompts. Run the following command to create the deployment:

Retrieving the outputs

First we need to get the deployment outputs.
Note: If cloud controller manager is enabled, the below command needs to be run to allow the controller custom role to access cloud resources

Downloading talos and kubeconfig

In addition to the talosconfig and kubeconfig files, the storage bucket contains the controlplane.yaml and worker.yaml files used to join additional nodes to the cluster.

Deploying the cloud controller manager

If the cloud controller manager is enabled, we need to restart the CNI pods to remove the node.kubernetes.io/network-unavailable taint.

Check cluster status

Cleanup deployment

Warning: This will delete the deployment and all resources associated with it. Run below if cloud controller manager is enabled
Now we can finally remove the deployment