Your submission was sent successfully! Close

You have successfully unsubscribed! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates about Ubuntu and upcoming events where you can meet our team.Close

Turbocharge your API and microservice delivery on MicroK8s with Microcks

In the fast-paced world of software development, the ability to deliver and iterate quickly on APIs and microservices is essential. Traditional testing methods can be time-consuming and often slow down development cycles. That is where API and service mocking tools like Microcks can come to the rescue.

Microcks shipped as a new community add-on for the recent MicroK8s 1.28 release. Microcks is a Cloud Native Computing Sandbox project dedicated to API mocking and testing tools on Kubernetes. Developers use Microcks to create mock APIs, automate API testing, and speed up the cloud-native applications life cycle.

With the help of Microcks on MicroK8s, you can turbocharge your development and testing processes. This blog explains the motivation for API and service mocking, introduces Microcks and delves into why MicroK8s is an excellent platform for Microcks.

Why mocking services is useful

Before we dive into the specifics of Microcks and MicroK8s, it’s crucial to understand the motivation behind API and service mocking. In modern software development, especially in the context of microservices and APIs, there are several reasons to adopt a mocking strategy:

1. Parallel development: Mocking allows developers to work on different components of an application or service independently.

2. Early testing: Mocking enables early testing of applications and APIs, even when the actual services are not yet fully implemented.

3. Reducing dependencies: Mocking helps to reduce dependencies on external systems or third-party APIs, making it possible to develop and test without relying on external factors that may not be under your control.

4. Cost-efficiency: Mocking can be a cost-effective strategy, as you don’t need to spin up and maintain costly services during the development and testing phases.

How does Microcks provide mocking?

Microcks is an open-source platform facilitating API and service mocking, testing, and automation. What sets Microcks apart is its provision of a consistent and uniform approach for all types of request/response APIs (such as REST, GraphQL, gRPC, SOAP) and event-driven APIs (currently supporting eight different protocols) in four main steps:

1. Mocking Services: Microcks allow you to create and manage mock services from your specifications that simulate the behaviour of actual services. This facility empowers developers to work independently on components, even when the services still need to be implemented. 

2. Testing the APIs: Microcks provides comprehensive testing capabilities, including integrating popular testing frameworks (e.g. postman collections). It allows you to validate your API’s functionality and ensure it meets the required specifications.
3. Automating testing: Microcks boasts an impressive automation capability with CI/CD integration and a wide range of plugins, accelerating your development and testing processes.

Microcks “Add to your CI/CD” button GitLab example.

4. Observe and analyse: Microcks offers monitoring and analytics features to help you gain insights into the coverage and test the quality of your services and APIs. This information can be invaluable for improving and optimising your services.

Microcks governance and observability dashboard.

Now that we’ve covered the basics of Microcks, let’s explore why running it on MicroK8s is an excellent choice.

MicroK8s – The ideal platform for Microcks

MicroK8s is a lightweight and easy-to-install Kubernetes distribution covering local development, testing, and production use cases. It is a superb choice for running Microcks for several reasons:

1. Lightweight and fast: MicroK8s focuses on a lightweight and rapid design, which makes it an excellent choice for local development and testing. Setting up a Kubernetes cluster within seconds lets you quickly begin your projects.

2. Easy Installation: MicroK8s boasts a simple installation process. It is a single snap package that can be installed on various Linux distributions, making it accessible to a wide range of developers.

3. Isolated development environment: MicroK8s provides an isolated development environment for your services and applications. You can test your microservices and APIs without worrying about interfering with your production environment.

4. Addons: MicroK8s offers a selection of valuable addons; these can extend the functionality of your Kubernetes cluster and help you set up Microcks effortlessly.

5. Auto-clustering using tokens: MicroK8s allows you to create multi-node clusters for more complex testing scenarios. A setup with multiple nodes is especially valuable when working with microservices that require inter-service communication and orchestration.

6. High Availability: For small-scale production deployments, MicroK8s provides high-availability options. This means you can use it not only for development and testing, but also for production use.

While there are other Kubernetes distributions available, MicroK8s offers unique Ubuntu native advantages: simplicity, efficiency, extensibility and bug fixes, security patches and support with Ubuntu Pro.

How to get started with Microcks on MicroK8s

Getting started is very easy: Follow the steps below to install on MicroK8s instances on Intel x86 architecture to enable the Microcks addon:

1. Enable the Microcks addon on MicroK8s:

$ microk8s enable community
$ microk8s enable microcks

2. Wait until all the microcks services move to a running state:

$ microk8s kubectl wait pod --all --for=condition=Ready --namespace=microcks

3. Once the services are ready, open the Microcks web page:

4. The HOSTS can be obtained using the command:

$ microk8s kubectl get ingress -n microcks microcks

NAME CLASS HOSTS                          ADDRESS   PORTS   AGE
microcks public  80, 443 5d23h

Now you can continue to use Microcks – happy API(s) mocking and testing:

Microcks home page.

If you are looking to turbocharge your API and microservice development, give Microcks on MicroK8s a try and experience the benefits of accelerated development cycles and robust testing.

Learn more

kubernetes logo

What is Kubernetes?

Kubernetes, or K8s for short, is an open source platform pioneered by Google, which started as a simple container orchestration tool but has grown into a platform for deploying, monitoring and managing apps and services across clouds.

Learn more about Kubernetes ›

Newsletter signup

Get the latest Ubuntu news and updates in your inbox.

By submitting this form, I confirm that I have read and agree to Canonical's Privacy Policy.

Related posts

How should a great K8s distro feel? Try the new Canonical Kubernetes, now in beta

Try the new Canonical Kubernetes beta, our new distribution that combines ZeroOps for small clusters and intelligent automation for larger production...

Canonical Kubernetes 1.29 is now generally available

A new upstream Kubernetes release, 1.29, is generally available, with significant new features and bugfixes. Canonical closely follows upstream development,...

Canonical joins the Sylva project

Canonical is proud to announce that we have joined the Sylva project of Linux Foundation Europe as a General Member. We aim to bring our open source...