Skip to main content

Your submission was sent successfully! Close

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

Thank you for contacting us. A member of our team will be in touch shortly. Close

  1. Blog
  2. Article

Michael C. Jaeger
on 9 November 2023

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:
https://HOSTS/

4. The HOSTS can be obtained using the command:

$ microk8s kubectl get ingress -n microcks microcks

NAME CLASS HOSTS                          ADDRESS   PORTS   AGE
microcks public  microcks.192.168.42.139.nip.io 127.0.0.1  80, 443 5d23h

Now you can continue to use Microcks – happy API(s) mocking and testing: https://microcks.192.168.42.139.nip.io/

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

Related posts


Marcin "Perk" Stożek
14 March 2024

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

Kubernetes Article

Try the new Canonical Kubernetes beta, our new distribution that combines ZeroOps for small clusters and intelligent automation for larger production environments that also want to benefit from the latest community innovations ...


Marcin "Perk" Stożek
14 December 2023

Canonical Kubernetes 1.29 is now generally available

Kubernetes Article

A new upstream Kubernetes release, 1.29, is generally available, with significant new features and bugfixes. Canonical closely follows upstream development, harmonising our releases to deliver timely and up-to-date enhancements backed by our commitment to security and support – which means that MicroK8s 1.29 is now generally available as ...


Serdar Vural
5 December 2023

Canonical joins the Sylva project

Canonical announcements Telecommunications

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 infrastructure solutions to Sylva and contribute to the project’s goal of providing a platform to validate cloud-native telco functions. Sylva was created to accelerate the cloudification of ...