Customer Engineer @ Google Cloud
There’s a lot of buzz around Google Anthos! I’ve lost count of the number of times I’ve been asked “What IS Anthos?!”. Well today I’m NOT going to answer that question! However, what I will do is (hopefully!) help some of you to spin up your very own Anthos bite-size cluster on some relatively inexpensive hardware thanks to the newest “flavor” of Anthos: Anthos on Bare Metal. From there you’ll be able to explore the features of Anthos for yourself, and embark on your own Anthos journey of discovery!
Anthos on Bare Metal allows you to spin up a cluster from as few as 2 Intel NUCs. It’s a relatively straightforward process, but the process can be a little daunting if you haven’t been through it before. I encountered a few issues along the way, so what I’m walking you through today is my “path of least resistance”!
So let’s start with the hardware. I got sent 3 Intel NUCs. Each of them has a Core I7 Gen 10 processor, 32GB of RAM, and 256 GB SSD.
To be more specific, here's everything that I needed to get up and running:
You can install Anthos on Bare Metal on Ubuntu, CoreOS, or RHEL servers. (See more details here).
Out of the box the NUCs come with Ubuntu installed. However, the Kernel version led to issues with Ansible for me, so I started from scratch and created a bootable USB stick that would install “virgin” Ubuntu 20.04 onto each NUC. I will create my cluster out of just 2 of the NUCs (which is really the minimum we’d recommend). The third I will use as my “workstation” in order to bootstrap the cluster using the bmctl command-line tool. All is not lost, however, we can add that third NUC to the cluster later, once it’s up and running!
(you'll need the password for the default user)
mkdir usb-boot && cd usb-boot
chmod +x build_iso.sh
and note the device that represents the USB stick (i.e.
(whatever is returned from above)
ssh-keygen -t rsa
and copy to clipboard
Paste in public SSH key and save
ssh [email protected]
ssh -o IdentitiesOnly=yes -i
(N.B use the path to the private SSH key you previously generated, and the IP address of each of your node NUCs). You should be able to connect to the NUC as root without being prompted for a password.
to perform preflight checks, and then to install Anthos. If you followed the instructions in step 22 then all APIs and service account keys would have been generated for you.
./bmctl create cluster -c [name of your cluster]
So now let’s deploy a simple “Hello world!” Kubernetes deployment and service. Let’s begin by setting our
. So, for instance, I called my cluster bm-cluster:
First let’s create a deployment YAML:
apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment spec: selector: matchLabels: app: metrics department: sales replicas: 3 template: metadata: labels: app: metrics department: sales spec: containers: - name: hello image: "gcr.io/google-samples/hello-app:2.0"
Save the file (as my-deployment.yaml), and now apply it to our Anthos BM cluster:
kubectl apply -f my-deployment.yaml
Let’s check the deployment:
kubectl get deploy
You should see something like this:
NAME READY UP-TO-DATE AVAILABLE AGE
my-deployment 3/3 3 3 30s
Now let’s create a service of type LoadBalancer. Save the following YAML as my-service.yaml:
apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app: metrics department: sales type: LoadBalancer ports: - port: 80 targetPort: 8080
Now let’s apply it:
kubectl apply -f my-service.yaml
Now let’s validate it got created:
kubectl get svc my-service
You should see something like this:
Notice how my-service's IP address (external-IP) got automatically drawn from the “range” we specified earlier. Now we can curl our service, and check that everything is working as it should:
For me, I
, and I see:
Congratulations! Your Anthos on BM cluster is fully operational. It will also show up in the Google Cloud console.
If you want to log in to your cluster (to view node and workload information from the console) you can now follow the instructions on Logging in to a cluster from Cloud Console.
Create your free account to unlock your custom reading experience.