Cloud computing is awesome for growing and scaling up infrastructure quickly to follow product needs. However, this elasticity and flexibility come at a cost. Reviewing your bill daily is crucial to avoid unpleasant surprises at the end of the month. Cloud providers offer tools ( here some examples for AWS) and good practices to help you saving money.
Most of the time, infrastructure as code (IaC) is employed to maintain and facilitate the evolution of this underlying. Like any other type of language, it should follow the same good practices and pass the code review step with other contributors. As…
In this article, we’ll have a look at how to deploy a Kubernetes cluster from scratch for a testing strategy. When developing Kubernetes-dependent features as Helm charts for example you need a cluster to test them. We don’t always have a reserved cluster for CI or maybe you want to have isolated tests to avoid side effects.
At the beginning of Kubernetes popularity raise, an easy way to play and learn was to deploy a cluster using Minikube. We’ll see why it is not the most suitable solution for pipelines compared to currently available solutions. Now it is possible to…
Do you need to test some pieces of code interacting with AWS? In this article, I’m going to introduce the Moto library whose aim is to mock out AWS services. That means you won’t have to deploy anything in the AWS cloud to test your code.
In the first part, we’ll create a simple piece of code interacting with the Elastic Compute (EC2) service. We’ll examine the different ways of mocking provided by Moto. This will give you an overview of its possibilities.
Next, we’ll couple the Moto library and pytest framework to have clean and scalable unit tests.
In a previous article, I presented to you coding-style importance and pre-commit framework. Today, we’re going to handle pre-commit for Terraform code. It will be in charge of validating code using linters and scanners. For any new git commit, we’ll be able to ensure there is no regression and keep a constant quality.
First of all, we’ll create a Terraform module for having something to test. The modules are good to not duplicate code and should be hardly tested to be reliable. We’ll have a look at which pre-commit plugins to use for Terraform.
Recently I have confronted myself with the need of using a static IP with load-balancers. The reason was to be able to whitelist IP addresses in firewalls. By making some researches, I have discovered that ELBv1 does not support this feature. ELBs manage IP addresses behind the scene you have no control over it.
The first step was to migrate to a network load-balancer (NLB). In the first section, we’re going to inspect its characteristics. Then we put in place a small Terraform project to assigned reserved public IP to an NLB.
At first view, the NLB looks like ELBv1…
Prometheus is an open-source project for monitoring and alerting metrics. It relies on a time-series database that is well suited to IoT purposes. In this article, we’ll see how to collect temperature and humidity from a Raspberry Pi. These metrics are collecting from a DHT22/AM2302 sensor. We’re going to see how to connect the sensor to the card and confirm data acquisition.
The next step is the implementation of a Prometheus exporter in Golang. An exporter exposes the metrics through an HTTP server with good format. The Prometheus server calls the exporter to collect and stores the metrics. …
In December 2020, the Kubernetes project has deprecated docker. Through this lecture, we are going to have a first look at the
dockerhistory to understand the reasons for this deprecation. This will bring us next to discover
containerdand figure out its advantages.
We will practice
containerd by installing it on a Raspberry Pi. This target platform is a good scenario to dig into the different components needed to use
containerd. There are no available binaries so we will build them from the sources. …
Code is not something frozen through time but it evolves with the team and the project. Writing good code does not imply only writing code well suited to the use case and optimized but also readable. Sometimes during the project lifecycle, the code readability may decrease. This could come due to a variety of factors as few described below to give you a picture :
Standardization has a lot of advantages…
Dataclasses are among the new features introduced by Python 3.7. Its goal is to simplify the class creation containing mainly data without functionality. This can be compared to commonly used data structures.
When using a class as a data structure, we have to implement the same methods as
__repr__(), which is cumbersome. Dataclasses autogenerates these methods for us. This offers more transparency in the language.
The declaration of a data class is done by affecting a decorator to a class. In the example below, we will create a data class to represent GPS coordinates:
You can directly…
In October 2020, HashiCorp announced the launch of its product named Waypoint. It provides a modern workflow to build, deploy and release across platforms. We’re going to build a golang application and release it to Kubernetes.
The build step will detect the source language and compile it with cloud-native buildpacks. The resulting outcome will be a docker image stored in a Harbor remote registry. We’ll see how to configure Harbor on a local Kubernetes cluster.
Waypoint will reuse this image to deploy and release it into the cluster. …