Anthos lightweight developer sandbox
A quick way to get started using some features of GCP Anthos.
In this post, we are going to have a look at the free Anthos developer sandbox provided by the Google cloud platform (GCP) that was announced in November 2020.
In the next 5 minutes, we will go over why you would use it and what benefits it can provide to you as a tool with cloud-native development in mind. We will take a look at the components used as well as the pros and cons of its features.
First, let’s go over what Anthos is. And we don’t mean the autonomous area in northeastern Greece :)
What is Anthos from GCP?
As enterprise companies begin to adopt Kubernetes and get comfortable with using a wide range of managed, self-hosted or bare metals clusters to host their applications, maintenance/visibility can become tricky.
If the organisation has a hybrid based model in which multiple teams are running multiple clusters across public clouds and on-premise data centres how can they manage all these in one place?
This is where Anthos from GCP can assist, Anthos is essentially a meta control plane for all your clusters. It is designed to give a consistent user experience no matter where you deploy or run your cluster spanning multiple environments. The Anthos platform enables you to manage core operations such as cluster lifecycle, deployments, configurations and policies.
This can help SRE and DevOps teams day to day operations and avoid any unwanted cluster configuration drift as well as maintain desired state of configuration across the estate.
Let’s have a look at the following.
“As a developer, I am interested in deploying our application onto Kubernetes. We are in the early stages of adoption and want to provide a proof of concept. We currently have no running cluster in our estate and intend to keep the cost low. We are aware of Anthos’ offering from GCP to run workloads across different public cloud providers.”
In this scenario it would be an ideal situation to use this new sandbox, so let’s dive deeper and explore.
TL;DR
Anthos is a great tool for an organisation that are running cluster workloads across multiple clouds. The free Anthos developer sandbox can be a great starting point for developers to get familiar with the tools Anthos has to offer.
What is Google Anthos free developer sandbox?
Yes, you read correctly this is a free service. You don’t even need a GCP account or active project. All you need to get it up and running is a simple Google account.
Do not expect a full simulator of the Anthos service; it is designed as an introduction to the development side of the platform with a strong emphasis on automation in mind. Some core components of the Anthos platform such as the embed service mesh powered by Istio or configuration management will not be available also.
What this sandbox can provide is an environment to rapidly deploy, test and debug your application code, using tools that Anthos would utilize. The main one being, of course, Kubernetes the cloud-native container orchestrator. Along with providing a testing ground for deploying your application on Kubernetes, it can also give you insight into a few other bespoke tools from Google.
What components are used?
Cloud Shell Editor: It acts as the main UI to the sandbox with terminal access essentially a development workstation in the cloud.
Cloud Build local: This is a service for running image builds locally without needing a GCP account. It will allow you to run the same build our continuous integration suite would run but locally.
Cloud Code: A set of power plugins for the cloud shell IDE such as MiniKube, Skaffold and Google cloud run to help test and run your code with just a click of a button. I will explain these features in much more detail below.
- minikube: To simulate running code on Kubernetes, Mini Kube is built into the sandbox. This is a single node lightweight cluster that runs on a VM complete with a control plane. You get full access to the cluster.
- Skaffold: This is a tool that helps facilitate continuous development for Kubernetes applications and resources. Will automatically detect a change in source code and deploy.
- Google Cloud Run: To simulate containerised application code but on a fully managed serverless platform. Pure abstraction from infrastructure built using Google Knative.
These three components provide you with everything you need to continuously, debug, and test your own applications before deploying to Anthos.
All these tools glue together in a nice smooth easy to use package, you can get a feel for each tool and see what works best for your application. Most of the underlying hard work is abstracted away from you and as a developer, this is exactly what you would find very appealing.
What is included?
Upon firing up the sandbox in your browser you will be presented with the main Cloud Shell UI. It will give you an option to clone an example repository if you wish or alternatively use your own application code by importing your own files to the IDE.
The example repo contains the following files which can be found here
Let’s go through some of the core files and what their purpose is.
Kubernetes manifests files: These are declarative YAML files to create the deployment and service resources. These will declare all the configuration for the native Kubernetes resources that will be deployed on the cluster. The developer will still require some knowledge on how to write these and they are well documented.
apiVersion: apps/v1
kind: Deployment
metadata:
name: anthos-sandbox-sample-application
spec:
replicas: 1
selector:
matchLabels:
app: anthos-sandbox-sample-application
template:
metadata:
labels:
app: anthos-sandbox-sample-application
spec:
containers:
- name: server
image: anthos-sandbox-sample-application
ports:
- containerPort: 8080
env:
- name: PORT
value: "8080"
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
The polling configuration for skaffold to find where the application code is and corresponding Kubernetes resources files are located within the repo.
apiVersion: skaffold/v2beta4
kind: Config
build:
tagPolicy:
sha256: {}
# defines where to find the code at build time and where to push the resulting image
artifacts:
- context: src
image: anthos-sandbox-sample-application
# defines the Kubernetes manifests to deploy on each run
deploy:
kubectl:
manifests:
- kubernetes-manifests/**
The cloud build config file for the image that will be built.
steps:
- name: 'gcr.io/k8s-skaffold/pack'
entrypoint: 'pack'
args: ['build', '--path', 'src', '--builder=gcr.io/buildpacks/builder', 'anthos-sandbox-sample-application']
- name: 'anthos-sandbox-sample-application'
entrypoint: 'test'
Summary, to use or not to use?
So now let’s recap the core features and pros/cons of using this sandbox.
Features
- Quickstart tutorial to get started using the sandbox with an example repository provided.
- All contained in one browser, no need to provision any infrastructure built for developers.
- Example application code provided or import and use your own.
- Cloud Shell IDE is easy to use with built-in Google cloud API documentation, although you will need a valid GCP project for full integration.
- Use Cloud code plugins to automatically deploy your application onto a miniKube cluster.
- Change Kuberenets YAML manifest configuration and cluster is instantly updated. For example, quickly scale your deployment from 1 to 5 replicas seamlessly.
- Use Cloud-build local to run tests. Upon completion of the test, a new image will be built.
- Web endpoint provision automatically so you can get instant feedback on how your frontend app will look to users.
Pros
Completely free!
- Pretty impressive you can do all this without even having a GCP account/project you can get hands-on with Google cloud tools quickly.
- Makes it easy to deploy cloud-native apps using Kubernetes and understanding how they react in a containerised environment.
- Perfect for short quick proof of concept design to showcase tools used by Anthos.
Cons
- MiniKube cluster provided is just a one-node cluster. You will not get a true representation of deploying your application on a full-fledged managed or self-hosted cluster.
- Not a full sandbox of the Anthos product core features missing, only really showcasing the application development area of the product.
- Session timeouts if you accidentally quit the browser tab. The session will be lost and the environment will need to be provisioned again.
That's a wrap, thanks for reading and hope you found this informative. Contino is always hiring please get in touch with me on LinkedIn to find out more.
Thanks!