Kubernetes is the system we use for hosting, deploying and managing our applications. It comprises infrastructure solutions like RBAC Authorization, distributed persistent storage, managing resource quotas, managing DNS records, managing load balancers, autoscaling, blue-Green deployments, rollbacks among many others. It allows us to serve and scale our applications in an easy, secure and automated way.
The main reasons why we chose it over other alternatives are:
- It is capable of deploying complex applications, including related Servers, DNS records, and load balancers in an automated way, allowing us to focus more on the application development and less on the infrastructure supporting it.
- It can be fully managed using Terraform.
- It supports Blue-Green deployments, allowing us to deploy applications many times a day without service interruptions.
- It supports Rollbacks, allowing us to revert applications to previous versions in case the need arise.
- It supports Horizontal autoscaling, allowing us to easily adapt our applications to the loads they're getting.
- It supports Service accounts, RBAC Authorization, and IRSA, allowing to give applications permissions to external resources using a least privilege approach.
- It supports
allowing to easily distribute containers among physical machines using
cpu/memory per containerapproach.
- It has its own package manager, which makes deploying services very easy.
- It has its own local reproducibility tool for simulating clusters in local environments.
- It is Open source.
- It is not platform-bounded.
- Azure AKS, AWS EKS, GCP GKE, support it.
- It can be IaaS when implemented under a cloud provider.
- Migrating it from one cloud provider to another is, although not a simple task, at least possible.
- It is widely used by the community.
- It has many open source extensions.
The following alternatives were considered but not chosen for the following reasons:
- AWS ECS: It is a serverless service for running containers. It is expensive as only one container exists within an entire physical machine. It does not support extensions. It is platform-bounded. It is not Open source.
- AWS Fargate: It is a serverless service for running containers without administering the infrastructure they run upon. It is expensive as only one container exists within an entire physical machine. It does not support extensions. It is platform-bounded. It is not Open source.
- AWS EC2: It is a service for cloud computing. AWS EKS actually uses it for setting up cluster workers. It does not support extensions. It is platform-bounded. It is not Open source.
- HashiCorp Nomad: Currently, no cloud provider supports it, which means that having to manage both managers and workers is required. It takes a simpler approach to orchestrating applications, with the downside of losing flexibility.
- Docker Swarm: Currently, no cloud provider supports it, which means that having to manage both managers and workers is required. It takes a simpler approach to orchestrating applications, with the downside of losing flexibility.
We use Kubernetes for:
- Hosting our ASM.
- Automatically deploying ephemeral environments on CI/CD workflows.
- Automatically deploying DNS records for applications.
- Automatically deploying load balancers for applications.
- Automatically scaling worker nodes based on application load.
- Running application performance monitoring using New Relic.
We do not use Kubernetes for:
- Metrics-based autoscaling: Our autoscaling is based on the number of replicas we specify. It should instead be based on application load.
- Rollbacks: We should version production artifacts in order to be able to automatically return to a previous working version of our applications.
- Gitlab Runner: It was slow, unreliable and added too much overhead to workers. We decided to go back to Autoscaling Runner.
- Chaos Engineering: In order to harden ourselves against errors, we should create a little chaos in our infrastructure.
In order to connect to the Kubernetes Cluster, you must:
- Login as an Integrates developer using this guide.
- Install kubectl with
nix-env -i kubectl.
- Select cluster by running
aws eks update-kubeconfig --name makes-k8s --region us-east-1.
kubectl get node.
Your input should be similar to this:
These are the most commonly used kubectl commands for debugging:
|NA||Get all running pods|
|NA||Get all cluster nodes|
|Describe pod configurations|
|Get container logs from a pod|
|Access container within pod|