It’s been a while since I’ve done a ‘How To’ post, mainly because I’ve been spending my time talking to customers and less time hands on recently. An area I’ve always been intrigued about but never had chance to play with, is containerisation. Thankfully @VMware came to my, and hopefully a few others, with a great way to get started with Tanzu Community Edition, especially if like me, you don’t come from a developer background.
So, if you’re like me, and have spent most of your career designing, feeding and watering infrastructure to support app workloads, containisation will be a bit of a dirty word. Why you ask? Well firstly, its ‘new’ and secondly, its a word only uttered by devs and people in SRE jobs (site reliability engineers to you and me!). VMware, for a while have have a product called Tanzu which comes in a number of flavours, but essentially it allows you to run containers natively on vSphere, across all of the big cloud providers, and on prem. This isn’t a marketing post, so if you want more info, head over here.
So this post is how to get started with the Tanzu Community Edition (TCE) – a completely free, unlimited usage version of Tanzu that allows you to run an enterprise-class k8s (kubernetes) cluster for learning, testing, pre-prod, whatever you need it for. What’s great about it, aside from letting you build directly on vSphere or the cloud providers, is that TCE allows you to run it locally on your Windows or Mac device. So this is a very quick, how to on how to get started on MacOS.
If you haven’t already, get yourself homebrew – its a package manager for MacOS which makes installing things sooooo much easier. Run the following command in your terminal window
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Next up, you need to install Docker Desktop for MacOS. You can go to to Docker website for this install. Its a pretty simple install and when its installed, you’ll see a little icon on your menubar.
As default, Docker is set to use up to 2GB RAM, I recommend upping that to as much as you can to ensure that Tanzu runs ok. I have 16GB in my laptop, so I gave Docker 8GB of that. You can do this by going into Docker > Preferences > Resources.
Lastly, you need to ensure you have kubectl installed. If you’ve installed HomeBrew, this is as simple as running the below command:
brew install kubectl
And to check its installed correctly:
kubectl version --client
Still in terminal, run the below:
brew tap vmware-tanzu/tanzu brew install tanzu-community-edition
Once the installation is complete, in the terminal you will see instructions to run the setup script. Essentially its running the configure-tce.sh shell script from the install location. You can see the location of mine in the screenshot below.
Once that is complete, you should be good to go. Worth checking that docker is running by running the following command in terminal
That should return you something like this:
If it doesn’t, then run docker from spotlight and go through the basic install (accepting EULA, etc) and the daemon should start.
Next up to is stand up a standalone cluster, again this is really simple – just run the below command
tanzu standalone-cluster create --ui
This allows you to create a local cluster using the UI. This will open a local webpage, where pretty much the only detail it asks for is the name of your cluster and you can click through the rest of the wizard. This takes a while, however you get a progress bar down the left hand side of the verbose log screen on the right
Be patient and you should find yourself with a platform ready to go in a short while
How can you check everything is working? Back into terminal.
kubectl config use-context <STANDALONE-CLUSTER-NAME>-admin@<STANDALONE-CLUSTER-NAME>
In my case, my cluster was called tce-sam, so I inputted kubectl config use-context [email protected]
You can check the API node is running by typing
kubectl get nodes
You should then see something like this
Now all this is great, but there isn’t anything actually tangible other than a bit of command-line output. So lets deploy an app within our cluster – again VMware have you covered for this.
Within the same terminal, run:
kubectl run --restart=Never --image=gcr.io/kuar-demo/kuard-amd64:blue kuard
And then forward the ports to 8080
kubectl port-forward kuard 8080:8080
You’ll see the following output
If you then open up http://localhost:8080/ in your browser, you should be presented with the KUAR demo application
When you’re finished looking at this, press command+c to stop port forwarding, and then the following to delete the pod
kubectl delete pod kuard
Hopefully that was useful at getting you up and running, I certainly enjoyed the process and it costs nothing other than a bit of time. If you don’t have the time to follow the above, you can jump on the various workshops at the Tanzu Developer Center
Leave a Reply