Using MicroK8s with Anthos Config Management in the world of IoT
When dealing with large scale Kubernetes deployments, managing configuration and policy is often very complicated. We discussed why Kubernetes’ declarative approach to configuration as data has become the most popular choice for most users a few weeks ago. Today, we will discuss bringing this approach to your MicroK8 deployments using Anthos Config Management.
Anthos Config Management helps you easily create declarative security and operational policies and implement them at scale for your Kubernetes deployments across hybrid and multi-cloud environments. At a high level, you represent the desired state of your deployment as code committed to a central Git repository. Anthos Config Management will ensure the desired state is achieved and also maintained across all your registered clusters.
You can use Anthos Config Management for both your Kubernetes Engine (GKE) clusters as well as on Anthos attached clusters. Anthos attached clusters is a deployment option that extends Anthos’ reach into Kubernetes clusters running in other clouds as well as edge devices and the world of IoT, the Internet of Things. In this blog you will learn by experimenting with attached clusters with MicroK8s, a conformant Kubernetes platform popular in IoT and edge environments.
Consider an organization with a large number of distributed manufacturing facilities or laboratories that use MicroK8s to provide services to IoT devices. In such a deployment, Anthos can help you manage remote clusters directly from the Anthos Console rather than investing engineering resources to build out a multitude of custom tools.
Consider the diagram below.
This diagram shows a set of “N” factory locations each with a MicroK8s cluster supporting IoT devices such as lights, sensors, or even machines. You register each of the MicroK8s clusters in an Anthos environ: a logical collection of Kubernetes clusters. When you want to deploy the application code to the MicroK8s clusters, you commit the code to the repository and Anthos Config Management takes care of the deployment across all locations. In this blog we will show you how you can quickly try this out using a MicroK8s test deployment.
We will use the following Google Cloud services:
- Compute Engine provides an Ubuntu instance for a single-node MicroK8s cluster. Ubuntu will use cloud-init to install MicroK8s and generate shell scripts and other files to save time.
- Cloud Source Repositories will provide the Git-based repository to which we will commit our workload.
- Anthos Config Management will perform the deployment from the repository to the MicroK8s cluster.
Let’s start with a picture
- A workstation instance is created from which Terraform is used to deploy four components: (1) an IAM service account, (2) a Google Compute Engine Instance with MicroK8s using permissions provided by the service account, (3) a Kubernetes configuration repo provided by Cloud Source Repositories, and (4) a public/private key pair.
- The GCE instance will use the service account key to register the MicroK8s cluster with an Anthos environ.
- The public key from the public/ private key pair will be registered to the repository while the private key will be registered with the MicroK8s cluster.
- Anthos Config Management will be configured to point to the repository and branch to poll for updates.
- When a Kubernetes YAML document is pushed to the appropriate branch of the repository, Anthos Config Management will use the private key to connect to the repository, detect that a commit has been made against the branch, fetch the files and apply the document to the MicroK8s cluster.
By Jeff Levine, Customer Engineer – Google Cloud
Related Google News:
- Framework for building a configuration driven data lake using Data Fusion and Composer February 25, 2021
- Using AI to explore the future of news audio February 25, 2021
- Conversational AI with Apigee API Management for enhancing customer experiences February 25, 2021
- Using artificial intelligence in breast cancer screening February 25, 2021
- VaxCare simplifies vaccine management with Android Enterprise February 25, 2021
- How to use a Machine Learning Model from a Google Sheet using BigQuery ML February 24, 2021
- Mastering Atari with Discrete World Models February 18, 2021
- Signify chooses Google Cloud IoT Core to power Philips Hue smart lighting February 18, 2021