본문 바로가기

An Introduction to Kubernetes

Base Terms

CNCF (Cloud Native Computing Foundation)

  • The Cloud Native Computing Foundation (CNCF) builds sustainable ecosystems and fosters a community around projects that orchestrate containers as part of a microservices architecture. Kubernetes is a CNCF project.

Kubernetes

  • Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.
  • Container를 쉽고 빠르게 배포/확장하고 관리를 자동화해주는 OpenSource Flatform입니다. 즉, Container를 Orchestration Tool 이다.
    • 비슷한 역할을 하는 Tool로는 Docker Swarm, AWS ECS, Hashicorp Nomad, Mesos Marathon등이 있다.

K8S

  • k8s is short for Kubernetes.

Kubernetes Architecture

Kubernetes components

Kubernetes Master

API Server(=Kube-apiserver)

  • The API server is a component of the Kubernetes control plane that exposes the Kubernetes API. The API server is the front end for the Kubernetes control plane.
  • 쿠버네티스는 MSA 구조로 되어 있어 여럭개의 분리된 프로세스로 구성되어 있습니다. 그중에서 API Server는 Cluster의 API를 사용할수 있게 해주는 Process 입니다. Cluster로 요청이 왔을때 요청이 유효한지 검증하는 역할을 합니다.

Etcd

  • Consistent and highly-available key value store used as Kubernetes' backing store for all cluster data.
  • Etcd는 고 가용성을 제공하는 Key-Value 저장소 입니다. Kubernetes에서 필요한 모든 데이터를 저장하는 DataBase입니다.

Kube-scheduler

  • Control plane component that watches for newly created Pods with no assigned node, and selects a node for them to run on.
  • 새로운 POD가 만들어질때 현재 Cluster내에서 자원할당이 가능한 Nodes중에 알맞은 Node를 선택해 Pod를 생성하는 역할을 합니다.

Kube-controller-manager

  • Control Plane component that runs controller processes.
  • Kubernetes는 각각의 Controller들이 Pod들을 관리하는 역할을 합니다. Kube-controller-manager는 각각의 컨트롤러들을 실행하는 역할을 합니다.

Cloud-controller-manager

  • A Kubernetes control plane component that embeds cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider's API, and separates out the components that interact with that cloud platform from components that just interact with your cluster.
  • Cloud Service Provider(AWS, GCP, Azure, etc..)에서 자신들의 서비스와 연계해서 사용하기 위해 사용 합니다.

Kubernetes Worker Node

Kublet

  • An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod.
  • 각 노드별 실행되는 Agent입니다. Pod안에 Container들을 실행되는 것을 직접적으로 관리하는 역할을 합니다.

Kube-Proxy

  • kube-proxy is a network proxy that runs on each node in your cluster, implementing part of the Kubernetes Service concept.
  • Kubernetes는 Cluster 내부에 별도의 가상 Network를 설정하고 관리합니다. Kube-Proxy는 이러한 가상의 네트워크를 동작할 수 있게 하는 실질적인 역할을 하는 Process입니다.

Container-Runtime

  • The container runtime is the software that is responsible for running containers.
  • Container-Runtime은 Container를 실행시키는 역할을 합니다. OCI(Open Container Initiative, https://www.opencontainers.org/)의%EC%9D%98) Runtime 규격(runtime-spec)을 구현하고 있는 Container Runtime이면 Kubernetes에서 사용할 수 있습니다.

Addons

DNS Addons

Dashboard Addons

  • Kubernetes Dashboard

Logging Addons (Container Resource, Cluster logging)

Cluster Level Logging

Node Level Logging

  • FluentD (https://docs.fluentd.org/v/0.12/)
    • Fluentd is an open source data collector for unified logging layer. Fluentd allows you to unify data collection and consumption for a better use and understanding of dat
  • metrics-server
  • Heapster (Deprecated after v1.13 it is replaced by metrics-server)

Authorization Addons

  • rbac

Basic Object

POD

  • The smallest and simplest Kubernetes object. A Pod represents a set of running containers on your cluster.
  • Pod는 Kubernetes에서 Application을 실행하는 가장 작은 단위이다. Pod는 1개의 Container 또는 2개 이상의 Container로 구성 가능하다.

Service

  • An abstract way to expose an application running on a set of Pods as a network service.
  • Network와 관련된 Object입니다. Pod를 외부 Network와 연결해주고 여러 개의 Pod를 바라보는 내부 Load Balancer를 생성할때 사용합니다. 내부 DNS에 서비스 이름을 Domain으로 등록하기 때문에 Service Discovery 역할도 합니다.

Volume

  • A directory containing data, accessible to the containers in a Pod.
  • 저장소와 관련된 Object입니다. Host Directory를 그대로 사용할 수도 있고 EBS 같은 Storage를 동적으로 생성하여 사용할 수도 있습니다.

Namespace & Label

  • Namespace : An abstraction used by Kubernetes to support multiple virtual clusters on the same physical cluster.

  • Label : Tags objects with identifying attributes that are meaningful and relevant to users.

  • 하나의 Cluster를 논리적으로 구분하여 사용할 수 있습니다. 또한 라벨 기능을 적극적으로 사용하면 유연하면서 확장성 있게 리소스를 관리 할수 있습니다.

Higher-level abstractions Object

Deployment

  • An API object that manages a replicated application, typically by running Pods with no local state.
  • Deployment는 새로운 버전의 Application을 다양한 전략으로 무중단 배포할 수 있다.

DaemonSet

  • Ensures a copy of a Pod is running across a set of nodes in a cluster.
  • Log나 Monitoring 등 모든 Node에 설치가 필요한 경우에 DeamonSet을 사용할수 있다.

StatefulSet

  • Manages the deployment and scaling of a set of Pods, and provides guarantees about the ordering and uniqueness of these Pods.
  • 실행 순서를 보장하고 호스트 이름과 볼륨을 일정하게 사용할 수 있어 순서나 데이터가 중요한 경우에 사용할 수 있다.

ReplicaSet

  • A ReplicaSet (aims to) maintain a set of replica Pods running at any given time.
  • Pod를 여러 개(한 개 이상) 복제하여 관리하는 Object입니다. Pod를 생성하고 개수를 유지하려면 반드시 ReplicaSet을 사용해야 합니다.

Job

  • Job : A finite or batch task that runs to completion.
  • Cronjob : Manages a Job that runs on a periodic schedule.
  • 배치성 작업이나 스케쥴 작업이 필요할 경우 Job과 Cronjob을 사용할 수 있다.

Reference

'Kubernetes' 카테고리의 다른 글

asdf (switch kubectl version)  (0) 2022.06.09
kubectx, kubens (k8s 유용한 툴)  (0) 2022.06.02
Kubernetes Basic (MSA에서 Kubernetes)  (0) 2020.08.06

Secuof Blog