강의영상 : https://www.youtube.com/watch?v=s_o8dwzRlu4
open source container orchestration tool(e.g., docker contatiner)
Developed by Google
Helps manage containerized applications in different deployment environments(physical machine/virtual machine/cloud/hybrid)
Trend from Monolith to Micorservices
Increased usage of contatiners
Demand for a proper way of managing those hundreds of containers
High Availability or no downtime
Scalability (load - performance)
Disaster recovery (back up and restore)
Master node(control plane) + a couple of worker nodes(=nodes)have to at least two Master nodes inside of Kubernates cluster because it is important
runs several Kubernetes processes that are absoultely necessary to run and manage the cluster properly
1) API server : Entrypoint to K8s cluster(process which different kubernetes clients talk to API server, e.g., UI(dashboard), API, Command line tool(KUBECTL) : YAML or JSON)
2) Controller Manager : Keeps track of what happening in the cluster(whether something nees to be repaired or maybe if a container died and it needs to be restarted etc)
3) Scheduler : decides on which Node new Pod shold be scheduled based one the available resources on each worker node and the load that that container needs
4) etcd : Kubernetes backing store(key value storage) which basically holds at any time the current state of the Kubernetes cluster, e.g., configuration data, status data of each node and each container. Backup and restore are made from etcd snapshots
runs actual work
Each node has a Kubelet(node agent) process running on it
Kubelet is a Kubernetes process that maskes it possible for the cluster to communicate each other and execute some task on those nodes
high load
enables master nodes and worker nodes talk to each other
creates one unified machine
smalles unit in Kubernetes
abstraction over container
creates running environment or a layer on top of the container
Pod(not the container) gets its own IP address
: my application container can communicate with database container using the IP address)
Pods are ephemeral(easy to die) : need Permanent IP address by Service(another kubernetes component)
Usually 1 application per Pod(or multiple help/subservice applications)
my-app Pod, DB Pod, etc
Permanent IP address
Lifecycle of Pod and Service not connected
You specify the type of Service on creation
(External/Internal-default)
You have http protocol with a node IP address and the port number of the Service (e.g., http:/124.89.101.2:8080)
Load balancer : catch the request and forward to whichever part is least busy
One Service - multiple Pod(to prevent down time)
https + domain name
request goes first to Ingress and it does the forwarding them to the Service
External configuration of application
urls of a database or some other services
By ConfigMap, if you change the nane of service/the endpoint of the service you just adjust config map(don't have to build a new image and push it to repo and pull it in your Pod)
for non-confidential data only
is just like ConfigMap, but used for secret data(e.g., credentials)
stored in base 64 in encoded format
need third-party tools to encrypt them
for reliably long term persistance of database/log data
storage on local machine, or remote(outside of the K8s cluster) machine
Kubernetes doesn't manage data persistance(You have to backup)
blueprint for Pods
set the number of replicas(one Service - multiple Pods), scaling, etc
Abstraction of Pods
not for database pods
for stateful apps(e.g., mysql, mongoDB, elastic search
database reads and writes should be synchronized to prevent data inconsistencies
deploying StatefulSet in Kubernetes cluster is not easy -> DB are often hosted outside of Kubernetes cluster
To API server by UI/API/CLI(YAML/JSON)
Declarative(Controller Manager checks : desired state == actual state?)
It goes to work to make sure that this desired state is recovered automatically restarting the second replica of that Pod
apiVersion
kind : Component type
name of component, etcspecific to the kindautomatically generated and edited by Kuber netes
Kubernetes always compare what is the desired state and what is the actual state(by etcd)
if the two states do not match, Kubernates try to fix some difference(Self-healing features)
human friendly data serialization standard for all programming languages
syntax : stric indentation
store the config file with your applictaion code
or its own git repository
1) multiple Master and Worker nodes
2) separate virtual or physical machines
=> testing on local machine is difficult and maybe impossible if you don't have enough resources(need Minikube)
open source tool
one Node(machine) cluster
both the master processes and worker processes run on one node
this node will have a docker container runtime pre-installed
command line tool for K8s cluster(API server)
The most powerful of 3 clients(UI?API?CLI)
You can do anything to Kubernetes, e.g., creating Pods, destroying Pods, creating Services