8 June 2021
Kubernetes is an open-source platform that allows you to containerize workloads and services. Containers are a good way to bundle and run your applications.
Kubernetes what is it?
To ensure that there is no downtime in a production environment if a container goes down, another needs to restart. To do that, you need a tool that takes care of your scaling requirements, failover, deployment patterns, and more. Kubernetes is that tool! Padok gives you a Kubernetes overview of everything you need to know about this technology.
Docker vs Kubernetes: are they really different?
Docker and Kubernetes are not comparable even if they both help you run an application.
Docker is a container technology that virtualizes an operating system and runs your application. It enables teams to bridge the gap between development validation and production environments by enforcing the similarity between all the environments.
Kubernetes is an orchestration tool. It enables you to manage containers. This way, your deployments are smoother and Kubernetes take care of non-functional containers, meaning when one crashes a new one is automatically created. Thus the 0 downtime objective becomes more achievable. Moreover, Kubernetes is easily accessible with the Cloud thanks to all the managed services available on the big Cloud Providers.
Kubernetes Essentials: The basic components, pods, services, and more!
Kubernetes is composed of many components that work together to simplify infrastructure management. First, you will find a pod which is the base of Kubernetes. It is responsible for managing containers, storage resources, and network IPs. Above a pod, you have a node (a pod runs on a node) which is a worker machine. Here are the two first components of Kubernetes. To know more about pods, nods, services, deployments, secrets and other Kubernetes components, check this article.
Kubernetes’ Architecture: Understanding the Components and structure of the clusters
A Kubernetes cluster is deployed through several nodes. It can scale from a single node cluster to a 5000 node cluster with no impact on the architecture.
The Kubernetes cluster architecture could be split into two parts:
- The Master node is the brain of Kubernetes. It handles the API server (to receive orders) the ETCD( to keep secrets), and a lot more like the Scheduler and the Controller Manager.
- The Worker nodes which could be compared to the body of Kubernetes with the container runtime (to have Docker up and running), the Kubelet (to receive orders) and much more like the Container Network Interface, Kube DNS or Kube Proxy
Openshift vs. Kubernetes
We often see the request "what is the difference between OpenShift and Kubernetes?", which is a misconception because we can't talk about differences since they are complementary. OpenShift is a Kubernetes' based orchestration platform. Thus OpenShift can't be used without Kubernetes. It even ends up being OpenShift Kubernetes Distribution (OKD). OKD is built on top of Kubernetes and gives additional resources, such as templates to share resources models as cluster resources, etc. Therefore, Red Hat OpenShift is more than just Kubernetes.
How to use Kubernetes?
Kubernetes on Google Cloud Platform: Terraform your first cluster (1/3)
Google Cloud Platform offers a service called GKE (Google Kubernetes Engine), which eases the workload of Kubernetes' management: Google handles the major update and security patch of Kubernetes so you can focus on your app. Terraform enables you to code your infrastructure and to take advantage of all the benefits of a versioned codebase.
You can follow this tutorial to set up your first Kubernetes cluster on Google Cloud Platform with Terraform.
Kubernetes on Google Cloud Platform: deploy your application with Helm (2/3)
After setting up your first Kubernetes Cluster on Google Cloud Platform, the next step is to use Helm to deploy an application on this cluster. Helm is a Kubernetes package manager enabling you to create app releases or to install common tools, like monitoring ones.
Here is an example of the deployment of a simple Node JS application. Follow this tutorial to implement Helm on your Kubernetes Cluster with Google Cloud Platform. To gain productivity, we will soon give you some tips about how to automate Helm Chart deployment on GKE with CloudBuild. To get notified when the article gets published you can follow us on Twitter.
How to use Kubernetes Secrets?
A Kubernetes secret is a resource for safely storing small chunks of data, such as SSL certificate and keys, database passwords, etc. It is accessible from a Kubernetes pod. A Kubernetes secret is used for sensitive information, but how safe it is? And how to create one? We are giving you all the keys to create and use Kubernetes Secrets, as well as tips to make it even more secure.
Monitoring Kubernetes: Which tools to use?
Monitoring and alerting tools are usually working together. Indeed, monitoring your resources is not the same as receiving alerts when there is a problem. But they are both needed, especially if you use Kubernetes, considering pods are not statics. Your monitoring system has to give you all the metrics you need (Node CPU, RAM, …) to be efficient. To measure metrics, there are many tools that you can use, such as Prometheus, Datadog, and Kubewatch.
Kubernetes tips and tricks
Kubernetes productivity tips and tricks
There is a powerful command-line tool from Kubernetes that could help you gain productivity. Indeed, Kubectl allows deploying Kubernetes system or makes some Kubernetes features easily usable. Here are Kubernetes tips and tricks to code and deploy faster!
Using Helm and Kubernetes to merge ConfigMap and Secret in a single file
A common issue with Kubernetes is linked to configmap and secret. It can be difficult to set up a secret as an environment variable since Kubernetes only support passing this type of variable as a single configuration file. In order to fix that problem that you may encounter here is a tip on how to use Helm and kubernetes to merge Configmap and Secret in a single file.
Iteratively create Kubernetes CronJob by refactoring your Helm templates
To package a Kubernetes application, deploy and rollback easily, Padok's advice is to use Helm. It is a powerful tool but be aware of the refactoring issues because of the multiplication of templates. To fix this, there is a way to create one Helm template to rule many crons at the same time, read this article to find out how.
Create a CodePipeline to deploy an EKS Cluster with Helm
Creating an automated pipeline to update your cluster and deploy your application at every commit on EKS might be tricky. EKS is the AWS Kubernetes managed service. With Gitlab CI it is relatively easy to create an automated pipeline. It is still possible to do it without this technology by using CodePipeline, CodeBuild, or even Helm. Follow this tutorial to learn how to create a CodePipeline to deploy an EKS cluster with Helm.
Kubernetes is a complex technology. Load balancing, storage orchestration, automated rollouts and rollbacks, automatic bin packing, self-healing, and secrets management can be confusing. No worries, you can find many resources online to help you or you can contact specialists like Padok to migrate your infrastructure on Kubernetes.