Kubernetes on Apple's M1 Macbook with VMware Tanzu Community Edition

Written by viachaslaumatsukevich | Published 2022/04/26
Tech Story Tags: kubernetes | tanzu | vmware | apple-m1 | arm-processors | macbook | docker | nginx

TLDRIn this article, we will explore the steps needed to create a local Kubernetes installation with VMware Tanzu Community Edition (TCE) on an ARM laptop Apple Macbook Pro M1 Max 2021. We will Install an unmanaged local Kubernetes cluster using TCE CLI, install Tanzu Packages, and deploy a workload on it.via the TL;DR App

With Apple rolling out their laptops with M1 processors it brought a new challenge to make a local development environment working on an ARM-based architecture.

In this article, we will explore the steps needed to create a local Kubernetes installation with VMware Tanzu Community Edition (TCE) on an ARM laptop Apple Macbook Pro M1 Max 2021. We will Install an unmanaged local Kubernetes cluster using TCE CLI, install Tanzu Packages, and deploy a workload on it.

VMware Tanzu Community Edition is a Kubernetes platform specifically designed for use in preproduction and local environments. It is a freely available open-source distribution of VMware Tanzu. It consists of Tanzu CLI and a select set of plugins.

Currently, ARM architecture support in TCE is experimental. Additional info about packages that have ARM support could be found on the release page.

Prerequisites

  • [ ]Macbook with M1 chip
  • [ ]Docker Desktop installed
  • [ ]Homebrew installed

Install Tanzu CLI

Regardless of whether you are going to deploy TCE managed or unmanaged Kubernetes cluster, you need to start with the Tanzu Command Line Interface (CLI). To get in on the Macbook, we will use the Homebrew package manager.

brew install vmware-tanzu/tanzu/tanzu-community-edition

In the output of the brew install command you will see the location of the configure-tce.sh file which we will use in the next step:

Run the configure command to install Tanzu plugins and initialize plugin repositories:

/opt/homebrew/Cellar/tanzu-community-edition/v0.11.0/libexec/configure-tce.sh

Before the next command, make sure you have Docker Desktop installed and running on your laptop. Otherwise, you will face an error.

Create a single-node Tanzu unmanaged cluster with the following command:

tanzu unmanaged-cluster create my-cluster-tce

If you have kubectl CLI installed, then it will be automatically configured to access your local Tanzu cluster. We can run some kubectl commands to double-check access to the Kubernetes cluster:

tanzu unmanaged-cluster list

If you have kubectl CLI installed, then it will be automatically configured to access your local Tanzu cluster. We can run some kubectl commands to double-check access to the cluster:

Tanzu Packages

In this section, we will explore Tanzu Packages, a software bundle that extend the core functionality of the Kubernetes cluster. Reference to package holds into Package Repositories. To make the Tanzu package available for installation, we need to install a package repository. We can discover package repositories installed in the cluster by running the following command:

tanzu package repository list --all-namespaces

To list available Tanzu packages, run the command below:

tanzu package available list

For now, not all packages are available for Docker-based installation (unmanaged cluster), and even fewer packages support ARM architecture.

In the next step, we will install the whereabouts package, which provides the ability to assign IP addresses across the Kubernetes cluster with a CNI IPAM plugin. This package includes the following components:

  • DaemonSet
  • ClusterRoleBinding
  • Custom Resources
  • ServiceAccount
  • Ip-reconciler Cronjob

tanzu package install whereabouts --package-name whereabouts.community.tanzu.vmware.com --version 0.5.0

The whereabouts package is installed! We can check which Tanzu packages installed with the command below:

tanzu package installed list

Deploy Sample Workload

To demonstrate that the local Kubernetes cluster is fully operable, we will create Nginx deployment in the Tanzu Kubernetes cluster. To create the Nginx deployment, run the following command:

kubectl apply -f https://k8s.io/examples/application/deployment.yaml

To expose the Nginx pod and make it available in the local browser we will use the port-forward command:

kubectl port-forward nginx-deployment-66b6c48dd5-hftmw 80:8080


Open you favorite browser and navigate to the http://localhost:8080/ .

Summary

In this scenario, we explored the step-by-step installation of the Tanzu Community Edition unmanaged Kubernetes cluster on an Apples Macbook with an ARM-based M1 processor. We used Tanzu CLI for deploying the Kubernetes cluster and for installing Tanzu Packages. Then we ran a sample workload using kubectl CLI and redirected the traffic to the local browser. VMware Tanzu Community Edition has proven to be a nice and easy tool to set up a local Kubernetes environment on ARM-based laptops.

Clean up

To delete Nginx deployment in the Kubernetes cluster, run the command below:

kubectl delete deploy nginx-deployment

To delete the installed Tanzu Package, you can use the following command:

tanzu package installed delete whereabouts

To delete Tanzu unmanaged Kubernetes cluster, run the command below:

tanzu unmanaged-cluster delete 


Written by viachaslaumatsukevich | Solutions Architect with expertise in Public cloud, Kubernetes, PaaS and CI\CD
Published by HackerNoon on 2022/04/26