Skip to content

Ercan Ermis

notes for everyone

Menu
  • AWS
  • Kubernetes
  • Linux
  • DevOps
  • Docker
  • GCP
  • Uncategorized
  • Contact Me
Menu

Let’s Learn Kubernetes – Part 2

Posted on June 19, 2022June 19, 2022 by Ercan

Hello, here is Part 2 of the Let’s Learn Kubernetes series. If you want to read Part 1, you can follow Let’s Learn Kubernetes – Part 1

Deployment and StatefulSet

In this example, Database containers are using remote or cloud storage.

In this example, now everything is running perfectly without any issue and the user can access the application via a browser.

When the Application container dies in Node 1, automatically another Application container can handle the requests on Node 2. Even if the Node 1 host can completely fail, in this scenario Node 2 will handle all requests with database operations.

If you are just running the application on a single node and when something goes wrong, you will get downtime and the users can not access your application as well. Do not run a single node in production. You should replicate everything on multiple servers and/or nodes!

Service

Service has two functionalities.

  • Static IP: It comes with DNS Name. It means you do not have to adjust anything on the network level when your pod dies.
  • Load Balancer: The service is catching all requests and makes a decision to send users’ requests directly to pods which is less busy.

Deployment

If you want to create a second replica of the application, basically, you can not create pods, we are calling it “Deployment“. You can define blueprints for pods for the application and specify how many pods you want to run. Deployment is another component of Kubernetes. Practically, you are not creating and/or working with pods, you need to create Deployments for replication and scale-up/scale-down needs. The pod means an abstraction layer on the containers and the deployment is another abstraction layer as well.

StatefulSet

We cannot replicate the database using a deployment because databases have a state which is data. It means if you have clones or replicas of the database all we need is to access the same shared volume (storage of data) and you need a mechanism to manage which pods will write to data volume and which pods will read a data from the volume. It’s all about Avoid data inconsistencies. You can use another Kubernetes component called StatefulSet. You should use StatefulSet for applications like databases like Redis, MongoDB, ElasticSearch, PostgreSQL, and MySQL, …

The k8s Architecture

There are two types of Kubernetes nodes that operate. One is the master and another one is a slave. Let’s learn what is differences between them and understand the roles each one has inside of the cluster.

Master Processes

All managing processes are done by Master Nodes. Master nodes are really different than nodes. Master nodes control these operations:

  • Schedule the pods
  • Monitor the pods
  • Re-schedule and/or re-start pods
  • Accept the new node to join to cluster

All master nodes should install these components.

  • API Server: When you deploy a new application, it talks with API Server. We can call API Server as a cluster gateway. It acts also a gatekeeper for authentication. If you have a UI to manage your cluster, it is also talking with API Server as well. API Server also talks with Scheduler to run the new pod(s).
  • Scheduler: Scheduler is deciding which pod should run into The node. It knows how many resources you are using and how many resources are available (such as CPU, RAM, etc.). Which node has more resources, Scheduler is running the new pod(s) in it.
  • Controller Manager: Checking the states of the cluster and detecting the latest state of pods like crashing or something goes wrong. The Controller Manager tries to re-run failed pods and it talks with Scheduler immediately. The Scheduler decides to run the pod(s) on which node(s).
  • etcd: It’s like a brain of Kubernetes cluster and keeping the state changes like KEY:VALUE and it stores this information in it. When you send a request to API Server for checking the states of pods, this information comes through etcd and etcd is keeping all of the information as well. etcd does not store application data, it’s just storing information about the Kubernetes cluster.

Node Processes

Let’s think of a node that is running two different pods in it. One is the application and the other is the database. One of the main Kubernetes architectures are worker servers/nodes.

  • Each Node should have multiple Pods on it
  • Three processes should be installed on every Node (Container Runtime, kubelet, and Kube Proxy)

Now, you know the Deployment, StatefulSet, and Kubernetes architecture. I hope you enjoyed this article! You can follow me on Twitter (https://twitter.com/flightlesstux) to know when Part 3 is coming…

Share on Social Media
twitter facebook linkedin reddit

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • What is an Internet Gateway in AWS?
  • What are Route Tables on AWS VPC?
  • What is Subnet on AWS VPC?
  • What is AWS VPC?
  • Prevent nginx from caching DNS for proxy
  • Scaling PHP Applications on AWS
  • Create an S3 Bucket and Set a Policy via CLI
  • Issue a Let’s Encrypt SSL with the AWS Route53
  • Automate Let’s Encrypt SSL on AWS Application Load Balancer
  • Let’s Learn Kubernetes – Part 3
  • Deploy a website to S3 and CloudFront with Bitbucket Pipelines
  • Let’s Learn Kubernetes – Part 2
  • Protect your AWS Account with specified IPs
  • Let’s Learn Kubernetes – Part 1
  • Differences between AWS CLI v1 and v2
  • SSL CA Problem on CentOS7 Docker and Solution
  • What do I have?
  • Deploy HA nginx to AWS ECS with Geolocation Routing via Terraform
  • Deploy nginx docker to AWS ECS with Terraform Automation
  • How to Install Node Exporter on Linux Server
  • FortiClient Problem on M1 MacBookPro Problem Solution
  • Connect your AWS to GCP with Terraform via IPSec Site-to-Site VPN
  • Google Cloud Platform Automation with Terraform Easily
  • How to secure your Amazon Web Services account
  • Install UGREEN USB Ethernet Adapter on macOS
  • Redirect 301 HTTPS on App Engine with nginx on Google Cloud Platform
  • Set two different Target Groups on AWS Load Balancer with Terraform
  • Extend your ec2 Linux disk without reboot on Amazon Web Services
  • Create a New Grant User on AWS RDS (MariaDB)
  • Amazon S3 CORS Settings with CloudFront on Amazon Web Services
  • Take your GitLab backup everyday if it works in Docker
  • Find large files in CentOS, ubuntu and MacOS easily
  • Fix “Error: rpmdb open failed” on CentOS or Amazon Linux 2
  • Error: No space left on the device when starting/stopping services only
  • Juniper SRX110H-VA VDSL2 Configuration Step by Step
  • Enable Logrotation for Docker Containers
  • Download specific file extension via wget easily on terminal
  • Find the exact size of certain files in Linux via terminal
  • Disable SELinux on CentOS 7 or CentOS 8
  • Hello Blog!

Tag Cloud

active-active amazon linux 2 amazon web services automation aws basics bug centos centos7 cloud cloudfront container containers crud curl deployment devops docker ec2 ecs fargate file size gcp gitlab google cloud platform iam policy k8s kubernetes kubernetes architecture kubernetes basics linux macos network nginx pipeline replicaset route table s3 security terraform ubuntu vpc vpn wget yum

Archive

  • January 2023 (2)
  • December 2022 (2)
  • August 2022 (2)
  • July 2022 (3)
  • June 2022 (6)
  • March 2022 (1)
  • July 2021 (1)
  • May 2021 (5)
  • April 2021 (5)
  • February 2021 (1)
  • January 2021 (1)
  • September 2020 (2)
  • July 2020 (1)
  • April 2020 (1)
  • March 2020 (1)
  • February 2020 (1)
  • November 2019 (5)
©2023 Ercan Ermis | Built using WordPress and Responsive Blogily theme by Superb