연두색연필
LimePencil's Log
연두색연필
전체 방문자
오늘
어제

About Me

  • GitHub
  • Instagram
  • Gmail

인기 글

  • 분류 전체보기 (69)
    • Machine Learning (3)
      • MNIST (2)
    • PS & Algorithm (9)
    • Web (4)
      • HTML (1)
      • JavaScript (3)
    • Rust (2)
      • The Rust Programming Langua.. (2)
    • 논문 리뷰 (12)
      • Reinforcement Learning (10)
      • Computer Vision (2)
    • DevOps (17)
      • Docker (9)
      • Kubernetes (8)
    • Development (6)
      • SQL (6)
    • 잡다한 것들 (15)
      • 부스트캠프 AI Tech 4기 (13)

최근 댓글

Tag

  • 도커
  • 부스트캠프
  • Python
  • SQL
  • K8s
  • Kubernetes
  • 쿠버네티스
  • 백준
  • 파이썬
  • docker
05-28 03:55
hELLO · Designed By 정상우.
연두색연필

LimePencil's Log

DevOps/Kubernetes

[Kubernetes 배우기] Section 5. Kubernetes Concepts - Pods, ReplicaSets, Deployments

2024. 1. 9. 12:38

Kubernetes for the Absolute Beginners - Hands-on | Udemy

 

Pods

The Kubernetes pod definition file contains 4 top-level fields:

  • apiVersion
    • the version of Kubernetes version used
  • kind
    • the kind of service that is created
      • ex) Pod, Service, ReplicaSet, Deployment
  • metadata
    • data of the object such as name and labels
      • under label property, we can set whatever key-value pair we want
  • spec
    • where containers are defined along with their image and name

kubectl apply -f [name of the file].yaml: creates pod according to the YAML file in the argument

 

Replication Controllers and ReplicaSets

 

Replication Controller: allows running of multiple pods of the same image for high availability

  • ensures a specified number of pods are running at a time
  • can span across multiple nodes to scale the application
  • in the spec section of the YAML file
    • template: The YAML file of the pod is copied
    • replicas: the number of replicas is specified

ReplicaSets: newer technology that is replacing replication controllers

  • apiVersion needs to be specified as apps/v1
  • spec section is almost the same except that there is one more field to it
    • selector: monitors pods with specified labels unlike replication controllers
      • so if pods of the same labels are already running when ReplicaSets are created, it does not create a new one until one fails

Scaling ReplicaSet:

  1. change the replica filed of the YAML file and run kubectl replace -f [filename]
  2. use kubectl scale --replicas=[number of replicas] -f [filename] command

 

Deployment

Rolling Updates: Upgrading instances one by one to maintain availability

  • two ReplicaSets

Deployment: wraps around ReplicaSet to update the instance seamlessly and control changes

  • The definition file is almost the same as ReplicaSet except that the section for kind is changed to Deployment.

kubectl get all: lists all the objects created in the Kubernetes such as pods, ReplicaSets, deployments

 

Rollout is triggered when a new deployment is created.

  • the revision number increases when there is a newer version
    • this allows us to keep track of the revision history

kubectl rollout status [deployment name]: see the current status of the rollout

kubectl rollout history [deployment name]: see the history of the deployment

 

Deployment strategy:

  1. (Bad) Destroying all the instances and creating updated new instance
    1. (Good) Taking down one instance and bringing up a new instance for availability (Rolling Update)

 

kubectl apply -f [YAML file name]: updates the current running instance to a newer version

kubectl rollout undo [deployment name]: goes back to older format by destroying the current instance

'DevOps > Kubernetes' 카테고리의 다른 글

[Kubernetes 배우기] Section 7. Services  (0) 2024.01.09
[Kubernetes 배우기] Section 6. Networking in Kubernetes  (0) 2024.01.09
[Kubernetes 배우기] Section 4. YAML Introduction  (0) 2024.01.09
[Kubernetes 배우기] Section 3. Kubernetes Concepts  (0) 2024.01.09
[Kubernetes 배우기] Section 2. Kubernetes Overview  (0) 2024.01.09
    'DevOps/Kubernetes' 카테고리의 다른 글
    • [Kubernetes 배우기] Section 7. Services
    • [Kubernetes 배우기] Section 6. Networking in Kubernetes
    • [Kubernetes 배우기] Section 4. YAML Introduction
    • [Kubernetes 배우기] Section 3. Kubernetes Concepts
    연두색연필
    연두색연필
    ML, Programming, PS, 삶의 순간을 기록

    티스토리툴바