Stan's Corner

 View Only

Deploy a Synthetic PoP in a Macbook M1 (ARM)

By Israel Ochoa posted Tue May 16, 2023 04:59 PM

  

Disclaimer: This blog is based on my personal experience and collaboration with the Instana Synthetic Monitoring team, they're awesome and working hard on delivering this feature for everyone, I just helped to make the Synthetic Point Of Presence (PoP from now on) work in a Macbook M1 (ARM) for testing purposes. This is available on the latest version 249.

For more information about deploying a Synthetic PoP in stable environments, please refer to the Synthetic PoP Deployment document. 

IMPORTANT! 

Tested on Macbook Pro M1 2021. 

But, why? 

Use case 
 
As a Developer, I want to be able to install and run the Synthetic PoP in my Macbook ARM to create and test Instana Synthetic Monitoring without using other hardware. 

Considerations 

Our main goal is to have performance on our Macbook and the following approach allows you to have your PoP running: 

- Without Docker Desktop or Virtualbox. 
- Lightweight Linux images. 
- Single software to run the Kubernetes cluster. 
- All about performance in your Macbook ARM. 

Instructions on how to deploy the PoP

Ingredients 

Read the whole document before starting the work. 

- Macbook with ARM chipset (M1 was tested). 

- HomebrewMacOs/Linux package manager. 

- Colima and Docker's CLI. 

- K9s- Optional but fancy. 

- Kubectl in case you don't want to use K9s. 

Preparation 

Install Homebrew 

If you haven't installed Homebrew yet, you can follow this Homebrew tutorial. 

Remove Docker Desktop 

Unfortunately, this process will remove all your containers as well as your images. You'll have to rebuild your local images and redownload any upstream images again. 

To uninstall Docker Desktop for Mac, you can follow these instructions from Docker. 

Installing Colima and Docker's CLI 

Colima is "container runtimes on macOS (and Linux) with minimal setup". 

It's a lightweight Alpine image that does wonders in your system in terms of performance, plus, it has Kubernetes integrated (K3s) which is ideal for Development and Testing. 

Docker's CLI are the Docker commands you can run in the command line. 

Now, let's install the following: 

brew install colima 

brew install docker docker-compose 
 
Configure docker-compose as a Docker plugin, this way you can use docker compose as a command instead of the legacy docker-compose script. 

mkdir -p ~/.docker/cli-plugins 

ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose 

 
Run the following command and ensure that it works 

docker compose

Installing K9s (Optional) 

 
You can install K9s using the following command: 

brew install derailed/k9s/k9s 

Serving 

Start your Kubernetes cluster 

Now that you have your Mac ready for action, you need to start your mini local Kubernetes cluster, it will spin up a K3s cluster: 

colima start --arch aarch64 --vm-type=vz --vz-rosetta --layer=true --cpu 4 --memory 6 --kubernetes 

En bild som visar text

Automatiskt genererad beskrivning 

 I have used 4 CPUs and 6 GB MEM for the entire cluster, that's enough for me. You can try other parameters and see what works for you like 4 GB MEM. 

Run colima status and you should be able to see something like this: 

En bild som visar text

Automatiskt genererad beskrivning
If you installed K9s, then use it to see your K3s cluster. Run k9s and that is going to read your ~/.kube/configfile created by Colima. 

En bild som visar text, skärm, skärmbild, nära

Automatiskt genererad beskrivning 

Install the Synthetic PoP 

 
Our mini Kubernetes is up and running, now we can deploy the PoP. Before proceeding, have your Instana Key at hand. 

The following is an example on how to install the Synthetic PoP by using the Helm chart: 

helm install synthetic-pop \ 

--repo "https://agents.instana.io/helm" \ 

--namespace syn \ 

--create-namespace \ 

--set downloadKey="YourDownloadKey" \ 

--set controller.location="IsraPOP;IsraPOP;Sweden;Stockholm;59.402434;17.946482;This is a testing Synthetic Point of Presence in Stockholm" \ 

--set controller.clusterName="NameOfYourK8sCluster" \ 

--set controller.instanaKey="YourInstanaKey" \ 

--set controller.instanaSyntheticEndpoint="YourInstanaHTTPSEndpoint" \ 

--set redis.tls.enabled=false \ 

--set redis.password="1234567890" \ 

--set roRootFileSystem="false" \ 

--set popArch="arm64" \ 

synthetic-pop 

 
If everything went fine, my recommendation is to keep K9s open, then you're going to see something like this: 

En bild som visar text, vägg, skärm, skärmbild

Automatiskt genererad beskrivning 

Yes! your synthetic-pop is up and running!. It should be available in your Instana instance. 
 
Go to Synthetics -> Locations 
 

Uninstall your synthetic-pop 

 
Run the following command to uninstall the synthetic-pop, important to note, if you do this you need to restart colima before installing it again. 

helm uninstall synthetic-pop -n syn 

How do I stop this? 

Easy, just run the command colima stop 

 

Implementation Details, for the nerds! 

The Instana team is working hard to provide official ARM support out of the box. In the meanwhile, use this approach to test your own Synthetic PoP in your Macbook ARM. 

So, how does this work? 

It is simple Colima awesomeness, from the webz: 

--- 
What is Colima? 🤔 

Colima is built on Lima, which generates a QEMU VM with an HVF accelerator and handles port forwarding and folder sharing. Lima has containerd and nerdctl , but a Docker container runtime is necessary for a drop-in replacement, which is what Colima is for. 

Colima installs the Docker container runtime in a Lima virtual machine, configures the Docker CLI on macOS, and handles port forwarding and volume mounts. Docker, like Docker Desktop, is now simply accessible on macOS without any settings. 

It's a command line program that builds on top of lima to give a more convenient and full Docker Desktop alternative, and it already shows a lot of potential. 
--- 

By default Colima uses a lightweight Alpine Linux image with bundled dependencies. Therefore, user interaction with the Virtual Machine is expected to be minimal (if any). It's not enough for some requirements from the  synthetic-pop, that's why we use the argument --layer=true to have an Ubuntu Linux container as an extra layer. 

But, that's not all, we're trying to run some x86_64 on arm64, right? Well, if you go to the Lima documentation you can read that there is a feature that allows you to run Intel-on-ARM and ARM-on-Intel, and Colima added some good features to make this happen; we can run x86_64 software on our ARM Kubernetes cluster. 

To run arm64 on our cluster, we need a few more arguments: 

--arch aarch64 --vm-type=vz --vz-rosetta

With the above command, we're telling Colima that it's able to run x86_64 binaries on ARM using Rosetta. 

In macOS 13 and later on Mac computers with Apple silicon chips, the Virtualization framework supports Rosetta in ARM Linux virtual machines (VMs). Rosetta is a translation process that allows users to run apps that contain x86_64 instructions on Apple silicon. In macOS, this allows apps built for Intel-based Mac computers to run seamlessly on Apple silicon; Rosetta allows the same capability for Intel Linux apps in ARM Linux VMs. 

Yes I know, it is too much but hey, now you can test it in your computer.



------------------------------
Israel Ochoa
Technical Value Advisor - NCEE Market for IBM Instana
------------------------------

Permalink

Comments

Wed May 24, 2023 09:39 AM

Really good KB!!! It works after I followed the steps to create the pop.