View on GitHub


Cloud Robotics Core: Kubernetes, Federation, App Management

Connecting a robot to the cloud

Estimated time: 10 min

This page describes how to connect a Kubernetes cluster on a robot running Ubuntu 20.04 to the cloud.

Once you’ve done this, you can:

Setting up the GCP project

  1. If you haven’t already, complete the Setting up the GCP project steps.

  2. On the computer you used to set up the cloud project, generate an access token, which you’ll use to give the robot access to the cloud:

     gcloud auth application-default print-access-token

Installing the cluster on the robot

You’ll need to install a Kubernetes cluster on the robot before you can connect it to the cloud. The cluster manages and supports the processes that communicate with the cloud.

The installation script installs and configures:

  1. Download and run This script will take a few minutes as it downloads and installs the dependencies of the Kubernetes cluster.

     $ curl | bash
     The local Kubernetes cluster has been installed.

    After the script successfully finishes, the Kubernetes cluster is up and running.

    Note: At the end of the script output, you might notice instructions for creating ~/.kube/config, deploying a pod network, and joining nodes to the cluster. You can ignore these instructions for now, as the script has already set up a single-node cluster.

  2. Set up the robot cluster to connect to the cloud. When running, you’ll need to enter the access token you generated earlier. You may find it easiest if you SSH into the robot from the workstation you used to set up the project.

     mkdir -p ~/cloud-robotics-core
     cd ~/cloud-robotics-core
     curl >
     bash my-robot --project ${PROJECT_ID} \
       --robot-type my-robot-type

    Set ${PROJECT_ID} to your GCP project ID. When prompted for an access token, provide the authentication token you generated earlier.

    Note: my-robot-type is a placeholder and you can ignore it for now.

What’s next

Uninstalling the local cluster

You can remove the local cluster with the following command:

sudo kubeadm reset

You may also want to remove the following APT packages and repositories, which installs if they are not present:

sudo apt-get purge kubectl kubelet kubeadm
sudo rm /etc/apt/sources.list.d/kubernetes.list
sudo apt-get purge docker-ce
sudo add-apt-repository --remove \
  "deb [arch=amd64] $(lsb_release -cs) stable"